[fixed]buildFrameNr does not clamp values

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
hach-que
Posts: 33
Joined: Thu Apr 19, 2007 10:11 am
Location: Australia

[fixed]buildFrameNr does not clamp values

Post by hach-que »

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,

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);
		}
should be

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);
		}
Image
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yes, this should belong to a known problem in the frame number calculation which we will work on in the future.
CuteAlien
Admin
Posts: 9716
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

That's fixed already in 1.7.2, you are probably still using 1.7.1.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply