---------------------------------------------------------------------
| 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 | { |
no test coverage detected