// --- find nodes which intersect various types of BV's ---
public override void FindNodes( AxisAlignedBox t,
ref List<PCZSceneNode> list,
List<Portal> visitedPortals,
bool includeVisitors,
bool recurseThruPortals,
PCZSceneNode exclude )
{
// if this zone has an enclosure, check against the enclosure AABB first
if ( null != mEnclosureNode )
{
if ( !mEnclosureNode.WorldAABB.Intersects( t ) )
{
// AABB of zone does not intersect t, just return.
return;
}
}
foreach ( PCZSceneNode pczsn in mHomeNodeList )
{
if ( pczsn != exclude )
{
// make sure node is not already in the list (might have been added in another
// zone it was visiting)
if ( !list.Contains( pczsn ) )
{
bool nsect = t.Intersects( pczsn.WorldAABB );
if ( nsect )
{
list.Add( pczsn );
}
}
}
}
if ( includeVisitors )
{
// check visitor nodes
foreach ( PCZSceneNode pczsn in mVisitorNodeList )
{
if ( pczsn != exclude )
{
// make sure node is not already in the list (might have been added in another
// zone it was visiting)
if ( !list.Contains( pczsn ) )
{
bool nsect = t.Intersects( pczsn.WorldAABB );
if ( nsect )
{
list.Add( pczsn );
}
}
}
}
}
// if asked to, recurse through portals
if ( recurseThruPortals )
{
foreach ( Portal portal in mPortals )
{
// check portal versus bounding box
if ( portal.intersects( t ) )
{
// make sure portal hasn't already been recursed through
if ( !visitedPortals.Contains( portal ) )
{
// save portal to the visitedPortals list
visitedPortals.Add( portal );
// recurse into the connected zone
portal.getTargetZone().FindNodes( t,
ref list,
visitedPortals,
includeVisitors,
recurseThruPortals,
exclude );
}
}
}
}
}