AddRenderable() public method

Overloaded method.
public AddRenderable ( IRenderable item ) : void
item IRenderable
return void
		public override void UpdateRenderQueue( RenderQueue queue )
		{
			// Notify need to calculate light list when our sending to render queue
			this.mLightListDirty = true;

			//if ( !added )
			{
				queue.AddRenderable( this, renderQueueID );
				this.added = true;
			}
		}
示例#2
0
		private void WalkOctree( PCZCamera camera,
									ref List<PCZSceneNode> visibleNodeList,
									RenderQueue queue,
									Octree octant,
									VisibleObjectsBoundsInfo visibleBounds,
									bool foundvisible,
									bool onlyShadowCasters,
									bool displayNodes,
									bool showBoundingBoxes )
		{

			//return immediately if nothing is in the node.
			if ( octant.NunodeList == 0 )
				return;

			Visibility v = Visibility.None;

			if ( foundvisible )
			{
				v = Visibility.Full;
			}

			else if ( octant == rootOctree )
			{
				v = Visibility.Partial;
			}

			else
			{
				AxisAlignedBox box = octant.Box;

				v = camera.GetVisibility( box );
			}


			// if the octant is visible, or if it's the root node...
			if ( v != Visibility.None )
			{
				//Add stuff to be rendered;

				bool vis = true;

				foreach ( PCZSceneNode sn in octant.NodeList.Values )
				{
					// if the scene node is already visible, then we can skip it
					if ( sn.LastVisibleFrame != mLastVisibleFrame ||
						sn.LastVisibleFromCamera != camera )
					{
						// if this octree is partially visible, manually cull all
						// scene nodes attached directly to this level.
						if ( v == Visibility.Partial )
						{
							vis = camera.IsObjectVisible( sn.WorldAABB );
						}
						if ( vis )
						{
							// add the node to the render queue
							sn.AddToRenderQueue( camera, queue, onlyShadowCasters, visibleBounds );
							// add it to the list of visible nodes
							visibleNodeList.Add( sn );
							// if we are displaying nodes, add the node renderable to the queue
							if ( displayNodes )
							{
								queue.AddRenderable( sn.GetDebugRenderable() );
							}
							// if the scene manager or the node wants the bounding box shown, add it to the queue
							if ( sn.ShowBoundingBox || showBoundingBoxes )
							{
								sn.AddBoundingBoxToQueue( queue );
							}
							// flag the node as being visible this frame
							sn.LastVisibleFrame = mLastVisibleFrame;
							sn.LastVisibleFromCamera = camera;
						}
					}
				}

				Octree child;
				bool childfoundvisible = ( v == Visibility.Full );
				if ( ( child = octant.Children[ 0, 0, 0 ] ) != null )
					WalkOctree( camera, ref visibleNodeList, queue, child, visibleBounds, childfoundvisible,
							   onlyShadowCasters, displayNodes, showBoundingBoxes );

				if ( ( child = octant.Children[ 1, 0, 0 ] ) != null )
					WalkOctree( camera, ref visibleNodeList, queue, child, visibleBounds, childfoundvisible,
							   onlyShadowCasters, displayNodes, showBoundingBoxes );

				if ( ( child = octant.Children[ 0, 1, 0 ] ) != null )
					WalkOctree( camera, ref visibleNodeList, queue, child, visibleBounds, childfoundvisible,
							   onlyShadowCasters, displayNodes, showBoundingBoxes );

				if ( ( child = octant.Children[ 1, 1, 0 ] ) != null )
					WalkOctree( camera, ref visibleNodeList, queue, child, visibleBounds, childfoundvisible,
							   onlyShadowCasters, displayNodes, showBoundingBoxes );

				if ( ( child = octant.Children[ 0, 0, 1 ] ) != null )
					WalkOctree( camera, ref visibleNodeList, queue, child, visibleBounds, childfoundvisible,
							   onlyShadowCasters, displayNodes, showBoundingBoxes );

				if ( ( child = octant.Children[ 1, 0, 1 ] ) != null )
					WalkOctree( camera, ref visibleNodeList, queue, child, visibleBounds, childfoundvisible,
							   onlyShadowCasters, displayNodes, showBoundingBoxes );

				if ( ( child = octant.Children[ 0, 1, 1 ] ) != null )
					WalkOctree( camera, ref visibleNodeList, queue, child, visibleBounds, childfoundvisible,
							   onlyShadowCasters, displayNodes, showBoundingBoxes );

				if ( ( child = octant.Children[ 1, 1, 1 ] ) != null )
					WalkOctree( camera, ref visibleNodeList, queue, child, visibleBounds, childfoundvisible,
							   onlyShadowCasters, displayNodes, showBoundingBoxes );

			}
		}
        /// <summary>
        ///		
        /// </summary>
        /// <param name="queue"></param>
        public override void UpdateRenderQueue(RenderQueue queue)
        {
            // Manual LOD sub entities
            if (meshLodIndex > 0 && mesh.IsLodManual) {
                Debug.Assert(meshLodIndex - 1 < lodEntityList.Count, "No LOD EntityList - did you build the manual LODs after creating the entity?");

                Entity lodEnt = lodEntityList[meshLodIndex - 1];

                // index - 1 as we skip index 0 (original LOD)
                if (this.HasSkeleton && lodEnt.HasSkeleton) {
                    // Copy the animation state set to lod entity, we assume the lod
                    // entity only has a subset animation states
                    copyAnimationMeter.Enter();
                    CopyAnimationStateSubset(lodEnt.animationState, animationState);
                    copyAnimationMeter.Exit();
                }

                lodEnt.UpdateRenderQueue(queue);
                return;
            }

            // add all visible sub entities to the render queue
            Camera camera = sceneMgr.CameraInProgress;
            bool performSubMeshCulling = false;
            // bool performSubMeshCulling = CullSubMeshes;
            for(int i = 0; i < subEntityList.Count; i++) {
                SubEntity subEntity = subEntityList[i];
                if (!subEntity.IsVisible)
                    continue;
                if (performSubMeshCulling && !camera.IsObjectVisible(subEntity.WorldAABB))
                    continue;
                queue.AddRenderable(subEntity, RenderQueue.DEFAULT_PRIORITY, renderQueueID);
            }

            // Since we know we're going to be rendered, take this opportunity to
            // update the animation
            if(HasSkeleton || mesh.HasVertexAnimation) {
                updateAnimationMeter.Enter();
                if (MeterManager.Collecting)
                    MeterManager.AddInfoEvent("Updating animation for mesh {0}, skeleton {1}", mesh.Name, mesh.SkeletonName);
                UpdateAnimationInternal();
                updateAnimationMeter.Exit();

                // Update render queue with child objects (tag points)
                for(int i = 0; i < childObjectList.Count; i++) {
                    MovableObject child = childObjectList[i];

                    if (child.IsVisible) {
                        updateChildMeter.Enter();
                        child.UpdateRenderQueue(queue);
                        updateChildMeter.Exit();
                    }
                }
            }
        }
		public void UpdateRenderQueue( RenderQueue queue )
		{
			if ( IsRenderedAtCurrentLod )
			{
				queue.AddRenderable( this.mRend, this.mTerrain.RenderQueueGroupID );
			}
		}
