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;
            }
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public static void Return(MyOcclusionQuery query)
 {
     m_queriesStack.Push(query);
 }
Exemplo n.º 4
0
 public static void Return(MyOcclusionQuery query)
 {
     m_queriesStack.Push(query);
 }
Exemplo n.º 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();
        }
Exemplo n.º 6
0
        public MyLightGlare(MyLight light)
        {
            m_parent = light;
            m_occlusionBox = new BoundingBox();

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