//! when a child is added to this node, concider accumulating its bounding box void CZoneSceneNode::addChild (ISceneNode *child) { // if we are accumulating the bounding boxes of children if ( accumulateBoundingBoxes ) { // get the childs bounding box core::aabbox3d<f32> childBox( child->getBoundingBox()); childBox.MinEdge += child->getPosition(); childBox.MaxEdge += child->getPosition(); // add the childs bounding box into our own if ( firstChild ) { firstChild = false; boundingBox.reset( childBox ); } else { boundingBox.addInternalBox( childBox ); } } // add the child to this node ISceneNode::addChild(child); }
DiAABB DiOctreeNode::GetChildAABB(int ID) { int x = (ID / 4); int y = (ID - x * 4) / 2; int z = (ID - x * 4 - y * 2); DiVec3 vSize = mNodeBox.GetSize() * 0.5f; DiVec3 vOffset = vSize; vOffset.x *= x; vOffset.y *= y; vOffset.z *= z; DiVec3 min = mNodeBox.mMinimum + vOffset; DiAABB childBox(min, min + vSize); return childBox; }