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

Method _getTimeIndex

OgreMain/src/OgreAnimation.cpp:677–700  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

675 }
676 //-----------------------------------------------------------------------
677 TimeIndex Animation::_getTimeIndex( Real timePos ) const
678 {
679 // Uncomment following statement for work as previous
680 // return timePos;
681
682 // Build keyframe time list on demand
683 if( mKeyFrameTimesDirty )
684 {
685 buildKeyFrameTimeList();
686 }
687
688 // Wrap time
689 Real totalAnimationLength = mLength;
690
691 if( timePos > totalAnimationLength && totalAnimationLength > 0.0f )
692 timePos = std::fmod( timePos, totalAnimationLength );
693
694 // Search for global index
695 KeyFrameTimeList::iterator it =
696 std::lower_bound( mKeyFrameTimes.begin(), mKeyFrameTimes.end(), timePos );
697
698 return TimeIndex( timePos,
699 static_cast<uint>( std::distance( mKeyFrameTimes.begin(), it ) ) );
700 }
701 //-----------------------------------------------------------------------
702 void Animation::buildKeyFrameTimeList() const
703 {

Callers 2

_applyBaseKeyFrameMethod · 0.80
buildMethod · 0.80

Calls 4

TimeIndexFunction · 0.50
distanceFunction · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected