protected BspNode WalkTree( Camera camera, bool onlyShadowCasters )
{
if ( level == null )
{
return null;
}
// Locate the leaf node where the camera is located
BspNode cameraNode = level.FindLeaf( camera.DerivedPosition );
matFaceGroupMap.Clear();
faceGroupChecked.Clear();
// Scan through all the other leaf nodes looking for visibles
int i = level.NumNodes - level.LeafStart;
int p = level.LeafStart;
BspNode node;
while ( i-- > 0 )
{
node = level.Nodes[ p ];
if ( level.IsLeafVisible( cameraNode, node ) )
{
// Visible according to PVS, check bounding box against frustum
//if ( camera.IsObjectVisible( node.BoundingBox ) )
{
ProcessVisibleLeaf( node, camera, onlyShadowCasters );
if ( showNodeAABs )
AddBoundingBox( node.BoundingBox, true );
}
}
p++;
}
return cameraNode;
}