From ca91742a1ed197ea06e8dc720815ebaed90f65b2 Mon Sep 17 00:00:00 2001 From: hybrid Date: Wed, 19 Mar 2008 09:33:59 +0000 Subject: [PATCH] Fixed a possible transformation problem in debug render. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1289 dfc29bdd-3216-0410-991c-e03cc46cb475 --- source/Irrlicht/CAnimatedMeshSceneNode.cpp | 32 +++++++++------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/source/Irrlicht/CAnimatedMeshSceneNode.cpp b/source/Irrlicht/CAnimatedMeshSceneNode.cpp index 3c0c0551..fac4530c 100644 --- a/source/Irrlicht/CAnimatedMeshSceneNode.cpp +++ b/source/Irrlicht/CAnimatedMeshSceneNode.cpp @@ -290,8 +290,8 @@ void CAnimatedMeshSceneNode::render() { scene::IMeshBuffer* mb = m->getMeshBuffer(i); mat = Materials[i]; - mat.MaterialType = video::EMT_TRANSPARENT_ADD_COLOR; - if (RenderFromIdentity) + mat.MaterialType = video::EMT_TRANSPARENT_ADD_COLOR; + if (RenderFromIdentity) driver->setTransform(video::ETS_WORLD, core::matrix4() ); else if (Mesh->getMeshType() == EAMT_SKINNED) driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation); @@ -317,8 +317,8 @@ void CAnimatedMeshSceneNode::render() if (transparent == isTransparentPass) { scene::IMeshBuffer* mb = m->getMeshBuffer(i); - - if (RenderFromIdentity) + + if (RenderFromIdentity) driver->setTransform(video::ETS_WORLD, core::matrix4() ); else if (Mesh->getMeshType() == EAMT_SKINNED) driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation); @@ -394,7 +394,7 @@ void CAnimatedMeshSceneNode::render() for (u32 g=0; g< m->getMeshBufferCount(); ++g) { - const IMeshBuffer* mb = m->getMeshBuffer(g); + const IMeshBuffer* mb = m->getMeshBuffer(g); if (Mesh->getMeshType() == EAMT_SKINNED) driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation); @@ -404,6 +404,7 @@ void CAnimatedMeshSceneNode::render() driver->setTransform(video::ETS_WORLD, AbsoluteTransformation); } + driver->setTransform(video::ETS_WORLD, AbsoluteTransformation); if ( DebugDataVisible & scene::EDS_BBOX ) driver->draw3DBox(Box, video::SColor(0,255,255,255)); @@ -475,8 +476,8 @@ void CAnimatedMeshSceneNode::render() for (u32 g=0; ggetMeshBufferCount(); ++g) { - const IMeshBuffer* mb = m->getMeshBuffer(g); - if (RenderFromIdentity) + const IMeshBuffer* mb = m->getMeshBuffer(g); + if (RenderFromIdentity) driver->setTransform(video::ETS_WORLD, core::matrix4() ); else if (Mesh->getMeshType() == EAMT_SKINNED) driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation); @@ -586,10 +587,9 @@ IBoneSceneNode* CAnimatedMeshSceneNode::getJointNode(const c8* jointName) checkJoints(); - ISkinnedMesh *skinnedMesh=(ISkinnedMesh*)Mesh; - s32 number = skinnedMesh->getJointNumber(jointName); + const s32 number = skinnedMesh->getJointNumber(jointName); if (number == -1) { @@ -825,6 +825,7 @@ void CAnimatedMeshSceneNode::setMesh(IAnimatedMesh* mesh) Mesh->grab(); } + // returns the absolute transformation for a special MD3 Tag if the mesh is a md3 mesh, // or the absolutetransformation if it's a normal scenenode const SMD3QuaterionTag& CAnimatedMeshSceneNode::getMD3TagTransformation( const core::stringc & tagname) @@ -973,26 +974,18 @@ void CAnimatedMeshSceneNode::animateJoints(bool CalculateAbsolutePositions) { //---slow--- for (u32 n=0;ngetParent()==this) { JointChildSceneNodes[n]->updateAbsolutePositionOfAllChildren(); //temp, should be an option } + } } - - - } } - - - - - } - - void CAnimatedMeshSceneNode::checkJoints() { if (!Mesh || Mesh->getMeshType() != EAMT_SKINNED) @@ -1010,6 +1003,7 @@ void CAnimatedMeshSceneNode::checkJoints() } } + void CAnimatedMeshSceneNode::beginTransition() { if (!JointsUsed)