Merge pull request #1494 from assimp/invalid_normals_in_unittest

UnitTest: use correct initialized normals in unittest.
pull/1480/head
Kim Kulling 2017-10-14 17:45:30 +02:00 committed by GitHub
commit 8e7f476490
1 changed files with 14 additions and 6 deletions

View File

@ -90,8 +90,9 @@ void PretransformVerticesTest::SetUp()
// add 5 empty materials
scene->mMaterials = new aiMaterial*[scene->mNumMaterials = 5];
for (unsigned int i = 0; i < 5;++i)
for (unsigned int i = 0; i < 5;++i) {
scene->mMaterials[i] = new aiMaterial();
}
// add 25 test meshes
scene->mMeshes = new aiMesh*[scene->mNumMeshes = 25];
@ -110,8 +111,15 @@ void PretransformVerticesTest::SetUp()
}
mesh->mMaterialIndex = i%5;
if (i % 2)
if (i % 2) {
mesh->mNormals = new aiVector3D[mesh->mNumVertices];
for ( unsigned int normalIdx=0; normalIdx<mesh->mNumVertices; ++normalIdx ) {
mesh->mNormals[ normalIdx ].x = 1.0f;
mesh->mNormals[ normalIdx ].y = 1.0f;
mesh->mNormals[ normalIdx ].z = 1.0f;
mesh->mNormals[ normalIdx ].Normalize();
}
}
}
// construct some nodes (1+25)