42 #ifndef OPENMESH_KERNEL_OSG_COLOR_CAST_HH
43 #define OPENMESH_KERNEL_OSG_COLOR_CAST_HH
46 #include <OpenMesh/Core/Utils/color_cast.hh>
47 #include <OpenSG/OSGGeometry.h>
54 struct color_caster<osg::Color3ub,osg::Color3f>
56 typedef osg::Color3ub return_type;
57 typedef unsigned char ub;
59 inline static return_type cast(
const osg::Color3f& _src)
61 return return_type( (ub)std::min((_src[0]* 255.0f + 0.5f),255.0f),
62 (ub)std::min((_src[1]* 255.0f + 0.5f),255.0f),
63 (ub)std::min((_src[2]* 255.0f + 0.5f),255.0f) );
70 struct color_caster<osg::Color3f,osg::Color3ub>
72 typedef osg::Color3f return_type;
74 inline static return_type cast(
const osg::Color3ub& _src)
76 return return_type( (
float)(_src[0] / 255.0f ),
77 (
float)(_src[1] / 255.0f ),
78 (
float)(_src[2] / 255.0f ) );
84 #endif // OPENMESH_KERNEL_OSG_COLOR_CAST_HH