Esempio n. 1
0
        /// <summary>
        ///    Internal method to put the overlay contents onto the render queue.
        /// </summary>
        /// <param name="camera">Current camera being used in the render loop.</param>
        /// <param name="queue">Current render queue.</param>
        public void FindVisibleObjects(Camera camera, RenderQueue queue)
        {
            if (!isVisible)
            {
                return;
            }

            // add 3d elements
            rootNode.Position    = camera.DerivedPosition;
            rootNode.Orientation = camera.DerivedOrientation;
            rootNode.Update(true, false);

            // set up the default queue group for the objects about to be added
            RenderQueueGroupID oldGroupID = queue.DefaultRenderGroup;

            queue.DefaultRenderGroup = RenderQueueGroupID.Overlay;
            rootNode.FindVisibleObjects(camera, queue, null, true, false);
            // reset the group
            queue.DefaultRenderGroup = oldGroupID;

            // add 2d elements
            for (int i = 0; i < elementList.Count; i++)
            {
                OverlayElementContainer container = (OverlayElementContainer)elementList[i];
                container.Update();
                container.UpdateRenderQueue(queue);
            }
        }
 public void removeObjectsToRender(GameEntity[] gameObjs)
 {
     foreach (GameObject obj in gameObjs)
     {
         renderQueue -= obj.draw;
     }
 }
Esempio n. 3
0
        private void UpdateFromBlendMode()
        {
            switch (m_alphaMode)
            {
            case AlphaMode.Opaque:
            {
                m_renderType  = RenderType.Opaque;
                m_renderQueue = RenderQueue.Geometry;
            }
            break;

            case AlphaMode.Masked:
            {
                m_renderType  = RenderType.TransparentCutout;
                m_renderQueue = RenderQueue.AlphaTest;
            }
            break;

            case AlphaMode.Fade:
            case AlphaMode.Transparent:
            {
                m_renderType  = RenderType.Transparent;
                m_renderQueue = RenderQueue.Transparent;
            }
            break;
            }
        }
Esempio n. 4
0
        public void Render(
            GraphicsDevice gd,
            CommandList rc,
            SceneContext sc,
            RenderPasses pass,
            BoundingFrustum frustum,
            Vector3 viewPosition,
            RenderQueue <IRenderable> renderQueue,
            List <IRenderable> renderableList,
            Comparer <RenderItemIndex> comparer,
            bool threaded)
        {
            renderQueue.Clear();

            renderableList.Clear();
            CollectFreeObjects(pass, renderableList);
            renderQueue.AddRange(renderableList, viewPosition);

            if (comparer == null)
            {
                renderQueue.Sort();
            }
            else
            {
                renderQueue.Sort(comparer);
            }

            foreach (var renderable in renderQueue)
            {
                renderable.Render(gd, rc, sc, pass);
            }
        }
Esempio n. 5
0
 public HtmlDrawingGeometryRenderElement(IRenderElementFactory factory, RenderQueue renderQueue, SvgValueConverter converter) :
     base(SvgDocument.CreateElement("path"), factory, renderQueue, converter)
 {
     this.factory     = factory;
     this.renderQueue = renderQueue;
     this.converter   = converter;
 }
Esempio n. 6
0
            public MeshData Render(Chunk context, RenderQueue r)
            {
                Mesh     m        = new Mesh();
                MeshData meshData = new MeshData();

                meshData.startingIndex = vertIndex;

                for (int x = 0; x < context.chunkSize; x++)
                {
                    for (int y = 0; y < context.chunkSize; y++)
                    {
                        for (int z = 0; z < context.chunkSize; z++)
                        {
                            if (r.voxels[x + context.chunkSize * (y + context.chunkSize * z)] == false)
                            {
                                continue;
                            }
                            switch (context[x, y, z].shape)
                            {
                            case VoxelShape.BLOCK:
                                RenderCube(ref meshData, ref context, context[x, y, z], x, y, z);
                                break;

                            default:
                                break;
                            }
                        }
                    }
                }
                vertIndex += meshData.vertices.Count;
                triIndex  += meshData.triangles.Count;
                return(meshData);
            }