示例#5
0
		public override void UpdateRenderQueue( RenderQueue queue )
		{
			this.UpdateIndexBuffer();

			if ( this.indexData.indexCount > 0 )
			{
				queue.AddRenderable( this );
			}
		}
示例#6
0
		/*
		// Recursively walk the zones, adding all visible SceneNodes to the list of visible nodes.
		*/
		public override void FindVisibleNodes( PCZCamera camera,
									  ref List<PCZSceneNode> visibleNodeList,
									  RenderQueue queue,
									  VisibleObjectsBoundsInfo visibleBounds,
									  bool onlyShadowCasters,
									  bool displayNodes,
									  bool showBoundingBoxes )
		{

			//return immediately if nothing is in the zone.
			if ( mHomeNodeList.Count == 0 &&
				mVisitorNodeList.Count == 0 &&
				mPortals.Count == 0 )
				return;

			// Else, the zone is automatically assumed to be visible since either
			// it is the camera the zone is in, or it was reached because
			// a connecting portal was deemed visible to the camera.

			// enable sky if called to do so for this zone
			if ( HasSky )
			{
				// enable sky
				mPCZSM.EnableSky( true );
			}

			// find visible nodes at home in the zone
			bool vis;

			foreach ( PCZSceneNode pczsn in mHomeNodeList )
			{
				//PCZSceneNode pczsn = *it;
				// if the scene node is already visible, then we can skip it
				if ( pczsn.LastVisibleFrame != mLastVisibleFrame ||
					pczsn.LastVisibleFromCamera != camera )
				{
					FrustumPlane fPlane;
					// for a scene node, check visibility using AABB
					vis = camera.IsObjectVisible( pczsn.WorldAABB, out fPlane );
					if ( vis )
					{
						// add it to the list of visible nodes
						visibleNodeList.Add( pczsn );
						// add the node to the render queue
						pczsn.AddToRenderQueue( camera, queue, onlyShadowCasters, visibleBounds );
						// if we are displaying nodes, add the node renderable to the queue
						if ( displayNodes )
						{
							queue.AddRenderable( pczsn.GetDebugRenderable() );
						}
						// if the scene manager or the node wants the bounding box shown, add it to the queue
						if ( pczsn.ShowBoundingBox || showBoundingBoxes )
						{
							pczsn.AddBoundingBoxToQueue( queue );
						}
						// flag the node as being visible this frame
						pczsn.LastVisibleFrame = mLastVisibleFrame;
						pczsn.LastVisibleFromCamera = camera;
					}
				}
			}
			// find visible visitor nodes

			foreach ( PCZSceneNode pczsn in mVisitorNodeList )
			{
				// if the scene node is already visible, then we can skip it
				if ( pczsn.LastVisibleFrame != mLastVisibleFrame ||
					pczsn.LastVisibleFromCamera != camera )
				{
					FrustumPlane fPlane;
					// for a scene node, check visibility using AABB
					vis = camera.IsObjectVisible( pczsn.WorldAABB, out fPlane );
					if ( vis )
					{
						// add it to the list of visible nodes
						visibleNodeList.Add( pczsn );
						// add the node to the render queue
						pczsn.AddToRenderQueue( camera, queue, onlyShadowCasters, visibleBounds );
						// if we are displaying nodes, add the node renderable to the queue
						if ( displayNodes )
						{
							queue.AddRenderable( pczsn.GetDebugRenderable() );
						}
						// if the scene manager or the node wants the bounding box shown, add it to the queue
						if ( pczsn.ShowBoundingBox || showBoundingBoxes )
						{
							pczsn.AddBoundingBoxToQueue( queue );
						}
						// flag the node as being visible this frame
						pczsn.LastVisibleFrame = mLastVisibleFrame;
						pczsn.LastVisibleFromCamera = camera;
					}
				}
			}

			// find visible portals in the zone and recurse into them
			foreach ( Portal portal in mPortals )
			{
				FrustumPlane fPlane;
				// for portal, check visibility using world bounding sphere & direction
				vis = camera.IsObjectVisible( portal, out fPlane );
				if ( vis )
				{
					// portal is visible. Add the portal as extra culling planes to camera
					int planes_added = camera.AddPortalCullingPlanes( portal );
					// tell target zone it's visible this frame
					portal.getTargetZone().LastVisibleFrame = mLastVisibleFrame;
					portal.getTargetZone().LastVisibleFromCamera = camera;
					// recurse into the connected zone
					portal.getTargetZone().FindVisibleNodes( camera,
															  ref visibleNodeList,
															  queue,
															  visibleBounds,
															  onlyShadowCasters,
															  displayNodes,
															  showBoundingBoxes );
					if ( planes_added > 0 )
					{
						// Then remove the extra culling planes added before going to the next portal in this zone.
						camera.RemovePortalCullingPlanes( portal );
					}
				}
			}
		}
