示例#1
0
        private void IssueSpotQuery()
        {
            if (((LightType & LightTypeEnum.Spotlight) > 0) && SpotQuery != null && SpotQueryState == QueryState.IssueOcc)
            {
                BlendState previousBlendState = BlendState.Current;;
                MyStateObjects.DisabledColorChannels_BlendState.Apply();
                // RasterizerState.CullNone.Apply();
                // DepthStencilState.None.Apply();

                MyEffectOcclusionQueryDraw effectOQ = MyRender.GetEffect(MyEffects.OcclusionQueryDrawMRT) as MyEffectOcclusionQueryDraw;
                effectOQ.SetTechnique(MyEffectOcclusionQueryDraw.Technique.DepthTestEnabled);

                MatrixD spotWorld = SpotWorld;
                spotWorld.Translation = SpotWorld.Translation - MyRenderCamera.Position;
                effectOQ.SetWorldMatrix((Matrix)spotWorld);
                effectOQ.SetViewMatrix(MyRenderCamera.ViewMatrixAtZero);
                effectOQ.SetProjectionMatrix(MyRenderCamera.ProjectionMatrix);

                var depthRenderTarget = MyRender.GetRenderTarget(MyRenderTargets.Depth);
                effectOQ.SetDepthRT(depthRenderTarget);
                effectOQ.SetScale(MyRender.GetScaleForViewport(depthRenderTarget));

                SpotQuery.Begin();

                effectOQ.Begin();

                MyDebugDraw.ModelCone.Render();

                effectOQ.End();

                SpotQuery.End();

                SpotQueryState = QueryState.CheckOcc;

                previousBlendState.Apply();
            }

            if (SpotQueryState == QueryState.WaitOcc)
            {
                SpotQueryState = QueryState.IssueOcc;
            }
        }
示例#2
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();
        }
        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();
        }