Fixed AnimEvaluator.cpp

pull/850/head
mensinda 2016-04-06 17:28:09 +02:00
parent 3eafc7e746
commit dd1ab0778c
1 changed files with 6 additions and 6 deletions

View File

@ -81,7 +81,7 @@ void AnimEvaluator::Evaluate( double pTime)
{ {
// Look for present frame number. Search from last position if time is after the last time, else from beginning // Look for present frame number. Search from last position if time is after the last time, else from beginning
// Should be much quicker than always looking from start for the average use case. // Should be much quicker than always looking from start for the average use case.
unsigned int frame = (time >= mLastTime) ? mLastPositions[a].get<0>() : 0; unsigned int frame = (time >= mLastTime) ? std::get<0>(mLastPositions[a]) : 0;
while( frame < channel->mNumPositionKeys - 1) while( frame < channel->mNumPositionKeys - 1)
{ {
if( time < channel->mPositionKeys[frame+1].mTime) if( time < channel->mPositionKeys[frame+1].mTime)
@ -105,14 +105,14 @@ void AnimEvaluator::Evaluate( double pTime)
presentPosition = key.mValue; presentPosition = key.mValue;
} }
mLastPositions[a].get<0>() = frame; std::get<0>(mLastPositions[a]) = frame;
} }
// ******** Rotation ********* // ******** Rotation *********
aiQuaternion presentRotation( 1, 0, 0, 0); aiQuaternion presentRotation( 1, 0, 0, 0);
if( channel->mNumRotationKeys > 0) if( channel->mNumRotationKeys > 0)
{ {
unsigned int frame = (time >= mLastTime) ? mLastPositions[a].get<1>() : 0; unsigned int frame = (time >= mLastTime) ? std::get<1>(mLastPositions[a]) : 0;
while( frame < channel->mNumRotationKeys - 1) while( frame < channel->mNumRotationKeys - 1)
{ {
if( time < channel->mRotationKeys[frame+1].mTime) if( time < channel->mRotationKeys[frame+1].mTime)
@ -136,14 +136,14 @@ void AnimEvaluator::Evaluate( double pTime)
presentRotation = key.mValue; presentRotation = key.mValue;
} }
mLastPositions[a].get<1>() = frame; std::get<1>(mLastPositions[a]) = frame;
} }
// ******** Scaling ********** // ******** Scaling **********
aiVector3D presentScaling( 1, 1, 1); aiVector3D presentScaling( 1, 1, 1);
if( channel->mNumScalingKeys > 0) if( channel->mNumScalingKeys > 0)
{ {
unsigned int frame = (time >= mLastTime) ? mLastPositions[a].get<2>() : 0; unsigned int frame = (time >= mLastTime) ? std::get<2>(mLastPositions[a]) : 0;
while( frame < channel->mNumScalingKeys - 1) while( frame < channel->mNumScalingKeys - 1)
{ {
if( time < channel->mScalingKeys[frame+1].mTime) if( time < channel->mScalingKeys[frame+1].mTime)
@ -153,7 +153,7 @@ void AnimEvaluator::Evaluate( double pTime)
// TODO: (thom) interpolation maybe? This time maybe even logarithmic, not linear // TODO: (thom) interpolation maybe? This time maybe even logarithmic, not linear
presentScaling = channel->mScalingKeys[frame].mValue; presentScaling = channel->mScalingKeys[frame].mValue;
mLastPositions[a].get<2>() = frame; std::get<2>(mLastPositions[a]) = frame;
} }
// build a transformation matrix from it // build a transformation matrix from it