示例#7
0
			/// <summary>
			///   Add children to the render queue
			/// </summary>
			/// <param name="queue"> </param>
			/// <param name="group"> </param>
			/// <param name="camSquaredDistance"> </param>
			public void AddRenderables( RenderQueue queue, RenderQueueGroupID group, float camSquaredDistance )
			{
				// Determine the current material technique
				mTechnique = mMaterial.GetBestTechnique( mMaterial.GetLodIndex( camSquaredDistance ) );
				foreach ( GeometryBucket iter in mGeometryBucketList )
				{
					queue.AddRenderable( iter, group );
				}
			}
        public override void UpdateRenderQueue(RenderQueue queue)
        {
            Debug.Assert(inBoundary);

            if (isVisible)
            {
                queue.AddRenderable(this);
            }
        }
 public void AddRenderables(RenderQueue queue, RenderQueueGroupID group, float camDistanceSquared)
 {
     if (material != null) {
         // determine the current material technique
         technique = material.GetBestTechnique(material.GetLodIndexSquaredDepth(camDistanceSquared));
         foreach (GeometryBucket gbucket in geometryBucketList)
             queue.AddRenderable(gbucket, RenderQueue.DEFAULT_PRIORITY, group);
     }
 }
示例#10
0
        public void QueuePatches(RenderQueue queue)
        {
            var idx = 0;

            for (var i = 0; i < Levels; i++)
            {
                var level = _levels[i];

                var mask = i == 0 ? PatchLocations.PatchSelection.Everything :PatchLocations.PatchSelection.Outer;

                if (i != 0)
                    mask |= PatchLocations.PatchSelection.OuterDegenerated;

                mask |= level.Bottom ? PatchLocations.PatchSelection.InteriorBottom : PatchLocations.PatchSelection.InteriorTop;
                mask |= level.Left ? PatchLocations.PatchSelection.InteriorLeft : PatchLocations.PatchSelection.InteriorRight;

                var subX = level.Position.X.Fraction * 2.0f - 1.0f;
                var intX = level.Position.X.Integer;
                var subY = level.Position.Y.Fraction * 2.0f - 1.0f;
                var intY = level.Position.Y.Integer;
                var texX = (intX * 2) & N;
                var texY = (intY * 2) & N;

                foreach (var p in Locations.Select(mask))
                {
                    PatchRenderable pp;
                    if (_queueCache.Count <= idx)
                    {
                        pp = new PatchRenderable(p.Patch, _shader);
                        _queueCache.Add(pp);
                    } else
                        pp = _queueCache[idx];
                    idx++;

                    // queue the patch for rendering
                    pp.ScaleFactor = new Vector4(p.X + subX, p.Y + subY, level.Scale, level.Scale);
                    pp.FineBlockOrigin = new Vector4(p.X - Hx - texX, p.Y - Hx - texY, (float)InverseD, (float)InverseD);
                    pp.Level = level;
                    queue.AddRenderable(pp);
                }
            }
        }
