Ejemplo n.º 1
0
void SceneGraph::recomputeBoundingBox()
{
    Node	*node;
    float	center[3];
    float	size[3];
    float	m4[4][4];
    SFMatrix mx;

    BoundingBox bbox;

    for (node=getNodes(); node; node=node->nextTraversal()) {
        if (node->isBoundedGroupingNode()) {
            BoundedGroupingNode *gnode = (BoundedGroupingNode *)node;
            gnode->getBoundingBoxCenter(center);
            gnode->getBoundingBoxSize(size);
            // Thanks for Peter DeSantis (07/22/04)
            gnode->getTransformMatrix(m4);
            mx.setValue(m4);
            bbox.addBoundingBox(&mx, center, size);
        }
        else if (node->isGeometry3DNode()) {
            Geometry3DNode *gnode = (Geometry3DNode *)node;
            gnode->getBoundingBoxCenter(center);
            gnode->getBoundingBoxSize(size);
            // Thanks for Peter DeSantis (07/22/04)
            gnode->getTransformMatrix(m4);
            mx.setValue(m4);
            bbox.addBoundingBox(&mx, center, size);
        }
    }

    setBoundingBox(&bbox);
}
Ejemplo n.º 2
0
void SceneGraph::recomputeBoundingBox() 
{
	Node	*node;
	float	center[3];
	float	size[3];

	BoundingBox bbox;

	for (node=getNodes(); node; node=node->nextTraversal()) {
		if (node->isGroupingNode()) {
			GroupingNode *gnode = (GroupingNode *)node;
			gnode->getBoundingBoxCenter(center);
			gnode->getBoundingBoxSize(size);
			bbox.addBoundingBox(center, size);
		}
		else if (node->isGeometryNode()) { 
			GeometryNode *gnode = (GeometryNode *)node; 
			gnode->getBoundingBoxCenter(center); 
			gnode->getBoundingBoxSize(size); 
			bbox.addBoundingBox(center, size); 
		} 
	}

	setBoundingBox(&bbox);
}