diff --git a/include/osg/Vec4ub b/include/osg/Vec4ub index 20b511b36..418a80b24 100644 --- a/include/osg/Vec4ub +++ b/include/osg/Vec4ub @@ -14,7 +14,7 @@ #ifndef OSG_VEC4UB #define OSG_VEC4UB 1 -#include +#include namespace osg { @@ -166,6 +166,24 @@ class Vec4ub }; // end of class Vec4ub +inline Vec4ub convertToRGBA8(const Vec4f& color) +{ + return Vec4ub(static_cast(color.r()*255.0f), + static_cast(color.g()*255.0f), + static_cast(color.b()*255.0f), + static_cast(color.a()*255.0f)); + +} + +inline Vec4ub convertToRGBA8(float r, float g, float b, float a) +{ + return Vec4ub(static_cast(r*255.0f), + static_cast(g*255.0f), + static_cast(b*255.0f), + static_cast(a*255.0f)); + +} + } // end of namespace osg #endif