示例#11
0
		/// <summary>
		///    Overriden from Panel.
		/// </summary>
		/// <param name="queue"></param>
		public override void UpdateRenderQueue( RenderQueue queue )
		{
			// Add self twice to the queue
			// Have to do this to allow 2 materials
			if ( isVisible )
			{
				// add border first
				queue.AddRenderable( this.borderRenderable, (ushort)zOrder, RenderQueueGroupID.Overlay );

				// do inner last so the border artifacts don't overwrite the children
				// Add inner
				base.UpdateRenderQueue( queue );
			}
		}
 public override void UpdateRenderQueue(RenderQueue queue)
 {
     #if _VisibilityCheck
     if ( mustRender == false )
     {
         return;
     }
     #endif
     if ( inUse && isLoaded && inFrustum)
     {
         RenderableManager.Instance.AddVisible();
         queue.AddRenderable( this );
     }
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="queue"></param>
 public override void UpdateRenderQueue(RenderQueue queue)
 {
     // add ourself to the render queue
     // we render late, since most of the ocean will be rendered over by terrain, and
     // we will benefit from early out in the pixel shader due to z-test
     queue.AddRenderable(this, 1, RenderQueueGroupID.Nine);
 }
        public override void UpdateRenderQueue(RenderQueue queue)
        {
            if ( isVisible )
            {
                if (tile.Hilight)
                {
                    material = tile.HilightMaterial;
                }
                else
                {
                    material = normalMaterial;
                }

                if ( renderOp.vertexData == null )
                {
                    // the object is visible so we had better make sure it has vertex and index buffers
                    renderOp.vertexData = buildVertexData();
                    renderOp.indexData = IndexBufferManager.Instance.GetTileIndexBuffer(numSamples);
                }

                if ( WorldManager.Instance.DrawTiles )
                {
                    queue.AddRenderable( this );
                }

                if ( stitchRenderable == null )
                {
                    tile.Stitch();
                }

                if ( WorldManager.Instance.DrawStitches && ( stitchRenderable != null ) )
                {
                    queue.AddRenderable( stitchRenderable );
                }
            }
        }
示例#15
0
		/// <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( 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();
				}
			}
			//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 ( showBoundingBox || ( creator != null && creator.ShowBoundingBoxes ) )
			{
				AddBoundingBoxToQueue( queue );
			}
		}
        public override void UpdateRenderQueue(RenderQueue queue)
        {
            if (isVisible)
            {
                if (TerrainManager.Instance.DrawTerrain)
                {
                    if (renderOp.vertexData == null)
                    {
                        // the object is visible so we had better make sure it has vertex and index buffers
                        buildVertexData();
                    }

                    // put terrain in its own render queue for easier profiling
                    queue.AddRenderable(this, RenderQueue.DEFAULT_PRIORITY, RenderQueueGroupID.Main);
                }
            }
        }