Esempio n. 7
0
        public bool HasRenderInfo(ref RenderType renderType, ref RenderQueue renderQueue)
        {
            if (!m_validData)
            {
                return(false);
            }

            bool foundRenderType  = false;
            bool foundRenderQueue = false;
            int  count            = m_availableTags.Count;

            for (int i = 0; i < count; i++)
            {
                if (m_availableTags[i].TagName.Equals(RenderTypeHelperStr))
                {
                    if (TemplateHelperFunctions.StringToRenderType.ContainsKey(m_availableTags[i].TagValue))
                    {
                        renderType      = TemplateHelperFunctions.StringToRenderType[m_availableTags[i].TagValue];
                        foundRenderType = true;
                    }
                }
                else if (m_availableTags[i].TagName.Equals(RenderQueueHelperStr))
                {
                    string value = m_availableTags[i].TagValue.Split('+')[0].Split('-')[0];
                    if (TemplateHelperFunctions.StringToRenderQueue.ContainsKey(value))
                    {
                        renderQueue      = TemplateHelperFunctions.StringToRenderQueue[value];
                        foundRenderQueue = true;
                    }
                }
            }
            return(foundRenderType && foundRenderQueue);
        }
Esempio n. 8
0
 /// <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);
 }
Esempio n. 9
0
 protected override void LoadContent()
 {
     Block.Initialize();
     PhysicsMaterial.Initialize();
     RenderingMaterial.Initialize();
     RenderQueue.Initialize();
 }
Esempio n. 10
0
        void RenderQueueGUIDraw()
        {
            using (new EditorGUILayout.HorizontalScope())
            {
                EditorGUI.BeginChangeCheck();
                {
                    EditorGUI.BeginChangeCheck();
                    RenderQueue rq = isRenderQueueCustom ? RenderQueue.Custom : (RenderQueue)geometryRenderQueue.intValue;
                    rq = (RenderQueue)EditorGUILayout.EnumPopup(EditorStrings.Config.GeometryRenderQueue, rq);
                    if (EditorGUI.EndChangeCheck())
                    {
                        isRenderQueueCustom = (rq == RenderQueue.Custom);

                        if (!isRenderQueueCustom)
                        {
                            geometryRenderQueue.intValue = (int)rq;
                        }
                    }

                    EditorGUI.BeginDisabledGroup(!isRenderQueueCustom);
                    {
                        geometryRenderQueue.intValue = EditorGUILayout.IntField(geometryRenderQueue.intValue, GUILayout.MaxWidth(65.0f));
                    }
                    EditorGUI.EndDisabledGroup();
                }
                if (EditorGUI.EndChangeCheck())
                {
                    SetDirty(DirtyFlags.AllBeamGeom);
                }
            }
        }
Esempio n. 11
0
		public bool HasRenderInfo( ref RenderType renderType, ref RenderQueue renderQueue )
		{
			if( !m_validData )
				return false:

			bool foundRenderType = false:
			bool foundRenderQueue = false:
			int count = m_availableTags.Count:
			for( int i = 0: i < count: i++ )
			{
				if( m_availableTags[ i ].TagName.Equals( Constants.RenderTypeHelperStr ) )
				{
					if( TemplateHelperFunctions.StringToRenderType.ContainsKey( m_availableTags[ i ].TagValue ) )
					{
						renderType = TemplateHelperFunctions.StringToRenderType[ m_availableTags[ i ].TagValue ]:
						foundRenderType = true:
					}
				}
				else if( m_availableTags[ i ].TagName.Equals( Constants.RenderQueueHelperStr ) )
				{
					string value = m_availableTags[ i ].TagValue.Split( '+' )[ 0 ].Split( '-' )[ 0 ]:
					if( TemplateHelperFunctions.StringToRenderQueue.ContainsKey( value ) )
					{
						renderQueue = TemplateHelperFunctions.StringToRenderQueue[ value ]:
						foundRenderQueue = true:
					}
				}
			}
			return foundRenderType && foundRenderQueue:
		}
 /// <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);
     }
 }
Esempio n. 13
0
        public override void UpdateRenderQueue(RenderQueue queue, List <Particle> currentParticles, bool cullIndividually)
        {
            this.billboardSet.CullIndividual = cullIndividually;

            // Update billboard set geometry
            this.billboardSet.BeginBillboards();
            var bb = new Billboard();

            foreach (var p in currentParticles)
            {
                bb.Position = p.Position;
                if (this.billboardSet.BillboardType == BillboardType.OrientedSelf ||
                    this.billboardSet.BillboardType == BillboardType.PerpendicularSelf)
                {
                    // Normalise direction vector
                    bb.Direction = p.Direction;
                    bb.Direction.Normalize();
                }
                bb.Color             = p.Color;
                bb.rotationInRadians = p.rotationInRadians;
                bb.HasOwnDimensions  = p.HasOwnDimensions;
                if (bb.HasOwnDimensions)
                {
                    bb.width  = p.Width;
                    bb.height = p.Height;
                }
                this.billboardSet.InjectBillboard(bb);
            }

            this.billboardSet.EndBillboards();

            // Update the queue
            this.billboardSet.UpdateRenderQueue(queue);
        }
 public override void UpdateRenderQueue(RenderQueue queue)
 {
     if (renderer != null)
     {
         renderer.UpdateRenderQueue(queue, activeParticles, cullIndividual);
     }
 }
