added a ply file written with MeshLab and a corresponding unittest
git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@810 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
34
src/Unittests/TestFiles/meshlab.ply
Normal file
34
src/Unittests/TestFiles/meshlab.ply
Normal file
@@ -0,0 +1,34 @@
|
||||
ply
|
||||
format ascii 1.0
|
||||
comment VCGLIB generated
|
||||
element vertex 8
|
||||
property float x
|
||||
property float y
|
||||
property float z
|
||||
property uchar red
|
||||
property uchar green
|
||||
property uchar blue
|
||||
property uchar alpha
|
||||
element face 12
|
||||
property list uchar int vertex_indices
|
||||
end_header
|
||||
0.5 0.5 0.5 0 0 255 255
|
||||
-0.5 0.5 0.5 0 0 255 255
|
||||
0.5 -0.5 0.5 0 0 255 255
|
||||
-0.5 -0.5 0.5 0 0 255 255
|
||||
0.5 0.5 -0.5 0 0 255 255
|
||||
-0.5 0.5 -0.5 0 0 255 255
|
||||
0.5 -0.5 -0.5 0 0 255 255
|
||||
-0.5 -0.5 -0.5 0 0 255 255
|
||||
3 0 1 2
|
||||
3 3 2 1
|
||||
3 0 2 4
|
||||
3 6 4 2
|
||||
3 0 4 1
|
||||
3 5 1 4
|
||||
3 7 5 6
|
||||
3 4 6 5
|
||||
3 7 6 3
|
||||
3 2 3 6
|
||||
3 7 3 5
|
||||
3 1 5 3
|
||||
@@ -490,6 +490,49 @@ TEST_F(OpenMeshLoader, LoadSimplePLYWithVertexColors) {
|
||||
mesh_.release_vertex_colors();
|
||||
}
|
||||
|
||||
/*
|
||||
* Just load a ply file of a cube with vertex colors
|
||||
*/
|
||||
TEST_F(OpenMeshLoader, LoadPLYFromMeshLabWithVertexColors) {
|
||||
|
||||
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";
|
||||
|
||||
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