Esempio n. 1
0
        public static MyOcclusionQuery Get()
        {
            MyOcclusionQuery query = null;

            if (m_queriesStack.Count > 0)
            {
                query = m_queriesStack.Pop();
            }
            else
            {
                query = MyOcclusionQuery.CreateQuery();
                if (query == null)
                {
                    Debug.Fail("OcclusionQuery cannot be null!");
                    return(null);
                }

                query.LoadContent(m_device);
                m_existingQueries.Add(query);
            }

            System.Diagnostics.Debug.Assert(!m_queriesStack.Contains(query));

            return(query);
        }
Esempio n. 2
0
        public override void UnloadContent()
        {
            m_glare.UnloadContent();

            if (SpotQuery != null)
            {
                MyOcclusionQueries.Return(SpotQuery);
                SpotQuery = null;
            }

            base.UnloadContent();
        }
Esempio n. 3
0
        public override void LoadContent()
        {
            if (m_glare == null)
            {
                m_glare = new MyLightGlare(this);
            }

            m_glare.LoadContent();

            SpotQuery      = MyOcclusionQueries.Get();
            SpotQueryState = QueryState.IssueOcc;

            base.LoadContent();
        }
Esempio n. 4
0
        public override void LoadContent()
        {
            base.LoadContent();

            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;

                System.Diagnostics.Debug.Assert(m_queries[i].OcclusionQuery == null);
                m_queries[i].OcclusionQuery = occlusionQuery;
            }
        }
Esempio n. 5
0
        private static void IssueOcclusionQuery(MyOcclusionQuery query, bool depthTest)
        {
            MyRender.GetRenderProfiler().StartProfilingBlock("IssueOcclusionQuery");
            BlendState previousBlendState = BlendState.Current;

            MyStateObjects.DisabledColorChannels_BlendState.Apply();
            RasterizerState.CullNone.Apply();

            DepthStencilState.None.Apply();

            query.Begin();

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

            query.End();

            previousBlendState.Apply();

            MyRender.GetRenderProfiler().EndProfilingBlock();
        }
        public override void UnloadContent()
        {
            m_glare.UnloadContent();

            if (SpotQuery != null)
            {
                MyOcclusionQueries.Return(SpotQuery);
                SpotQuery = null;
            }

            base.UnloadContent();
        }
        public override void LoadContent()
        {
            if (m_glare == null)
                m_glare = new MyLightGlare(this);

            m_glare.LoadContent();
            
            SpotQuery = MyOcclusionQueries.Get();
            SpotQueryState = QueryState.IssueOcc;
            
            base.LoadContent();
        }
Esempio n. 8
0
        public static void Return(MyOcclusionQuery query)
        {
            System.Diagnostics.Debug.Assert(!m_queriesStack.Contains(query));

            m_queriesStack.Push(query);
        }
        private static void IssueOcclusionQuery(MyOcclusionQuery query, bool depthTest)
        {
            MyRender.GetRenderProfiler().StartProfilingBlock("IssueOcclusionQuery");
            BlendState previousBlendState = BlendState.Current;
            MyStateObjects.DisabledColorChannels_BlendState.Apply();
            RasterizerState.CullNone.Apply();

            DepthStencilState.None.Apply();

            query.Begin();

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

            query.End();

            previousBlendState.Apply();

            MyRender.GetRenderProfiler().EndProfilingBlock();
        }
Esempio n. 10
0
 internal static void RelaseOcclusionQuery(MyOcclusionQuery q)
 {
     m_pool.Add(q);
 }
        public static void Return(MyOcclusionQuery query)
        {
            System.Diagnostics.Debug.Assert(!m_queriesStack.Contains(query));

            m_queriesStack.Push(query);
        }