49 #ifndef OPENMESH_KERNEL_OSG_COLOR_CAST_HH
50 #define OPENMESH_KERNEL_OSG_COLOR_CAST_HH
53 #include <OpenMesh/Core/Utils/color_cast.hh>
54 #include <OpenSG/OSGGeometry.h>
61 struct color_caster<osg::Color3ub,osg::Color3f>
63 typedef osg::Color3ub return_type;
64 typedef unsigned char ub;
66 inline static return_type cast(
const osg::Color3f& _src)
68 return return_type( (ub)std::min((_src[0]* 255.0f + 0.5f),255.0f),
69 (ub)std::min((_src[1]* 255.0f + 0.5f),255.0f),
70 (ub)std::min((_src[2]* 255.0f + 0.5f),255.0f) );
77 struct color_caster<osg::Color3f,osg::Color3ub>
79 typedef osg::Color3f return_type;
81 inline static return_type cast(
const osg::Color3ub& _src)
83 return return_type( (
float)(_src[0] / 255.0f ),
84 (
float)(_src[1] / 255.0f ),
85 (
float)(_src[2] / 255.0f ) );
91 #endif // OPENMESH_KERNEL_OSG_COLOR_CAST_HH