Add test for glTF2 points

pull/2081/head
Alexandre Avenel 2018-08-02 19:07:51 +02:00
parent 29ebb126b8
commit 15c2a96d25
1 changed files with 16 additions and 3 deletions

View File

@ -145,6 +145,19 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesStrip) {
}
}
TEST_F(utglTF2ImportExport, importglTF2PrimitiveModePoints) {
Assimp::Importer importer;
//Line loop
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_07.gltf", aiProcess_ValidateDataStructure);
EXPECT_NE(nullptr, scene);
EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 1024);
for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i)
{
EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 1);
EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], i);
}
}
TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLineLoop) {
Assimp::Importer importer;
//Line loop
@ -153,7 +166,7 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLineLoop) {
EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4);
std::array<int, 5> l1 = { 0, 3, 2, 1, 0};
EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2);
for (int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i)
for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i)
{
EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], l1[i]);
EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[1], l1[i+1]);
@ -168,7 +181,7 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLines) {
EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4);
std::array<int, 5> l1 = { 0, 3, 2, 1, 0 };
EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2);
for (int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i)
for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i)
{
EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], l1[i]);
EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[1], l1[i + 1]);
@ -183,7 +196,7 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLineStrip) {
EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4);
std::array<int, 5> l1 = { 0, 3, 2, 1, 0 };
EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2);
for (int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i)
for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i)
{
EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], l1[i]);
EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[1], l1[i + 1]);