diff --git a/vcg/space/color4.h b/vcg/space/color4.h index 89079e82..f4ea11f4 100644 --- a/vcg/space/color4.h +++ b/vcg/space/color4.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.15 2007/09/21 11:34:10 ponchio +Just a clarification comment + Revision 1.14 2006/06/08 08:52:02 zifnab1974 gcc 4 needs the extra template keyword @@ -126,6 +129,21 @@ public: Point4::_v[3] = T(b[3]); } + template + inline void Import(const Point4 & b ) + { + Point4::_v[0] = T(b[0]); + Point4::_v[1] = T(b[1]); + Point4::_v[2] = T(b[2]); + Point4::_v[3] = T(b[3]); + } + + template + static inline Color4 Construct( const Color4 & b ) + { + return Color4(T(b[0]),T(b[1]),T(b[2]),T(b[3])); + } + //inline void Import(const Color4 &b); //inline void Import(const Color4 &b); @@ -285,6 +303,43 @@ inline void Color4::Import(const Color4 &b) this->_v[3]=(unsigned char)(b[3]*255.0f); } +#if !defined(__GNUC__) || (__GNUC__ > 3) +template <> // [Bug c++/14479] enum definition in template class with template methods causes error. +#endif +template <> +inline void Color4::Import(const Point4 &b) +{ + this->_v[0]=(unsigned char)(b[0]*255.0f); + this->_v[1]=(unsigned char)(b[1]*255.0f); + this->_v[2]=(unsigned char)(b[2]*255.0f); + this->_v[3]=(unsigned char)(b[3]*255.0f); +} + +#if !defined(__GNUC__) || (__GNUC__ > 3) +template <> +#endif +template <> +inline Color4 Color4::Construct( const Color4 & b ) +{ + return Color4( + (unsigned char)(b[0]*255.0f), + (unsigned char)(b[1]*255.0f), + (unsigned char)(b[2]*255.0f), + (unsigned char)(b[3]*255.0f)); +} + +#if !defined(__GNUC__) || (__GNUC__ > 3) +template <> +#endif +template <> +inline Color4 Color4::Construct( const Color4 & b ) +{ + return Color4( + (float)(b[0])/255.0f, + (float)(b[1])/255.0f, + (float)(b[2])/255.0f, + (float)(b[3])/255.0f); +} //template //inline void Color4::Import(const Color4 &b)