[fixed]buildFrameNr does not clamp values
Posted: Thu Dec 02, 2010 5:09 am
It's possible for the engine to crash if the timeMs value is relatively large, causing the CurrentFrameNr to still be larger than the end frame. In the current code it'll only reduce it by a maximum amount of (EndFrame-StartFrame), whereas it should really reduce it until it's within the allows values.
On line 114 of CAnimatedMeshSceneNode.cpp,
should be
On line 114 of CAnimatedMeshSceneNode.cpp,
Code: Select all
else if (Looping)
{
// play animation looped
CurrentFrameNr += timeMs * FramesPerSecond;
if (FramesPerSecond > 0.f) //forwards...
{
if (CurrentFrameNr > EndFrame)
CurrentFrameNr -= (EndFrame-StartFrame);
}
else //backwards...
{
if (CurrentFrameNr < StartFrame)
CurrentFrameNr += (EndFrame-StartFrame);
}
Code: Select all
else if (Looping)
{
// play animation looped
CurrentFrameNr += timeMs * FramesPerSecond;
if (FramesPerSecond > 0.f) //forwards...
{
while (CurrentFrameNr > EndFrame)
CurrentFrameNr -= (EndFrame-StartFrame);
}
else //backwards...
{
while (CurrentFrameNr < StartFrame)
CurrentFrameNr += (EndFrame-StartFrame);
}