Next-Generation Graphics Engine
It is currently 21.03.2018, 06:08

All times are UTC + 1 hour

Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: 31.01.2010, 22:23 

Joined: 19.11.2007, 19:35
Posts: 218
May be useful to others, GroupNodes don't update their bounds (which is sensible) so I made a quick change to have them determine their bounds when it's asked for through the API.

In egMain.cpp
DLLEXP void h3dGetNodeAABB( NodeHandle node, float *minX, float *minY, float *minZ,
                            float *maxX, float *maxY, float *maxZ )
   SceneNode *sn = Modules::sceneMan().resolveNodeHandle( node );
   VALIDATE_NODE( sn, "h3dGetNodeAABB", EMPTY );

    if (sn->getType() == SceneNodeTypes::Group)
    if( minX != 0x0 ) *minX = sn->getBBox().min.x;
    if( minY != 0x0 ) *minY = sn->getBBox().min.y;
    if( minZ != 0x0 ) *minZ = sn->getBBox().min.z;
    if( maxX != 0x0 ) *maxX = sn->getBBox().max.x;
    if( maxY != 0x0 ) *maxY = sn->getBBox().max.y;
    if( maxZ != 0x0 ) *maxZ = sn->getBBox().max.z;
    if (sn->getType() == SceneNodeTypes::Group) //a little gross, but it's grosser if we don't clear it

In egScene.h - GroupNode class declaration
void calculateBBox();

In egScene.cpp
void GroupNode::calculateBBox()
    for (std::vector<SceneNode*>::iterator it = _children.begin(); it != _children.end(); ++it) {
        if (*it) {
            if ((*it)->getType() == SceneNodeTypes::Group)
            if ((*it)->getType() == SceneNodeTypes::Group) //gross

Reply with quote  
PostPosted: 02.02.2010, 23:17 
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
Thanks. We used to have an AABB tree for culling but updating it has a considerable performance overhead (a lot of cache misses), that's why it was removed. Some different spatial structure will be used instead in the future.

Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group