Horde3D
http://www.horde3d.org/forums/

[solved] Bug in setNodeTransformMatrix
http://www.horde3d.org/forums/viewtopic.php?f=3&t=317
Page 1 of 1

Author:  swiftcoder [ 28.04.2008, 22:43 ]
Post subject:  [solved] Bug in setNodeTransformMatrix

I found this little gem in an essential - but probably little-used to date - function. Take a look at the if condition:
Code:
   DLLEXP bool setNodeTransformMatrix( NodeHandle node, const float *mat4x4 )
   {
      SceneNode *sn = Modules::sceneMan().resolveNodeHandle( node );
      
      if( sn != 0x0 || mat4x4 == 0x0 )
      {
         static Matrix4f mat;
         memcpy( mat.c, mat4x4, 16 * sizeof( float ) );
         sn->setTransform( mat );
         return true;
      }
      else
      {
         Modules::log().writeDebugInfo( "Invalid node handle %i in setNodeTransformMatrix", node );
         return false;
      }
   }

I am pretty sure it should be like this instead:
Code:
      if( sn != 0x0 && mat4x4 != 0x0 )
      {
         static Matrix4f mat;
         memcpy( mat.c, mat4x4, 16 * sizeof( float ) );
         sn->setTransform( mat );
         return true;
      }
      else
      {
         //...
      }
   }

Author:  Volker [ 29.04.2008, 09:23 ]
Post subject:  Re: Bug in setNodeTransformMatrix

Thanks for pointing this out. Fixed it in the svn.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/