From 5735102cb7178a8947a55244a36a75909ef7da19 Mon Sep 17 00:00:00 2001 From: Giorgio Marcias Date: Tue, 6 Dec 2016 14:50:50 +0100 Subject: [PATCH] double specialization of some Color4 methods were missing --- vcg/space/color4.h | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/vcg/space/color4.h b/vcg/space/color4.h index bcc31a53..e98cdc5f 100644 --- a/vcg/space/color4.h +++ b/vcg/space/color4.h @@ -281,6 +281,15 @@ inline void Color4::Import(const Color4 &b) (*this)[3]=b[3]/255.0f; } +template <> template <> +inline void Color4::Import(const Color4 &b) +{ + (*this)[0]=b[0]/255.0; + (*this)[1]=b[1]/255.0; + (*this)[2]=b[2]/255.0; + (*this)[3]=b[3]/255.0; +} + template <> template <> inline void Color4::Import(const Color4 &b) { @@ -299,6 +308,15 @@ inline void Color4::Import(const Point4 &b) (*this)[3]=(unsigned char)(b[3]*255.0f); } +template <> template <> +inline void Color4::Import(const Point4 &b) +{ + (*this)[0]=(unsigned char)(b[0]*255.0); + (*this)[1]=(unsigned char)(b[1]*255.0); + (*this)[2]=(unsigned char)(b[2]*255.0); + (*this)[3]=(unsigned char)(b[3]*255.0); +} + template <> template <> inline Color4 Color4::Construct( const Color4 & b ) { @@ -319,6 +337,16 @@ inline Color4 Color4::Construct( const Color4 & b ) (float)(b[3])/255.0f); } +template <> template <> +inline Color4 Color4::Construct( const Color4 & b ) +{ + return Color4( + (double)(b[0])/255.0, + (double)(b[1])/255.0, + (double)(b[2])/255.0, + (double)(b[3])/255.0); +} + template<> inline Color4::Color4(Color4::ColorConstant cc) { @@ -331,6 +359,12 @@ inline Color4::Color4(Color4::ColorConstant cc) Import(Color4((Color4::ColorConstant)cc)); } +template<> +inline Color4::Color4(Color4::ColorConstant cc) +{ + Import(Color4((Color4::ColorConstant)cc)); +} + template<> inline Color4::Color4(unsigned int cc) { @@ -343,6 +377,12 @@ inline Color4::Color4(unsigned int cc) Import(Color4(cc)); } +template<> +inline Color4::Color4(unsigned int cc) +{ + Import(Color4(cc)); +} + inline Color4 Clamp(Color4 &c) { c[0]=math::Clamp(c[0],0.0f,1.0f); @@ -352,6 +392,15 @@ inline Color4 Clamp(Color4 &c) return c; } +inline Color4 Clamp(Color4 &c) +{ + c[0]=math::Clamp(c[0],0.0,1.0); + c[1]=math::Clamp(c[1],0.0,1.0); + c[2]=math::Clamp(c[2],0.0,1.0); + c[3]=math::Clamp(c[3],0.0,1.0); + return c; +} + template<> inline Color4 Color4::operator + ( const Color4 & p) const {