* added texCoord3d functions to objloader
* added unittest for texcoords3d * added texcoord3d support to baseimporter
This commit is contained in:
39
src/Unittests/TestFiles/cube-minimal-texCoords3d.obj
Normal file
39
src/Unittests/TestFiles/cube-minimal-texCoords3d.obj
Normal file
@@ -0,0 +1,39 @@
|
||||
g cube
|
||||
v 0.0 0.0 0.0
|
||||
v 0.0 0.0 1.0
|
||||
v 0.0 1.0 0.0
|
||||
v 0.0 1.0 1.0
|
||||
v 1.0 0.0 0.0
|
||||
v 1.0 0.0 1.0
|
||||
v 1.0 1.0 0.0
|
||||
v 1.0 1.0 1.0
|
||||
vn 0.0 0.0 1.0
|
||||
vn 0.0 0.0 -1.0
|
||||
vn 0.0 1.0 0.0
|
||||
vn 0.0 -1.0 0.0
|
||||
vn 1.0 0.0 0.0
|
||||
vn -1.0 0.0 0.0
|
||||
vt 1.0 1.0 1.0
|
||||
vt 2.0 2.0 2.0
|
||||
vt 3.0 3.0 3.0
|
||||
vt 4.0 4.0 4.0
|
||||
vt 5.0 5.0 5.0
|
||||
vt 6.0 6.0 6.0
|
||||
vt 7.0 7.0 7.0
|
||||
vt 8.0 8.0 8.0
|
||||
vt 9.0 9.0 9.0
|
||||
vt 10.0 10.0 10.0
|
||||
vt 11.0 11.0 11.0
|
||||
vt 12.0 12.0 12.0
|
||||
f 1/1/2 7/1/2 5/1/2
|
||||
f 1/2/2 3/2/2 7/2/2
|
||||
f 1/3/6 4/3/6 3/3/6
|
||||
f 1/4/6 2/4/6 4/4/6
|
||||
f 3/5/3 8/5/3 7/5/3
|
||||
f 3/6/3 4/6/3 8/6/3
|
||||
f 5/7/5 7/7/5 8/7/5
|
||||
f 5/8/5 8/8/5 6/8/5
|
||||
f 1/9/4 5/9/4 6/9/4
|
||||
f 1/10/4 6/10/4 2/10/4
|
||||
f 2/11/1 6/11/1 8/11/1
|
||||
f 2/12/1 8/12/1 4/12/1
|
||||
@@ -202,6 +202,51 @@ TEST_F(OpenMeshReadWriteOBJ, LoadSimpleOBJCheckTexCoords) {
|
||||
mesh_.release_halfedge_texcoords2D();
|
||||
}
|
||||
|
||||
/*
|
||||
* Just load a obj file of a cube and checks the 3d halfedge texCoords
|
||||
*/
|
||||
TEST_F(OpenMeshReadWriteOBJ, LoadSimpleOBJCheckTexCoords3d) {
|
||||
|
||||
mesh_.clear();
|
||||
|
||||
mesh_.request_halfedge_texcoords3D();
|
||||
|
||||
OpenMesh::IO::Options options;
|
||||
options += OpenMesh::IO::Options::FaceTexCoord;
|
||||
|
||||
std::string file_name = "cube-minimal-texCoords3d.obj";
|
||||
|
||||
bool ok = OpenMesh::IO::read_mesh(mesh_, file_name,options);
|
||||
|
||||
EXPECT_TRUE(ok) << file_name;
|
||||
|
||||
EXPECT_EQ(1, mesh_.texcoord3D(mesh_.halfedge_handle(0))[0] ) << "Wrong texCoord at halfedge 0 component 0";
|
||||
EXPECT_EQ(1, mesh_.texcoord3D(mesh_.halfedge_handle(0))[1] ) << "Wrong texCoord at halfedge 0 component 1";
|
||||
EXPECT_EQ(1, mesh_.texcoord3D(mesh_.halfedge_handle(0))[2] ) << "Wrong texCoord at halfedge 0 component 2";
|
||||
|
||||
EXPECT_EQ(3, mesh_.texcoord3D(mesh_.halfedge_handle(10))[0] ) << "Wrong texCoord at halfedge 1 component 0";
|
||||
EXPECT_EQ(3, mesh_.texcoord3D(mesh_.halfedge_handle(10))[1] ) << "Wrong texCoord at halfedge 1 component 1";
|
||||
EXPECT_EQ(3, mesh_.texcoord3D(mesh_.halfedge_handle(10))[2] ) << "Wrong texCoord at halfedge 1 component 2";
|
||||
|
||||
EXPECT_EQ(6, mesh_.texcoord3D(mesh_.halfedge_handle(19))[0] ) << "Wrong texCoord at halfedge 4 component 0";
|
||||
EXPECT_EQ(6, mesh_.texcoord3D(mesh_.halfedge_handle(19))[1] ) << "Wrong texCoord at halfedge 4 component 1";
|
||||
EXPECT_EQ(6, mesh_.texcoord3D(mesh_.halfedge_handle(19))[2] ) << "Wrong texCoord at halfedge 4 component 2";
|
||||
|
||||
EXPECT_EQ(7, mesh_.texcoord3D(mesh_.halfedge_handle(24))[0] ) << "Wrong texCoord at halfedge 7 component 0";
|
||||
EXPECT_EQ(7, mesh_.texcoord3D(mesh_.halfedge_handle(24))[1] ) << "Wrong texCoord at halfedge 7 component 1";
|
||||
EXPECT_EQ(7, mesh_.texcoord3D(mesh_.halfedge_handle(24))[2] ) << "Wrong texCoord at halfedge 7 component 2";
|
||||
|
||||
EXPECT_EQ(9, mesh_.texcoord3D(mesh_.halfedge_handle(30))[0] ) << "Wrong texCoord at halfedge 9 component 0";
|
||||
EXPECT_EQ(9, mesh_.texcoord3D(mesh_.halfedge_handle(30))[1] ) << "Wrong texCoord at halfedge 9 component 1";
|
||||
EXPECT_EQ(9, mesh_.texcoord3D(mesh_.halfedge_handle(30))[2] ) << "Wrong texCoord at halfedge 9 component 2";
|
||||
|
||||
EXPECT_EQ(12, mesh_.texcoord3D(mesh_.halfedge_handle(35))[0] ) << "Wrong texCoord at halfedge 11 component 0";
|
||||
EXPECT_EQ(12, mesh_.texcoord3D(mesh_.halfedge_handle(35))[1] ) << "Wrong texCoord at halfedge 11 component 1";
|
||||
EXPECT_EQ(12, mesh_.texcoord3D(mesh_.halfedge_handle(35))[2] ) << "Wrong texCoord at halfedge 11 component 2";
|
||||
|
||||
mesh_.request_halfedge_texcoords3D();
|
||||
}
|
||||
|
||||
/*
|
||||
* Just load a obj file of a square with a material
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user