Esempio n. 15
0
 public HtmlDrawingImageRenderElement(IRenderElementFactory htmlRenderElementFactory, RenderQueue renderQueue, SvgValueConverter svgValueConverter) :
     base(SvgDocument.CreateElement("image"))
 {
     this.factory     = htmlRenderElementFactory;
     this.renderQueue = renderQueue;
     this.converter   = svgValueConverter;
 }
Esempio n. 16
0
 public HtmlDrawingShapeRenderElement(HTMLElement htmlElement, IRenderElementFactory factory, RenderQueue renderQueue, SvgValueConverter converter) :
     base(htmlElement)
 {
     this.factory     = factory;
     this.renderQueue = renderQueue;
     this.converter   = converter;
 }
 public HtmlDrawingContainerRenderElement(IRenderElementFactory factory, RenderQueue renderQueue, SvgValueConverter converter) :
     base(SvgDocument.CreateElement("g"), renderQueue)
 {
     this.factory     = factory;
     this.renderQueue = renderQueue;
     this.converter   = converter;
 }
Esempio n. 18
0
 public RenderQueueGroup(RenderQueue parent, bool splitPassesByLightingType, bool splitNoShadowPasses, bool shadowCastersNotReceivers) : this(OgrePINVOKE.new_RenderQueueGroup(RenderQueue.getCPtr(parent), splitPassesByLightingType, splitNoShadowPasses, shadowCastersNotReceivers), true)
 {
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 19
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)
 {
     foreach (MaterialBucket iter in mMaterialBucketMap.Values)
     {
         iter.AddRenderables(queue, group, camSquaredDistance);
     }
 }
Esempio n. 20
0
 public RenderingSettings(RenderQueue q, string t, BlendMode src, BlendMode dst, int zWri)
 {
     queue      = q;
     renderType = t;
     SrcBlend   = (int)src;
     DstBlend   = (int)dst;
     zWrite     = zWri;
 }
Esempio n. 21
0
 public void AddRenderables(RenderQueue queue, RenderQueueGroupID group, float camSquaredDistance)
 {
     // Just pass this on to child buckets
     foreach (var mbucket in this.materialBucketMap.Values)
     {
         mbucket.AddRenderables(queue, group, camSquaredDistance);
     }
 }
