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); }
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(); }
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; } }
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 LoadContent() { if (m_glare == null) m_glare = new MyLightGlare(this); m_glare.LoadContent(); SpotQuery = MyOcclusionQueries.Get(); SpotQueryState = QueryState.IssueOcc; base.LoadContent(); }
public static void Return(MyOcclusionQuery query) { System.Diagnostics.Debug.Assert(!m_queriesStack.Contains(query)); m_queriesStack.Push(query); }
internal static void RelaseOcclusionQuery(MyOcclusionQuery q) { m_pool.Add(q); }