MCPcopy Create free account
hub / github.com/OGRECave/ogre-next / getInterpolatedKeyFrame

Method getInterpolatedKeyFrame

OgreMain/src/OgreAnimationTrack.cpp:283–314  ·  view source on GitHub ↗

---------------------------------------------------------------------

Source from the content-addressed store, hash-verified

281 }
282 //---------------------------------------------------------------------
283 void NumericAnimationTrack::getInterpolatedKeyFrame( const TimeIndex &timeIndex,
284 KeyFrame *kf ) const
285 {
286 if( mListener )
287 {
288 if( mListener->getInterpolatedKeyFrame( this, timeIndex, kf ) )
289 return;
290 }
291
292 NumericKeyFrame *kret = static_cast<NumericKeyFrame *>( kf );
293
294 // Keyframe pointers
295 KeyFrame *kBase1, *kBase2;
296 NumericKeyFrame *k1, *k2;
297 unsigned short firstKeyIndex;
298
299 Real t = this->getKeyFramesAtTime( timeIndex, &kBase1, &kBase2, &firstKeyIndex );
300 k1 = static_cast<NumericKeyFrame *>( kBase1 );
301 k2 = static_cast<NumericKeyFrame *>( kBase2 );
302
303 if( t == 0.0 )
304 {
305 // Just use k1
306 kret->setValue( k1->getValue() );
307 }
308 else
309 {
310 // Interpolate by t
311 AnyNumeric diff = k2->getValue() - k1->getValue();
312 kret->setValue( k1->getValue() + diff * t );
313 }
314 }
315 //---------------------------------------------------------------------
316 void NumericAnimationTrack::apply( const TimeIndex &timeIndex, Real weight, Real scale )
317 {

Callers 1

_applyBaseKeyFrameMethod · 0.80

Calls 13

getKeyFramesAtTimeMethod · 0.80
setTranslateMethod · 0.80
getInterpolationModeMethod · 0.80
addPoseReferenceMethod · 0.80
setValueMethod · 0.45
getValueMethod · 0.45
setRotationMethod · 0.45
setScaleMethod · 0.45
getScaleMethod · 0.45
interpolateMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected