diff -Nauwr Irrlicht/include/ISceneNode.h Irrlicht/include/ISceneNode.h --- Irrlicht/include/ISceneNode.h 2005-08-24 17:26:56.000000000 +0200 +++ Irrlicht/include/ISceneNode.h 2005-09-23 11:22:24.000000000 +0200 @@ -45,6 +45,7 @@ if (Parent) Parent->addChild(this); + calcRelativeTransformation(); updateAbsolutePosition(); } @@ -161,18 +162,20 @@ //! \return Returns the relative transformation matrix. virtual core::matrix4 getRelativeTransformation() const { - core::matrix4 mat; - mat.setRotationDegrees(RelativeRotation); - mat.setTranslation(RelativeTranslation); + return RelativeTransformation; + } + + virtual void calcRelativeTransformation() + { + RelativeTransformation.setRotationDegrees( RelativeRotation ); + RelativeTransformation.setTranslation( RelativeTranslation ); - if (RelativeScale != core::vector3df(1,1,1)) + if( RelativeScale != core::vector3df( 1.0f, 1.0f, 1.0f ) ) { core::matrix4 smat; smat.setScale(RelativeScale); - mat *= smat; + RelativeTransformation *= smat; } - - return mat; } @@ -368,6 +371,7 @@ virtual void setScale(const core::vector3df& scale) { RelativeScale = scale; + calcRelativeTransformation(); } //! Rotate the node around an arbitrary axis @@ -388,6 +392,7 @@ virtual void setRotation(const core::vector3df& rotation) { RelativeRotation = rotation; + calcRelativeTransformation(); } @@ -406,6 +411,7 @@ virtual void setPosition(const core::vector3df& newpos) { RelativeTranslation = newpos; + calcRelativeTransformation(); } @@ -513,9 +519,9 @@ { if (Parent) AbsoluteTransformation = - Parent->getAbsoluteTransformation() * getRelativeTransformation(); + Parent->getAbsoluteTransformation() * RelativeTransformation; else - AbsoluteTransformation = getRelativeTransformation(); + AbsoluteTransformation = RelativeTransformation; } //! Returns the parent of this scene node @@ -541,6 +547,9 @@ //! relative scale of the scene node. core::vector3df RelativeScale; + //! relative transformation of the node. + core::matrix4 RelativeTransformation; + //! Pointer to the parent ISceneNode* Parent;