- 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:
@@ -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; }
|
||||
|
||||
@@ -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_; }
|
||||
|
||||
|
||||
|
||||
@@ -153,6 +153,9 @@ bool _PLYReader_::read(std::istream& _in, BaseImporter& _bi, Options& _opt) {
|
||||
if (options_.is_binary()) {
|
||||
_opt += Options::Binary;
|
||||
}
|
||||
if (options_.color_is_float()) {
|
||||
_opt += Options::ColorFloat;
|
||||
}
|
||||
|
||||
// //force user-choice for the alpha value when reading binary
|
||||
// if ( options_.is_binary() && userOptions_.color_has_alpha() )
|
||||
@@ -992,31 +995,45 @@ bool _PLYReader_::can_u_read(std::istream& _is) const {
|
||||
std::pair<VertexProperty, ValueType> entry(COLORRED, valueType);
|
||||
vertexPropertyMap_[vertexPropertyCount_] = entry;
|
||||
options_ += Options::VertexColor;
|
||||
if (valueType == ValueTypeFLOAT || valueType == ValueTypeFLOAT32)
|
||||
options_ += Options::ColorFloat;
|
||||
} else if (propertyName == "green") {
|
||||
std::pair<VertexProperty, ValueType> entry(COLORGREEN, valueType);
|
||||
vertexPropertyMap_[vertexPropertyCount_] = entry;
|
||||
options_ += Options::VertexColor;
|
||||
if (valueType == ValueTypeFLOAT || valueType == ValueTypeFLOAT32)
|
||||
options_ += Options::ColorFloat;
|
||||
} else if (propertyName == "blue") {
|
||||
std::pair<VertexProperty, ValueType> entry(COLORBLUE, valueType);
|
||||
vertexPropertyMap_[vertexPropertyCount_] = entry;
|
||||
options_ += Options::VertexColor;
|
||||
if (valueType == ValueTypeFLOAT || valueType == ValueTypeFLOAT32)
|
||||
options_ += Options::ColorFloat;
|
||||
} else if (propertyName == "diffuse_red") {
|
||||
std::pair<VertexProperty, ValueType> entry(COLORRED, valueType);
|
||||
vertexPropertyMap_[vertexPropertyCount_] = entry;
|
||||
options_ += Options::VertexColor;
|
||||
if (valueType == ValueTypeFLOAT || valueType == ValueTypeFLOAT32)
|
||||
options_ += Options::ColorFloat;
|
||||
} else if (propertyName == "diffuse_green") {
|
||||
std::pair<VertexProperty, ValueType> entry(COLORGREEN, valueType);
|
||||
vertexPropertyMap_[vertexPropertyCount_] = entry;
|
||||
options_ += Options::VertexColor;
|
||||
if (valueType == ValueTypeFLOAT || valueType == ValueTypeFLOAT32)
|
||||
options_ += Options::ColorFloat;
|
||||
} else if (propertyName == "diffuse_blue") {
|
||||
std::pair<VertexProperty, ValueType> entry(COLORBLUE, valueType);
|
||||
vertexPropertyMap_[vertexPropertyCount_] = entry;
|
||||
options_ += Options::VertexColor;
|
||||
if (valueType == ValueTypeFLOAT || valueType == ValueTypeFLOAT32)
|
||||
options_ += Options::ColorFloat;
|
||||
} else if (propertyName == "alpha") {
|
||||
std::pair<VertexProperty, ValueType> entry(COLORALPHA, valueType);
|
||||
vertexPropertyMap_[vertexPropertyCount_] = entry;
|
||||
options_ += Options::VertexColor;
|
||||
options_ += Options::ColorAlpha;
|
||||
if (valueType == ValueTypeFLOAT || valueType == ValueTypeFLOAT32)
|
||||
options_ += Options::ColorFloat;
|
||||
} else {
|
||||
std::pair<VertexProperty, ValueType> entry(UNSUPPORTED, valueType);
|
||||
vertexPropertyMap_[vertexPropertyCount_] = entry;
|
||||
|
||||
@@ -169,24 +169,20 @@ write(std::ostream& _os, BaseExporter& _be, Options _opt, std::streamsize _preci
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
bool
|
||||
_PLYWriter_::
|
||||
write_ascii(std::ostream& _out, BaseExporter& _be, Options _opt) const
|
||||
{
|
||||
omlog() << "[PLYWriter] : write ascii file\n";
|
||||
|
||||
|
||||
unsigned int i, j, nV, nF;
|
||||
Vec3f v, n;
|
||||
OpenMesh::Vec3ui c;
|
||||
OpenMesh::Vec4ui cA;
|
||||
OpenMesh::Vec2f t;
|
||||
VertexHandle vh;
|
||||
std::vector<VertexHandle> vhandles;
|
||||
|
||||
void _PLYWriter_::write_header(std::ostream& _out, BaseExporter& _be, Options& _opt) const {
|
||||
//writing header
|
||||
_out << "ply" << std::endl;
|
||||
_out << "format ascii 1.0" << std::endl;
|
||||
|
||||
if (_opt.is_binary()) {
|
||||
_out << "format ";
|
||||
if ( options_.check(Options::MSB) )
|
||||
_out << "binary_big_endian ";
|
||||
else
|
||||
_out << "binary_little_endian ";
|
||||
_out << "1.0" << std::endl;
|
||||
} else
|
||||
_out << "format ascii 1.0" << std::endl;
|
||||
|
||||
_out << "element vertex " << _be.n_vertices() << std::endl;
|
||||
|
||||
_out << "property float x" << std::endl;
|
||||
@@ -205,17 +201,49 @@ write_ascii(std::ostream& _out, BaseExporter& _be, Options _opt) const
|
||||
}
|
||||
|
||||
if ( _opt.vertex_has_color() ){
|
||||
_out << "property uchar red" << std::endl;
|
||||
_out << "property uchar green" << std::endl;
|
||||
_out << "property uchar blue" << std::endl;
|
||||
if ( _opt.color_is_float() ) {
|
||||
_out << "property float red" << std::endl;
|
||||
_out << "property float green" << std::endl;
|
||||
_out << "property float blue" << std::endl;
|
||||
|
||||
if ( _opt.color_has_alpha() )
|
||||
_out << "property uchar alpha" << std::endl;
|
||||
if ( _opt.color_has_alpha() )
|
||||
_out << "property float alpha" << std::endl;
|
||||
} else {
|
||||
_out << "property uchar red" << std::endl;
|
||||
_out << "property uchar green" << std::endl;
|
||||
_out << "property uchar blue" << std::endl;
|
||||
|
||||
if ( _opt.color_has_alpha() )
|
||||
_out << "property uchar alpha" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
_out << "element face " << _be.n_faces() << std::endl;
|
||||
_out << "property list uchar int vertex_indices" << std::endl;
|
||||
_out << "end_header" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
bool
|
||||
_PLYWriter_::
|
||||
write_ascii(std::ostream& _out, BaseExporter& _be, Options _opt) const
|
||||
{
|
||||
omlog() << "[PLYWriter] : write ascii file\n";
|
||||
|
||||
unsigned int i, j, nV, nF;
|
||||
Vec3f v, n;
|
||||
OpenMesh::Vec3ui c;
|
||||
OpenMesh::Vec4ui cA;
|
||||
OpenMesh::Vec3f cf;
|
||||
OpenMesh::Vec4f cAf;
|
||||
OpenMesh::Vec2f t;
|
||||
VertexHandle vh;
|
||||
std::vector<VertexHandle> vhandles;
|
||||
|
||||
write_header(_out, _be, _opt);
|
||||
|
||||
// vertex data (point, normals, colors, texcoords)
|
||||
for (i=0, nV=_be.n_vertices(); i<nV; ++i)
|
||||
@@ -242,12 +270,22 @@ write_ascii(std::ostream& _out, BaseExporter& _be, Options _opt) const
|
||||
if ( _opt.vertex_has_color() ) {
|
||||
//with alpha
|
||||
if ( _opt.color_has_alpha() ){
|
||||
cA = _be.colorAi(vh);
|
||||
_out << " " << cA;
|
||||
if (_opt.color_is_float()) {
|
||||
cAf = _be.colorAf(vh);
|
||||
_out << " " << cAf;
|
||||
} else {
|
||||
cA = _be.colorAi(vh);
|
||||
_out << " " << cA;
|
||||
}
|
||||
}else{
|
||||
//without alpha
|
||||
c = _be.colori(vh);
|
||||
_out << " " << c;
|
||||
if (_opt.color_is_float()) {
|
||||
cf = _be.colorf(vh);
|
||||
_out << " " << cf;
|
||||
} else {
|
||||
c = _be.colori(vh);
|
||||
_out << " " << c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,49 +421,11 @@ write_binary(std::ostream& _out, BaseExporter& _be, Options _opt) const
|
||||
Vec3f v, n;
|
||||
Vec2f t;
|
||||
OpenMesh::Vec4uc c;
|
||||
OpenMesh::Vec4f cf;
|
||||
VertexHandle vh;
|
||||
std::vector<VertexHandle> vhandles;
|
||||
|
||||
//writing header
|
||||
_out << "ply" << std::endl;
|
||||
_out << "format ";
|
||||
|
||||
if ( options_.check(Options::MSB) )
|
||||
_out << "binary_big_endian ";
|
||||
else
|
||||
_out << "binary_little_endian ";
|
||||
|
||||
_out << "1.0" << std::endl;
|
||||
|
||||
_out << "element vertex " << _be.n_vertices() << std::endl;
|
||||
|
||||
_out << "property float x" << std::endl;
|
||||
_out << "property float y" << std::endl;
|
||||
_out << "property float z" << std::endl;
|
||||
|
||||
if ( _opt.vertex_has_normal() ){
|
||||
_out << "property float nx" << std::endl;
|
||||
_out << "property float ny" << std::endl;
|
||||
_out << "property float nz" << std::endl;
|
||||
}
|
||||
|
||||
if ( _opt.vertex_has_texcoord() ){
|
||||
_out << "property float u" << std::endl;
|
||||
_out << "property float v" << std::endl;
|
||||
}
|
||||
|
||||
if ( _opt.vertex_has_color() ){
|
||||
_out << "property uchar red" << std::endl;
|
||||
_out << "property uchar green" << std::endl;
|
||||
_out << "property uchar blue" << std::endl;
|
||||
|
||||
if ( _opt.color_has_alpha() )
|
||||
_out << "property uchar alpha" << std::endl;
|
||||
}
|
||||
|
||||
_out << "element face " << _be.n_faces() << std::endl;
|
||||
_out << "property list uchar int vertex_indices" << std::endl;
|
||||
_out << "end_header" << std::endl;
|
||||
write_header(_out, _be, _opt);
|
||||
|
||||
// vertex data (point, normals, texcoords)
|
||||
for (i=0, nV=_be.n_vertices(); i<nV; ++i)
|
||||
@@ -455,13 +455,23 @@ write_binary(std::ostream& _out, BaseExporter& _be, Options _opt) const
|
||||
|
||||
// vertex color
|
||||
if ( _opt.vertex_has_color() ) {
|
||||
c = _be.colorA(vh);
|
||||
writeValue(ValueTypeUCHAR, _out, (int)c[0]);
|
||||
writeValue(ValueTypeUCHAR, _out, (int)c[1]);
|
||||
writeValue(ValueTypeUCHAR, _out, (int)c[2]);
|
||||
if ( _opt.color_is_float() ) {
|
||||
cf = _be.colorAf(vh);
|
||||
writeValue(ValueTypeFLOAT, _out, cf[0]);
|
||||
writeValue(ValueTypeFLOAT, _out, cf[1]);
|
||||
writeValue(ValueTypeFLOAT, _out, cf[2]);
|
||||
|
||||
if ( _opt.color_has_alpha() )
|
||||
writeValue(ValueTypeUCHAR, _out, (int)c[3]);
|
||||
if ( _opt.color_has_alpha() )
|
||||
writeValue(ValueTypeFLOAT, _out, cf[3]);
|
||||
} else {
|
||||
c = _be.colorA(vh);
|
||||
writeValue(ValueTypeUCHAR, _out, (int)c[0]);
|
||||
writeValue(ValueTypeUCHAR, _out, (int)c[1]);
|
||||
writeValue(ValueTypeUCHAR, _out, (int)c[2]);
|
||||
|
||||
if ( _opt.color_has_alpha() )
|
||||
writeValue(ValueTypeUCHAR, _out, (int)c[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -116,8 +116,9 @@ protected:
|
||||
void writeValue(ValueType _type, std::ostream& _out, unsigned int value) const;
|
||||
void writeValue(ValueType _type, std::ostream& _out, float value) const;
|
||||
|
||||
bool write_ascii(std::ostream& _in, BaseExporter&, Options) const;
|
||||
bool write_binary(std::ostream& _in, BaseExporter&, Options) const;
|
||||
bool write_ascii(std::ostream& _out, BaseExporter&, Options) const;
|
||||
bool write_binary(std::ostream& _out, BaseExporter&, Options) const;
|
||||
void write_header(std::ostream& _out, BaseExporter& _be, Options& _opt) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -248,6 +248,111 @@ TEST_F(OpenMeshReadWritePLY, WriteAndReadBinaryPLYWithVertexColors) {
|
||||
mesh_.release_vertex_colors();
|
||||
}
|
||||
|
||||
/*
|
||||
* Just read and write a ply file of a cube with float vertex colors
|
||||
*/
|
||||
TEST_F(OpenMeshReadWritePLY, WriteAndReadPLYWithFloatVertexColors) {
|
||||
|
||||
mesh_.clear();
|
||||
|
||||
mesh_.request_vertex_colors();
|
||||
|
||||
OpenMesh::IO::Options options;
|
||||
options += OpenMesh::IO::Options::VertexColor;
|
||||
|
||||
bool ok = OpenMesh::IO::read_mesh(mesh_, "meshlab.ply",options);
|
||||
|
||||
EXPECT_TRUE(ok) << "Unable to load meshlab.ply";
|
||||
|
||||
options += OpenMesh::IO::Options::ColorFloat;
|
||||
|
||||
ok = OpenMesh::IO::write_mesh(mesh_, "meshlab_float.ply",options);
|
||||
EXPECT_TRUE(ok) << "Unable to write meshlab_float.ply";
|
||||
|
||||
mesh_.clear();
|
||||
ok = OpenMesh::IO::read_mesh(mesh_, "meshlab_float.ply",options);
|
||||
EXPECT_TRUE(ok) << "Unable to load meshlab_float.ply";
|
||||
|
||||
EXPECT_EQ(8u , mesh_.n_vertices()) << "The number of loaded vertices is not correct!";
|
||||
EXPECT_EQ(18u , mesh_.n_edges()) << "The number of loaded edges is not correct!";
|
||||
EXPECT_EQ(12u , mesh_.n_faces()) << "The number of loaded faces is not correct!";
|
||||
|
||||
EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(0))[0] ) << "Wrong vertex color at vertex 0 component 0";
|
||||
EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(0))[1] ) << "Wrong vertex color at vertex 0 component 1";
|
||||
EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(0))[2] ) << "Wrong vertex color at vertex 0 component 2";
|
||||
|
||||
EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(3))[0] ) << "Wrong vertex color at vertex 3 component 0";
|
||||
EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(3))[1] ) << "Wrong vertex color at vertex 3 component 1";
|
||||
EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(3))[2] ) << "Wrong vertex color at vertex 3 component 2";
|
||||
|
||||
EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(4))[0] ) << "Wrong vertex color at vertex 4 component 0";
|
||||
EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(4))[1] ) << "Wrong vertex color at vertex 4 component 1";
|
||||
EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(4))[2] ) << "Wrong vertex color at vertex 4 component 2";
|
||||
|
||||
EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(7))[0] ) << "Wrong vertex color at vertex 7 component 0";
|
||||
EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(7))[1] ) << "Wrong vertex color at vertex 7 component 1";
|
||||
EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(7))[2] ) << "Wrong vertex color at vertex 7 component 2";
|
||||
|
||||
EXPECT_FALSE(options.vertex_has_normal()) << "Wrong user options are returned!";
|
||||
EXPECT_FALSE(options.vertex_has_texcoord()) << "Wrong user options are returned!";
|
||||
EXPECT_TRUE(options.vertex_has_color()) << "Wrong user options are returned!";
|
||||
|
||||
mesh_.release_vertex_colors();
|
||||
}
|
||||
|
||||
/*
|
||||
* Just read and write a binary ply file of a cube with float vertex colors
|
||||
*/
|
||||
TEST_F(OpenMeshReadWritePLY, WriteAndReadBinaryPLYWithFloatVertexColors) {
|
||||
|
||||
mesh_.clear();
|
||||
|
||||
mesh_.request_vertex_colors();
|
||||
|
||||
OpenMesh::IO::Options options;
|
||||
options += OpenMesh::IO::Options::VertexColor;
|
||||
|
||||
bool ok = OpenMesh::IO::read_mesh(mesh_, "meshlab.ply",options);
|
||||
|
||||
EXPECT_TRUE(ok) << "Unable to load meshlab.ply";
|
||||
|
||||
options += OpenMesh::IO::Options::ColorFloat;
|
||||
options += OpenMesh::IO::Options::Binary;
|
||||
|
||||
ok = OpenMesh::IO::write_mesh(mesh_, "meshlab_binary_float.ply",options);
|
||||
EXPECT_TRUE(ok) << "Unable to write meshlab_binary_float.ply";
|
||||
|
||||
mesh_.clear();
|
||||
ok = OpenMesh::IO::read_mesh(mesh_, "meshlab_binary_float.ply",options);
|
||||
EXPECT_TRUE(ok) << "Unable to load meshlab_binary_float.ply";
|
||||
|
||||
EXPECT_EQ(8u , mesh_.n_vertices()) << "The number of loaded vertices is not correct!";
|
||||
EXPECT_EQ(18u , mesh_.n_edges()) << "The number of loaded edges is not correct!";
|
||||
EXPECT_EQ(12u , mesh_.n_faces()) << "The number of loaded faces is not correct!";
|
||||
|
||||
EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(0))[0] ) << "Wrong vertex color at vertex 0 component 0";
|
||||
EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(0))[1] ) << "Wrong vertex color at vertex 0 component 1";
|
||||
EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(0))[2] ) << "Wrong vertex color at vertex 0 component 2";
|
||||
|
||||
EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(3))[0] ) << "Wrong vertex color at vertex 3 component 0";
|
||||
EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(3))[1] ) << "Wrong vertex color at vertex 3 component 1";
|
||||
EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(3))[2] ) << "Wrong vertex color at vertex 3 component 2";
|
||||
|
||||
EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(4))[0] ) << "Wrong vertex color at vertex 4 component 0";
|
||||
EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(4))[1] ) << "Wrong vertex color at vertex 4 component 1";
|
||||
EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(4))[2] ) << "Wrong vertex color at vertex 4 component 2";
|
||||
|
||||
EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(7))[0] ) << "Wrong vertex color at vertex 7 component 0";
|
||||
EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(7))[1] ) << "Wrong vertex color at vertex 7 component 1";
|
||||
EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(7))[2] ) << "Wrong vertex color at vertex 7 component 2";
|
||||
|
||||
EXPECT_FALSE(options.vertex_has_normal()) << "Wrong user options are returned!";
|
||||
EXPECT_FALSE(options.vertex_has_texcoord()) << "Wrong user options are returned!";
|
||||
EXPECT_TRUE(options.vertex_has_color()) << "Wrong user options are returned!";
|
||||
|
||||
mesh_.release_vertex_colors();
|
||||
}
|
||||
|
||||
/*
|
||||
* Just load a ply file of a cube with vertex texCoords
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user