/// <summary>
/// Internal method which locates any visible objects attached to this node and adds them to the passed in queue.
/// </summary>
/// <param name="camera">Active camera.</param>
/// <param name="queue">Queue to which these objects should be added.</param>
/// <param name="includeChildren">If true, cascades down to all children.</param>
/// <param name="displayNodes">Renders the local axes for the node.</param>
/// <param name="onlyShadowCasters"></param>
public virtual void FindVisibleObjects(Camera camera, RenderQueue queue, bool includeChildren, bool displayNodes,
bool onlyShadowCasters)
{
// if we aren't visible, then quit now
// TODO: Make sure sphere is calculated properly for all objects, then switch to cull using that
if (!camera.IsObjectVisible(this.worldAABB))
{
return;
}
// add visible objects to the render queue
//objectListMeter.Enter();
foreach (var obj in this.objectList.Values)
{
// tell attached object about current camera in case it wants to know
//notifyCameraMeter.Enter();
obj.NotifyCurrentCamera(camera);
//notifyCameraMeter.Exit();
// if this object is visible, add it to the render queue
if (obj.IsVisible && (!onlyShadowCasters || obj.CastShadows))
{
//updateQueueMeter.Enter();
obj.UpdateRenderQueue(queue);
//updateQueueMeter.Exit();
}
}
//objectListMeter.Exit();
//childListMeter.Enter();
if (includeChildren)
{
// ask all child nodes to update the render queue with visible objects
foreach (SceneNode childNode in childNodes.Values)
{
if (childNode.IsVisible)
{
childNode.FindVisibleObjects(camera, queue, includeChildren, displayNodes, onlyShadowCasters);
}
}
}
//childListMeter.Exit();
// if we wanna display nodes themself..
if (displayNodes)
{
// hey, lets just add ourself right to the render queue
queue.AddRenderable(GetDebugRenderable());
}
// do we wanna show our beautiful bounding box?
// do it if either we want it, or the SceneManager dictates it
if (this.showBoundingBox || (this.creator != null && this.creator.ShowBoundingBoxes))
{
AddBoundingBoxToQueue(queue);
}
}