test/unit/utScenePreprocessor.cpp
// ------------------------------------------------------------------------------------------------
// Check whether an anim is preprocessed correctly. Case 1: The anim needs preprocessing
Check whether an anim is preprocessed correctly. Case 1: The anim needs preprocessing
Check whether an anim is preprocessed correctly . Case 1 : The anim needs preprocessing
TEST_F(ScenePreprocessorTest, testAnimationPreprocessingPos)
{
    aiAnimation* p = MakeDummyAnimation();
    aiNodeAnim* anim = p->mChannels[0];
    anim->mNumScalingKeys = 10;
    anim->mScalingKeys = new aiVectorKey[10];
    for (unsigned int i = 0; i < 10;++i)    {
        anim->mScalingKeys[i].mTime = i;
        anim->mScalingKeys[i].mValue = aiVector3D((float)i);
    }
    ProcessAnimation(p);
    EXPECT_NEAR(p->mDuration, 9., 0.005);
    EXPECT_TRUE(anim->mNumPositionKeys == 1 &&
        anim->mPositionKeys &&
        anim->mPositionKeys[0].mTime == 0.0 &&
        anim->mPositionKeys[0].mValue == aiVector3D(1.f,2.f,3.f));
    EXPECT_TRUE(anim->mNumRotationKeys == 1 && anim->mRotationKeys &&
        anim->mRotationKeys[0].mTime == 0.0);
    delete p;
}
TEST_F ( ScenePreprocessorTest , testAnimationPreprocessingPos ) { aiAnimation * p = MakeDummyAnimation ( ) ; aiNodeAnim * anim = p -> mChannels [ 0 ] ; anim -> mNumScalingKeys = 10 ; anim -> mScalingKeys = new aiVectorKey [ 10 ] ; for ( unsigned int i = 0 ; i < 10 ; ++ i ) { anim -> mScalingKeys [ i ] . mTime = i ; anim -> mScalingKeys [ i ] . mValue = aiVector3D ( ( float ) i ) ; } ProcessAnimation ( p ) ; EXPECT_NEAR ( p -> mDuration , 9. , 0.005 ) ; EXPECT_TRUE ( anim -> mNumPositionKeys == 1 && anim -> mPositionKeys && anim -> mPositionKeys [ 0 ] . mTime == 0.0 && anim -> mPositionKeys [ 0 ] . mValue == aiVector3D ( 1.f , 2.f , 3.f ) ) ; EXPECT_TRUE ( anim -> mNumRotationKeys == 1 && anim -> mRotationKeys && anim -> mRotationKeys [ 0 ] . mTime == 0.0 ) ; delete p ; }
Check whether an anim is preprocessed correctly.
Check whether an anim is preprocessed correctly .
// we don't set the animation duration, but generate scaling channels // we should now have a proper duration // ... one scaling key // ... and one rotation key