Commit 5c7c557d authored by hybrid's avatar hybrid

Some fixes for negative FramesPerSecond.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2328 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 5ba4e7ff
......@@ -78,7 +78,11 @@ void CAnimatedMeshSceneNode::setCurrentFrame(f32 frame)
// if you pass an out of range value, we just clamp it
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
}
......@@ -535,6 +539,9 @@ bool CAnimatedMeshSceneNode::setFrameLoop(s32 begin, s32 end)
StartFrame = core::s32_clamp(begin, 0, maxFrameCount);
EndFrame = core::s32_clamp(end, StartFrame, maxFrameCount);
}
if (FramesPerSecond < 0)
setCurrentFrame ( (f32)EndFrame );
else
setCurrentFrame ( (f32)StartFrame );
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment