/** Checks the given OctreeNode, and determines if it needs to be moved * to a different octant. */ public void UpdateOctreeNode(OctreeNode node) { AxisAlignedBox box = node.WorldAABB; if(box.IsNull) { return; } if(node.Octant == null) { //if outside the octree, force into the root node. if(!node.IsInBox(octree.Box)) { octree.AddNode(node); } else { AddOctreeNode(node, octree); return; } } if(!node.IsInBox(node.Octant.Box)) { RemoveOctreeNode(node); //if outside the octree, force into the root node. if(!node.IsInBox(octree.Box)) { octree.AddNode(node); } else { AddOctreeNode(node,octree); } } }
/** Checks the given OctreeNode, and determines if it needs to be moved * to a different octant. */ public void UpdateOctreeNode( OctreeNode node ) { AxisAlignedBox box = node.WorldAABB; if ( box.IsNull ) { return; } if ( node.Octant == null ) { //if outside the octree, force into the root node. if ( !node.IsInBox( octree.Box ) ) { octree.AddNode( node ); } else { AddOctreeNode( node, octree ); } return; } if ( !node.IsInBox( node.Octant.Box ) ) { RemoveOctreeNode( node ); //if outside the octree, force into the root node. if ( !node.IsInBox( octree.Box ) ) { octree.AddNode( node ); } else { AddOctreeNode( node, octree ); } } }