Some fixes for negative FramesPerSecond.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2328 dfc29bdd-3216-0410-991c-e03cc46cb475
master
hybrid 2009-04-11 20:51:31 +00:00
parent 5ba4e7ffac
commit 5c7c557dd5
1 changed files with 9 additions and 2 deletions

View File

@ -78,7 +78,11 @@ void CAnimatedMeshSceneNode::setCurrentFrame(f32 frame)
// if you pass an out of range value, we just clamp it // if you pass an out of range value, we just clamp it
CurrentFrameNr = core::clamp ( frame, (f32)StartFrame, (f32)EndFrame ); CurrentFrameNr = core::clamp ( frame, (f32)StartFrame, (f32)EndFrame );
BeginFrameTime = os::Timer::getTime() - (s32)((CurrentFrameNr - StartFrame) / FramesPerSecond); BeginFrameTime = os::Timer::getTime();
if (FramesPerSecond > 0)
BeginFrameTime += (s32)((CurrentFrameNr - StartFrame) / FramesPerSecond);
else if (FramesPerSecond < 0)
BeginFrameTime += (s32)((CurrentFrameNr - EndFrame) / -FramesPerSecond);
beginTransition(); //transit to this frame if enabled beginTransition(); //transit to this frame if enabled
} }
@ -535,6 +539,9 @@ bool CAnimatedMeshSceneNode::setFrameLoop(s32 begin, s32 end)
StartFrame = core::s32_clamp(begin, 0, maxFrameCount); StartFrame = core::s32_clamp(begin, 0, maxFrameCount);
EndFrame = core::s32_clamp(end, StartFrame, maxFrameCount); EndFrame = core::s32_clamp(end, StartFrame, maxFrameCount);
} }
if (FramesPerSecond < 0)
setCurrentFrame ( (f32)EndFrame );
else
setCurrentFrame ( (f32)StartFrame ); setCurrentFrame ( (f32)StartFrame );
return true; return true;