Use another solution to ensure first animation frame is at start. Solution yesterday had the trouble that it was no longer possible to use setCurrentFrame before otherwise. Tests b3dAnimation and md2Animation working again.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4217 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2012-06-27 13:54:33 +00:00
parent 26b2b68a13
commit d4ee640740
2 changed files with 12 additions and 14 deletions

View File

@ -239,23 +239,21 @@ IMesh * CAnimatedMeshSceneNode::getMeshForCurrentFrame()
//! OnAnimate() is called just before rendering the whole scene.
void CAnimatedMeshSceneNode::OnAnimate(u32 timeMs)
{
// set CurrentFrameNr and update bbox
if (LastTimeMs==0)
if (LastTimeMs==0) // first frame
{
CurrentFrameNr = (f32)StartFrame;
// bbox is the default one, so no change
LastTimeMs = timeMs;
}
else
// set CurrentFrameNr
buildFrameNr(timeMs-LastTimeMs);
// update bbox
if (Mesh)
{
buildFrameNr(timeMs-LastTimeMs);
scene::IMesh * mesh = getMeshForCurrentFrame();
if (Mesh)
{
scene::IMesh * mesh = getMeshForCurrentFrame();
if (mesh)
Box = mesh->getBoundingBox();
}
if (mesh)
Box = mesh->getBoundingBox();
}
LastTimeMs = timeMs;

View File

@ -1,4 +1,4 @@
Tests finished. 1 test of 1 passed.
Compiled as DEBUG
Test suite pass at GMT Wed Jun 27 10:38:16 2012
Test suite pass at GMT Wed Jun 27 13:50:47 2012