[Fixed]Bilboards culling bug + all node's speed improvement

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

Just saw this ISceneNode enhancement, I'm going to implement it in Irrlicht-Spintz-0.12, but with some changes -

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();			
}
change this function -

Code: Select all

virtual core::matrix4 getRelativeTransformation() const
{
	return RelativeTransformation;
}
Add this function

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;
	}
}
change setScale -

Code: Select all

virtual void setScale(const core::vector3df& scale)
{
	RelativeScale = scale;
	calcRelativeTransformation();
}
change setRotation -

Code: Select all

virtual void setRotation(const core::vector3df& rotation)
{
	RelativeRotation = rotation;
	calcRelativeTransformation();
}
change setPosition -

Code: Select all

virtual void setPosition(const core::vector3df& newpos)
{
	RelativeTranslation = newpos;
	calcRelativeTransformation();		
}
change updateAbsolutePosition -

Code: Select all

virtual void updateAbsolutePosition()
{
	if (Parent)
		AbsoluteTransformation = 
			Parent->getAbsoluteTransformation() * getRelativeTransformation();
	else
		AbsoluteTransformation = RelativeTransformation;
}
Add protected class memeber -

Code: Select all

//! relative transformation of the node.
core::matrix4 RelativeTransformation;
Works with no problems!
Image
Guest

Post by Guest »

I'm really looking forward for this improvments. I really need that "setcolor" - function for my jirr project.
Post Reply