示例#17
0
		/// <summary>
		///		Adds this nodes bounding box (wireframe) to the RenderQueue.
		/// </summary>
		/// <param name="queue"></param>
		public void AddBoundingBoxToQueue( RenderQueue queue )
		{
			if ( wireBox == null )
				wireBox = new WireBoundingBox();

			// add the wire bounding box to the render queue
			wireBox.BoundingBox = worldAABB;
			queue.AddRenderable( wireBox );
		}
示例#18
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="queue"></param>
 public override void UpdateRenderQueue(RenderQueue queue)
 {
     // add ourself to the render queue
     queue.AddRenderable(this, RenderQueueGroup);
 }
示例#19
0
			public void AddRenderables( RenderQueue queue, RenderQueueGroupID group, Real lodValue )
			{
				// Get batch instance
#warning OGRE-1.6 BatchInstance Implementation
				//BatchInstance batchInstance = Parent.Parent;

				// Get material lod strategy
				var materialLodStrategy = Material.LodStrategy;

				// If material strategy doesn't match, recompute lod value with correct strategy
#warning OGRE-1.6 BatchInstance Implementation needed
				//if ( materialLodStrategy != batchInstance.LodStrategy )
				//    lodValue = materialLodStrategy.GetValue( batchInstance, batchInstance.Camera );

				// determine the current material technique
				this.technique = this.material.GetBestTechnique( this.material.GetLodIndex( lodValue ) );
				foreach ( var gbucket in this.geometryBucketList )
				{
					queue.AddRenderable( gbucket, RenderQueue.DEFAULT_PRIORITY, group );
				}
			}
示例#20
0
		/// <summary>
		///    Internal method to put the contents onto the render queue.
		/// </summary>
		/// <param name="queue">Current render queue.</param>
		public virtual void UpdateRenderQueue( RenderQueue queue )
		{
			if ( isVisible )
			{
				queue.AddRenderable( this, (ushort)zOrder, RenderQueueGroupID.Overlay );
			}
		}
示例#21
0
		public override void UpdateRenderQueue( RenderQueue queue )
		{
			queue.AddRenderable( this );
		}
示例#22
0
		/// <summary>
		///
		/// </summary>
		/// <param name="queue"></param>
		public override void UpdateRenderQueue( RenderQueue queue )
		{
			// Manual LOD sub entities
			if ( this.meshLodIndex > 0 && this.mesh.IsLodManual )
			{
				Debug.Assert( this.meshLodIndex - 1 < this.lodEntityList.Count,
				              "No LOD EntityList - did you build the manual LODs after creating the entity?" );

				var lodEnt = this.lodEntityList[ this.meshLodIndex - 1 ];

				// index - 1 as we skip index 0 (original LOD)
				if ( HasSkeleton && lodEnt.HasSkeleton )
				{
					// Copy the animation state set to lod entity, we assume the lod
					// entity only has a subset animation states
					CopyAnimationStateSubset( lodEnt.animationState, this.animationState );
				}

				lodEnt.UpdateRenderQueue( queue );
				return;
			}

			// add all visible sub entities to the render queue
			foreach ( var se in this.subEntityList )
			{
				if ( se.IsVisible )
				{
					queue.AddRenderable( se, RenderQueue.DEFAULT_PRIORITY, renderQueueID );
				}
			}

			// Since we know we're going to be rendered, take this opportunity to
			// update the animation
			if ( HasSkeleton || this.mesh.HasVertexAnimation )
			{
				UpdateAnimation();

				// Update render queue with child objects (tag points)
				foreach ( var child in this.childObjectList.Values )
				{
					if ( child.IsVisible )
					{
						child.UpdateRenderQueue( queue );
					}
				}
			}
		}
 /// <summary>
 /// 
 /// </summary>
 /// <param name="queue"></param>
 public override void UpdateRenderQueue(RenderQueue queue)
 {
     // add ourself to the render queue
     queue.AddRenderable(this);
 }