- added color_cast from Vec4f to Vec4i and Vec4ui

- added colori and colorAi functions to BaseExporter which return Vec3i and Vec4i respectively
- adjusted the PLYWriter to use colori and colorAi for writing ascii files

refs #1405

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@815 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
Isaak Lim
2013-02-27 13:25:42 +00:00
parent 7460c8ac82
commit 951aa17bd9
4 changed files with 134 additions and 61 deletions

View File

@@ -140,6 +140,20 @@ struct color_caster<Vec3i,Vec4f>
}
};
template <>
struct color_caster<Vec4i,Vec4f>
{
typedef Vec4i return_type;
inline static return_type cast(const Vec4f& _src)
{
return Vec4i( (int)(_src[0]* 255.0f + 0.5f),
(int)(_src[1]* 255.0f + 0.5f),
(int)(_src[2]* 255.0f + 0.5f),
(int)(_src[3]* 255.0f + 0.5f) );
}
};
template <>
struct color_caster<Vec3ui,Vec3f>
{
@@ -166,6 +180,20 @@ struct color_caster<Vec3ui,Vec4f>
}
};
template <>
struct color_caster<Vec4ui,Vec4f>
{
typedef Vec4ui return_type;
inline static return_type cast(const Vec4f& _src)
{
return Vec4ui( (unsigned int)(_src[0]* 255.0f + 0.5f),
(unsigned int)(_src[1]* 255.0f + 0.5f),
(unsigned int)(_src[2]* 255.0f + 0.5f),
(unsigned int)(_src[3]* 255.0f + 0.5f) );
}
};
template <>
struct color_caster<Vec4uc,Vec3f>
{