Merge() public méthode

public Merge ( AxisAlignedBox boxBounds, Sphere sphereBounds, Camera cam ) : void
boxBounds Axiom.Math.AxisAlignedBox
sphereBounds Axiom.Math.Sphere
cam Camera
Résultat void
        /// <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, VisibleObjectsBoundsInfo visibleBounds, 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(worldAABB))
            {
                return;
            }

            // add visible objects to the render queue
            //objectListMeter.Enter();
            foreach (MovableObject obj in 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();

                    // update visible boundaries aab
                    if (visibleBounds != null)
                    {
                        visibleBounds.Merge(obj.GetWorldBoundingBox(true),
                                            obj.GetWorldBoundingSphere(true),
                                            camera);
                    }
                }
            }
            //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.Visible)
                    {
                        childNode.FindVisibleObjects(camera, queue, visibleBounds, 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(this);
            }

            // do we wanna show our beautiful bounding box?
            // do it if either we want it, or the SceneManager dictates it
            if (showBoundingBox || creator.ShowBoundingBoxes)
            {
                AddBoundingBoxToQueue(queue);
            }
        }
Exemple #2
0
		/** Adds the attached objects of this PCZSceneNode into the queue. */
		public void AddToRenderQueue( Camera cam, RenderQueue queue, bool onlyShadowCasters, VisibleObjectsBoundsInfo visibleBounds )
		{
			foreach ( KeyValuePair<string, MovableObject> pair in objectsByName )
			{
				pair.Value.NotifyCurrentCamera( cam );

				if ( pair.Value.IsVisible && ( !onlyShadowCasters || pair.Value.CastShadows ) )
				{
					pair.Value.UpdateRenderQueue( queue );

					if ( !visibleBounds.aabb.IsNull )
					{
						visibleBounds.Merge( pair.Value.GetWorldBoundingBox( true ), pair.Value.GetWorldBoundingSphere( true ), cam );
					}
				}
			}
		}
        /// <summary>
        ///     Adds all the attached scenenodes to the render queue.
        /// </summary>
        /// <param name="cam"></param>
        /// <param name="queue"></param>
		public void AddToRenderQueue(Camera cam, RenderQueue queue, bool onlyShadowCasters,
                                     VisibleObjectsBoundsInfo visibleBounds) {
			
            // int i;
            foreach (MovableObject obj in objectList.Values) {
                obj.NotifyCurrentCamera(cam);
			
                if(obj.IsVisible && (!onlyShadowCasters || obj.CastShadows)) {
                    obj.UpdateRenderQueue(queue);
                    if (visibleBounds != null)
                        visibleBounds.Merge(obj.GetWorldBoundingBox(true),
                                            obj.GetWorldBoundingSphere(true),
                                            cam);
                }
            }
        }
        /// <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, VisibleObjectsBoundsInfo visibleBounds, 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(worldAABB))
                return;

            // add visible objects to the render queue
            //objectListMeter.Enter();
            foreach (MovableObject obj in 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();

                    // update visible boundaries aab
                    if (visibleBounds != null)
                        visibleBounds.Merge(obj.GetWorldBoundingBox(true),
                                            obj.GetWorldBoundingSphere(true),
                                            camera);
                }
            }
            //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.Visible)
                        childNode.FindVisibleObjects(camera, queue, visibleBounds, 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(this);
            }

            // do we wanna show our beautiful bounding box?
            // do it if either we want it, or the SceneManager dictates it
            if(showBoundingBox || creator.ShowBoundingBoxes) {
                AddBoundingBoxToQueue(queue);
            }
        }