All in ISceneNode.h
change the ctor -
Code: Select all
//! Constructor
ISceneNode( ISceneNode* parent, ISceneManager* mgr, s32 id=-1,
const core::vector3df& position = core::vector3df(0,0,0),
const core::vector3df& rotation = core::vector3df(0,0,0),
const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f))
: IsVisible(true), ID(id), Parent(parent), SceneManager(mgr),
AutomaticCullingEnabled(true), DebugDataVisible(false),
TriangleSelector(0), RelativeTranslation(position),
RelativeRotation(rotation), RelativeScale(scale)
{
if (Parent)
Parent->addChild(this);
calcRelativeTransformation();
updateAbsolutePosition();
}
Code: Select all
virtual core::matrix4 getRelativeTransformation() const
{
return RelativeTransformation;
}
Code: Select all
virtual void calcRelativeTransformation()
{
RelativeTransformation.setRotationDegrees( RelativeRotation );
RelativeTransformation.setTranslation( RelativeTranslation );
if( RelativeScale != core::vector3df( 1.0f, 1.0f, 1.0f ) )
{
core::matrix4 smat;
smat.setScale( RelativeScale );
RelativeTransformation *= smat;
}
}
Code: Select all
virtual void setScale(const core::vector3df& scale)
{
RelativeScale = scale;
calcRelativeTransformation();
}
Code: Select all
virtual void setRotation(const core::vector3df& rotation)
{
RelativeRotation = rotation;
calcRelativeTransformation();
}
Code: Select all
virtual void setPosition(const core::vector3df& newpos)
{
RelativeTranslation = newpos;
calcRelativeTransformation();
}
Code: Select all
virtual void updateAbsolutePosition()
{
if (Parent)
AbsoluteTransformation =
Parent->getAbsoluteTransformation() * getRelativeTransformation();
else
AbsoluteTransformation = RelativeTransformation;
}
Code: Select all
//! relative transformation of the node.
core::matrix4 RelativeTransformation;