Esempio n. 22
0
 public void _queueOverlaysForRendering(Camera cam, RenderQueue pQueue, Viewport vp)
 {
     OgreOverlayPINVOKE.OverlayManager__queueOverlaysForRendering(swigCPtr, Camera.getCPtr(cam), RenderQueue.getCPtr(pQueue), Viewport.getCPtr(vp));
     if (OgreOverlayPINVOKE.SWIGPendingException.Pending)
     {
         throw OgreOverlayPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 23
0
 public void _findVisibleObjects(Camera cam, RenderQueue queue, VisibleObjectsBoundsInfo visibleBounds)
 {
     OgrePINVOKE.SceneNode__findVisibleObjects__SWIG_3(swigCPtr, Camera.getCPtr(cam), RenderQueue.getCPtr(queue), VisibleObjectsBoundsInfo.getCPtr(visibleBounds));
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
            public void ReplaceRenderItem(RenderItem oldItem, RenderItem newItem)
            {
                int index = RenderQueue.IndexOf(oldItem);

                RenderQueue.Remove(oldItem);
                RenderQueue.Insert(index, newItem);
                CallDirty();
            }
Esempio n. 25
0
 public void _addBoundingBoxToQueue(RenderQueue queue)
 {
     OgrePINVOKE.SceneNode__addBoundingBoxToQueue(swigCPtr, RenderQueue.getCPtr(queue));
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 26
0
 public void _updateRenderQueue(RenderQueue queue)
 {
     OgrePINVOKE.InstanceBatch__updateRenderQueue(swigCPtr, RenderQueue.getCPtr(queue));
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 27
0
 public void merge(RenderQueue rhs)
 {
     OgrePINVOKE.RenderQueue_merge(swigCPtr, RenderQueue.getCPtr(rhs));
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 28
0
 public void _updateRenderQueue(RenderQueue queue)
 {
     OgreOverlayPINVOKE.PanelOverlayElement__updateRenderQueue(swigCPtr, RenderQueue.getCPtr(queue));
     if (OgreOverlayPINVOKE.SWIGPendingException.Pending)
     {
         throw OgreOverlayPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 29
0
 public void _updateRenderQueue(RenderQueue queue)
 {
     OgrePINVOKE.ParticleSystem__updateRenderQueue(swigCPtr, RenderQueue.getCPtr(queue));
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 30
0
 public override void UpdateRenderQueue(RenderQueue queue)
 {
     UpdateIndexBuffer();
     if (indexData.indexCount > 0)
     {
         queue.AddRenderable(this, RenderQueue.DEFAULT_PRIORITY, renderQueueID);
     }
 }
Esempio n. 31
0
        internal CCRenderer(CCDrawManager drawManager)
        {
            DrawManager = drawManager;

            RenderQueue = new RenderQueue<CCRenderQueueId, CCRenderCommand>();

            quads = new CCRawList<CCV3F_C4B_T2F_Quad>();

            batchCommands = new List<CCRenderCommand>(BATCH_QUADCOMMAND_RESEVER_SIZE);
            batchQuadCommands = new List<CCQuadCommand>(BATCH_QUADCOMMAND_RESEVER_SIZE);
        }
        /// <summary>
        /// Renders the GBuffer pass
        /// </summary>
        /// <param name="vp">Target viewport for the rendering</param>
        /// <param name="queue">Render queue containing objects to draw</param>
        /// <param name="cam">Camera to use for rendering</param>
        public void Render(Viewport vp, Camera cam, RenderQueue queue)
        {
            _renderer.SetRenderTarget(vp.Target);
            if(vp.AlwaysClear) _renderer.Clear(vp.ClearColor);

            _shader.SetViewProj(cam.View, cam.Projection);
            RenderQueueGroup[] queueGroups = queue.QueueGroupList;
            for (int i = 0; i < (int)RenderQueueGroupId.Count; i++)
            {
                RenderQueueGroup group = queueGroups[i];
                if (group == null) continue;

                RenderGroup(group);
            }
            _renderer.UnsetRenderTarget();
        }
Esempio n. 33
0
            /// <summary>
            /// 
            /// </summary>
            /// <param name="queue"></param>
            /// <param name="group"></param>
            public void AddSelfToRenderQueue(RenderQueue queue, RenderQueueGroupID group) {
                if (mBuild) {
                    //Update material technique based on camera distance
                    Debug.Assert(material != null);
#warning missing function getLodIndexSquaredDepth
                    mBestTechnique = material.GetBestTechnique(material.GetLodIndex(mParent.MinDistanceSquared));

                    //Add to render queue
                    queue.AddRenderable(this, group);
                }
            }
Esempio n. 34
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="queue"></param>
 public override void UpdateRenderQueue(RenderQueue queue) {
     //If visible...
     if (IsVisible) {
         //Ask each batch to add itself to the render queue if appropriate
         foreach (SubBatch batch in mSubBatches.Values)
             batch.AddSelfToRenderQueue(queue, base.renderQueueID);//base.RenderQueueGroup
     }
 }
Esempio n. 35
0
 internal void RemoveRenderItems(RenderQueue rq)
 {
     if (renderItems == null)
     {
         return;
     }
     for (int i = 0; i < renderItems.Length; i++)
     {
         rq.Remove(renderItems[i]);
     }
 }
 public FuseeObject(RenderQueue render)
 {
     _RenderQueue = render;
     _gameEntities = new List<SceneEntity>();
 }
Esempio n. 37
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);
                }
            }
        }
Esempio n. 38
0
 internal void AddRenderItems(RenderQueue rq)
 {
     if (renderItems.HasElements())
     {
         for (int i = 0; i < renderItems.Length; i++)
         {
             rq.Add(renderItems[i]);
         }
     }
 }
Esempio n. 39
0
 internal void RemoveRenderItems(RenderQueue rq)
 {
     if (renderItems.HasElements() && rq.Count > 0)
     {
         for (int i = 0; i < renderItems.Length; i++)
         {
             rq.Remove(renderItems[i]);
         }
     }
 }