added color_cast from Vec3f and Vec4f to Vec3i and Vec3ui
refs #1405 git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@812 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
@@ -114,6 +114,58 @@ struct color_caster<Vec3uc,Vec4f>
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct color_caster<Vec3i,Vec3f>
|
||||
{
|
||||
typedef Vec3i return_type;
|
||||
|
||||
inline static return_type cast(const Vec3f& _src)
|
||||
{
|
||||
return Vec3i( (int)(_src[0]* 255.0f + 0.5f),
|
||||
(int)(_src[1]* 255.0f + 0.5f),
|
||||
(int)(_src[2]* 255.0f + 0.5f) );
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct color_caster<Vec3i,Vec4f>
|
||||
{
|
||||
typedef Vec3i return_type;
|
||||
|
||||
inline static return_type cast(const Vec4f& _src)
|
||||
{
|
||||
return Vec3i( (int)(_src[0]* 255.0f + 0.5f),
|
||||
(int)(_src[1]* 255.0f + 0.5f),
|
||||
(int)(_src[2]* 255.0f + 0.5f) );
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct color_caster<Vec3ui,Vec3f>
|
||||
{
|
||||
typedef Vec3ui return_type;
|
||||
|
||||
inline static return_type cast(const Vec3f& _src)
|
||||
{
|
||||
return Vec3ui( (unsigned int)(_src[0]* 255.0f + 0.5f),
|
||||
(unsigned int)(_src[1]* 255.0f + 0.5f),
|
||||
(unsigned int)(_src[2]* 255.0f + 0.5f) );
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct color_caster<Vec3ui,Vec4f>
|
||||
{
|
||||
typedef Vec3ui return_type;
|
||||
|
||||
inline static return_type cast(const Vec4f& _src)
|
||||
{
|
||||
return Vec3ui( (unsigned int)(_src[0]* 255.0f + 0.5f),
|
||||
(unsigned int)(_src[1]* 255.0f + 0.5f),
|
||||
(unsigned int)(_src[2]* 255.0f + 0.5f) );
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct color_caster<Vec4uc,Vec3f>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user