- the OM PLY writer and reader can now also handle color floats

- added corresponding unittests

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@817 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
Isaak Lim
2013-03-01 15:32:46 +00:00
parent 2857da21b6
commit 57b3908771
6 changed files with 258 additions and 75 deletions

View File

@@ -93,6 +93,8 @@ public:
virtual Vec4uc colorA(VertexHandle _vh) const = 0;
virtual Vec3ui colori(VertexHandle _vh) const = 0;
virtual Vec4ui colorAi(VertexHandle _vh) const = 0;
virtual Vec3f colorf(VertexHandle _vh) const = 0;
virtual Vec4f colorAf(VertexHandle _vh) const = 0;
virtual Vec2f texcoord(VertexHandle _vh) const = 0;
@@ -103,12 +105,18 @@ public:
virtual Vec3f normal(FaceHandle _fh) const = 0;
virtual Vec3uc color (FaceHandle _fh) const = 0;
virtual Vec4uc colorA(FaceHandle _fh) const = 0;
virtual Vec3ui colori(FaceHandle _fh) const = 0;
virtual Vec4ui colorAi(FaceHandle _fh) const = 0;
virtual Vec3f colorf(FaceHandle _fh) const = 0;
virtual Vec4f colorAf(FaceHandle _fh) const = 0;
// get edge data
virtual Vec3uc color(EdgeHandle _eh) const = 0;
virtual Vec4uc colorA(EdgeHandle _eh) const = 0;
virtual Vec3ui colori(EdgeHandle _vh) const = 0;
virtual Vec4ui colorAi(EdgeHandle _vh) const = 0;
virtual Vec3ui colori(EdgeHandle _eh) const = 0;
virtual Vec4ui colorAi(EdgeHandle _eh) const = 0;
virtual Vec3f colorf(EdgeHandle _eh) const = 0;
virtual Vec4f colorAf(EdgeHandle _eh) const = 0;
// get reference to base kernel
virtual const BaseKernel* kernel() { return 0; }

View File

@@ -127,6 +127,20 @@ public:
: Vec4ui(0, 0, 0, 0));
}
Vec3f colorf(VertexHandle _vh) const
{
return (mesh_.has_vertex_colors()
? color_cast<Vec3f>(mesh_.color(_vh))
: Vec3f(0, 0, 0));
}
Vec4f colorAf(VertexHandle _vh) const
{
return (mesh_.has_vertex_colors()
? color_cast<Vec4f>(mesh_.color(_vh))
: Vec4f(0, 0, 0, 0));
}
Vec2f texcoord(VertexHandle _vh) const
{
#if defined(OM_CC_GCC) && (OM_CC_VERSION<30000)
@@ -173,6 +187,20 @@ public:
: Vec4ui(0, 0, 0, 0));
}
Vec3f colorf(EdgeHandle _eh) const
{
return (mesh_.has_vertex_colors()
? color_cast<Vec3f>(mesh_.color(_eh))
: Vec3f(0, 0, 0));
}
Vec4f colorAf(EdgeHandle _eh) const
{
return (mesh_.has_vertex_colors()
? color_cast<Vec4f>(mesh_.color(_eh))
: Vec4f(0, 0, 0, 0));
}
// get face data
unsigned int get_vhandles(FaceHandle _fh,
@@ -223,6 +251,20 @@ public:
: Vec4ui(0, 0, 0, 0));
}
Vec3f colorf(FaceHandle _fh) const
{
return (mesh_.has_vertex_colors()
? color_cast<Vec3f>(mesh_.color(_fh))
: Vec3f(0, 0, 0));
}
Vec4f colorAf(FaceHandle _fh) const
{
return (mesh_.has_vertex_colors()
? color_cast<Vec4f>(mesh_.color(_fh))
: Vec4f(0, 0, 0, 0));
}
virtual const BaseKernel* kernel() { return &mesh_; }