test/unit/utScenePreprocessor.cpp
// ------------------------------------------------------------------------------------------------
// Check whether a mesh is preprocessed correctly. Case 1: The mesh needs preprocessing
Check whether a mesh is preprocessed correctly. Case 1: The mesh needs preprocessing
Check whether a mesh is preprocessed correctly . Case 1 : The mesh needs preprocessing
TEST_F(ScenePreprocessorTest, testMeshPreprocessingPos)
{
    aiMesh* p = new aiMesh();
    p->mNumFaces = 100;
    p->mFaces = new aiFace[p->mNumFaces];
    p->mTextureCoords[0] = new aiVector3D[10];
    p->mNumUVComponents[0] = 0;
    p->mNumUVComponents[1] = 0;
    CheckIfOnly(p,1,aiPrimitiveType_POINT);
    CheckIfOnly(p,2,aiPrimitiveType_LINE);
    CheckIfOnly(p,3,aiPrimitiveType_TRIANGLE);
    CheckIfOnly(p,4,aiPrimitiveType_POLYGON);
    CheckIfOnly(p,1249,aiPrimitiveType_POLYGON);
    unsigned i;
    for (i = 0; i < p->mNumFaces/2;++i) {
        p->mFaces[i].mNumIndices = 3;
    }
    for (; i < p->mNumFaces-p->mNumFaces/4;++i) {
        p->mFaces[i].mNumIndices = 4;
    }
    for (; i < p->mNumFaces;++i)    {
        p->mFaces[i].mNumIndices = 10;
    }
    ProcessMesh(p);
    EXPECT_EQ(static_cast<unsigned int>(aiPrimitiveType_TRIANGLE|aiPrimitiveType_POLYGON),
              p->mPrimitiveTypes);
    EXPECT_EQ(2U, p->mNumUVComponents[0]);
    EXPECT_EQ(0U, p->mNumUVComponents[1]);
    delete p;
}
TEST_F ( ScenePreprocessorTest , testMeshPreprocessingPos ) { aiMesh * p = new aiMesh ( ) ; p -> mNumFaces = 100 ; p -> mFaces = new aiFace [ p -> mNumFaces ] ; p -> mTextureCoords [ 0 ] = new aiVector3D [ 10 ] ; p -> mNumUVComponents [ 0 ] = 0 ; p -> mNumUVComponents [ 1 ] = 0 ; CheckIfOnly ( p , 1 , aiPrimitiveType_POINT ) ; CheckIfOnly ( p , 2 , aiPrimitiveType_LINE ) ; CheckIfOnly ( p , 3 , aiPrimitiveType_TRIANGLE ) ; CheckIfOnly ( p , 4 , aiPrimitiveType_POLYGON ) ; CheckIfOnly ( p , 1249 , aiPrimitiveType_POLYGON ) ; unsigned i ; for ( i = 0 ; i < p -> mNumFaces / 2 ; ++ i ) { p -> mFaces [ i ] . mNumIndices = 3 ; } for ( ; i < p -> mNumFaces - p -> mNumFaces / 4 ; ++ i ) { p -> mFaces [ i ] . mNumIndices = 4 ; } for ( ; i < p -> mNumFaces ; ++ i ) { p -> mFaces [ i ] . mNumIndices = 10 ; } ProcessMesh ( p ) ; EXPECT_EQ ( static_cast < unsigned int > ( aiPrimitiveType_TRIANGLE | aiPrimitiveType_POLYGON ) , p -> mPrimitiveTypes ) ; EXPECT_EQ ( 2U , p -> mNumUVComponents [ 0 ] ) ; EXPECT_EQ ( 0U , p -> mNumUVComponents [ 1 ] ) ; delete p ; }
Check whether a mesh is preprocessed correctly.
Check whether a mesh is preprocessed correctly .
// Polygons and triangles mixed