public void InitQueries()
        {
            for (int i = 0; i < Enum.GetValues(typeof(MyOcclusionQueryID)).Length; i++)
            {
                MyOcclusionQuery occlusionQuery = MyOcclusionQueries.Get();

                m_queries[i].OcclusionQueryIssued  = false;
                m_queries[i].OcclusionQueryVisible = true;

                m_queries[i].OcclusionQuery = occlusionQuery;
            }
        }
        public static MyOcclusionQuery Get()
        {
            MyOcclusionQuery query = null;

            if (m_queriesStack.Count > 0)
            {
                query = m_queriesStack.Pop();
            }
            else
            {
                query = MyOcclusionQuery.CreateQuery();
                query.LoadContent(m_device);
                m_existingQueries.Add(query);
            }

            return(query);
        }
 public static void Return(MyOcclusionQuery query)
 {
     m_queriesStack.Push(query);
 }
示例#4
0
 public static void Return(MyOcclusionQuery query)
 {
     m_queriesStack.Push(query);
 }
示例#5
0
        private static void IssueOcclusionQuery(MyOcclusionQuery query, bool depthTest)
        {     
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("IssueOcclusionQuery");
            BlendState previousBlendState = BlendState.Current;
            MyStateObjects.DisabledColorChannels_BlendState.Apply();
            RasterizerState.CullNone.Apply();

            if (MyRenderConstants.RenderQualityProfile.ForwardRender)
                DepthStencilState.DepthRead.Apply();
            else
                DepthStencilState.None.Apply();

            query.Begin();

            //generate and draw bounding box of our renderCell in occlusion query 
            MySimpleObjectDraw.DrawOcclusionBoundingBox(m_occlusionBox, 1.0f, depthTest, true);

            query.End();

            previousBlendState.Apply();
                        
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();
        }
示例#6
0
        public MyLightGlare(MyLight light)
        {
            m_parent = light;
            m_occlusionBox = new BoundingBox();

            m_occlusionQuery = MyOcclusionQueries.Get();
            m_measurementQuery = MyOcclusionQueries.Get();
        }