Page 1 of 1

Porting 1.9 to 2.0: AAbb

Posted: Wed Nov 26, 2014 8:21 pm
by ghiboz
hi all!
i'm trying to porting my code from ogre 1.9 to ogre 2.0 and my first attempt is blocked by the old _getWorldAABB() function from the scenenode.
in 2.0 how I check the aabb of the node?
thanks again

Re: Porting 1.9 to 2.0: AAbb

Posted: Wed Nov 26, 2014 9:37 pm
by al2950
Ogre 2.0 works fairly differently to Ogre 1.x in the way it deals with the scene graph and sorts/finds renderble objects, as a result SceneNodes are more light weight than they used to be. SceneNodes now are only really only used for transform and hierarchical data, and MovableObject contain the 'visible info' data, and so MovableObject has the calls getWorldAabb or getWorldAabbUpdate. Of course this means if you have a scene node with multiple MovableObjects attached you will have to do some maths to combine the Aabb of all the attached objects.

There are some very good reasons why this has been done but if you are still unhappy let me know!!

Re: Porting 1.9 to 2.0: AAbb

Posted: Wed Nov 26, 2014 11:32 pm
by dark_sylinc
Nodes no longer have the AABB information as al2950 said.

This information is now contained in MovableObject (Entity, Billboards, Particles, etc).

You can iterate through the SceneNode's attached objects and grow an aabb with MovableObject::getWorldAabb (returns a cached version, will assert if called at the wrong time*; i.e. the cache is out of date) or MovableObject::getWorldAabbUpdated (will never assert, but is slower as it always recalculates the cache)

*wrong time means being done after the parent scene node has been modified and before SceneManager::updateAllBounds happens (which happens inside SceneManager::updateSceneGraph; in turn called by Root::renderOneFrame)

This shouldn't be an issue since most use cases have 1:1 relationship between Nodes and MovableObject (i.e. most of the times people would have 1 SceneNode for each MovableObject).

Re: Porting 1.9 to 2.0: AAbb

Posted: Thu Nov 27, 2014 8:32 am
by ghiboz
thanks to all!

Code: Select all

		Ogre::Aabb nodeAAbb;
		for (int i = 0; i < TheNode->numAttachedObjects(); ++i)
		Ogre::Vector3 min = nodeAAbb.getMinimum();
		Ogre::Vector3 max = nodeAAbb.getMaximum();
I continue to update my code :)