Esempio n. 1
0
        private void End()
        {
            DebugSceneOverrideMode sceneOverrideMode = RenderingSettings.debugSceneOverrideMode;

            switch (sceneOverrideMode)
            {
            case DebugSceneOverrideMode.Wireframe:
            {
                m_Context.Submit();
                GL.wireframe = false;
                break;
            }

            case DebugSceneOverrideMode.SolidWireframe:
            case DebugSceneOverrideMode.ShadedWireframe:
            {
                if (m_Index == 1)
                {
                    m_Context.Submit();
                    GL.wireframe = false;
                }
                break;
            }

            default:
            {
                break;
            }
            } // End of switch.
        }
Esempio n. 2
0
        private void Begin()
        {
            DebugSceneOverrideMode sceneOverrideMode = RenderingSettings.debugSceneOverrideMode;

            switch (sceneOverrideMode)
            {
            case DebugSceneOverrideMode.Wireframe:
            {
                m_Context.Submit();
                GL.wireframe = true;
                break;
            }

            case DebugSceneOverrideMode.SolidWireframe:
            case DebugSceneOverrideMode.ShadedWireframe:
            {
                if (m_Index == 1)
                {
                    m_Context.Submit();
                    GL.wireframe = true;
                }
                break;
            }
            } // End of switch.

            m_DebugHandler.SetupShaderProperties(m_CommandBuffer, m_Index);

            m_Context.ExecuteCommandBuffer(m_CommandBuffer);
            m_CommandBuffer.Clear();
        }
Esempio n. 3
0
        internal RenderStateBlock GetRenderStateBlock(RenderStateBlock renderStateBlock)
        {
            DebugSceneOverrideMode sceneOverrideMode = RenderingSettings.debugSceneOverrideMode;

            // Potentially override parts of the RenderStateBlock
            switch (sceneOverrideMode)
            {
            case DebugSceneOverrideMode.Overdraw:
            {
                RenderTargetBlendState additiveBlend = new RenderTargetBlendState(sourceColorBlendMode: BlendMode.One, destinationColorBlendMode: BlendMode.One);

                // Additive-blend but leave z-write and culling as they are when we draw normally
                renderStateBlock.blendState = new BlendState {
                    blendState0 = additiveBlend
                };
                renderStateBlock.mask = RenderStateMask.Blend;
                break;
            }

            case DebugSceneOverrideMode.SolidWireframe:
            case DebugSceneOverrideMode.ShadedWireframe:
            {
                if (m_Index == 1)
                {
                    // Ensure we render the wireframe in front of the solid triangles of the previous pass...
                    renderStateBlock.rasterState = new RasterState(offsetUnits: -1, offsetFactor: -1);
                    renderStateBlock.mask        = RenderStateMask.Raster;
                }
                break;
            }
            }

            return(renderStateBlock);
        }
Esempio n. 4
0
                public Enumerator(DebugHandler debugHandler, ScriptableRenderContext context, CommandBuffer commandBuffer)
                {
                    DebugSceneOverrideMode sceneOverrideMode = debugHandler.DebugDisplaySettings.RenderingSettings.debugSceneOverrideMode;

                    m_DebugHandler  = debugHandler;
                    m_Context       = context;
                    m_CommandBuffer = commandBuffer;
                    m_NumIterations = ((sceneOverrideMode == DebugSceneOverrideMode.SolidWireframe) || (sceneOverrideMode == DebugSceneOverrideMode.ShadedWireframe)) ? 2 : 1;

                    m_Index = -1;
                }
Esempio n. 5
0
        internal bool GetRenderStateBlock(out RenderStateBlock renderStateBlock)
        {
            DebugSceneOverrideMode sceneOverrideMode = RenderingSettings.debugSceneOverrideMode;

            // Create an empty render-state block and only enable the parts we wish to override...
            renderStateBlock = new RenderStateBlock();

            switch (sceneOverrideMode)
            {
            case DebugSceneOverrideMode.Overdraw:
            {
                RenderTargetBlendState additiveBlend = new RenderTargetBlendState(sourceColorBlendMode: BlendMode.One, destinationColorBlendMode: BlendMode.One);

                // Additive-blend but leave z-write and culling as they are when we draw normally...
                renderStateBlock.blendState = new BlendState {
                    blendState0 = additiveBlend
                };
                renderStateBlock.mask = RenderStateMask.Blend;
                return(true);
            }

            case DebugSceneOverrideMode.Wireframe:
            {
                return(true);
            }

            case DebugSceneOverrideMode.SolidWireframe:
            case DebugSceneOverrideMode.ShadedWireframe:
            {
                if (m_Index == 1)
                {
                    // Ensure we render the wireframe in front of the solid triangles of the previous pass...
                    renderStateBlock.rasterState = new RasterState(offsetUnits: -1, offsetFactor: -1);
                    renderStateBlock.mask        = RenderStateMask.Raster;
                }

                return(true);
            }

            default:
            {
                // We're not going to override anything...
                return(false);
            }
            } // End of switch.
        }
Esempio n. 6
0
        internal RenderStateBlock GetRenderStateBlock(RenderStateBlock renderStateBlock)
        {
            DebugSceneOverrideMode sceneOverrideMode = RenderingSettings.sceneOverrideMode;

            // Potentially override parts of the RenderStateBlock
            switch (sceneOverrideMode)
            {
            case DebugSceneOverrideMode.Overdraw:
            {
                var isOpaque       = m_FilteringSettings.renderQueueRange == RenderQueueRange.opaque || m_FilteringSettings.renderQueueRange == RenderQueueRange.all;
                var isTransparent  = m_FilteringSettings.renderQueueRange == RenderQueueRange.transparent || m_FilteringSettings.renderQueueRange == RenderQueueRange.all;
                var overdrawOpaque =
                    m_DebugHandler.DebugDisplaySettings.renderingSettings.overdrawMode == DebugOverdrawMode.Opaque ||
                    m_DebugHandler.DebugDisplaySettings.renderingSettings.overdrawMode == DebugOverdrawMode.All;
                var overdrawTransparent =
                    m_DebugHandler.DebugDisplaySettings.renderingSettings.overdrawMode == DebugOverdrawMode.Transparent ||
                    m_DebugHandler.DebugDisplaySettings.renderingSettings.overdrawMode == DebugOverdrawMode.All;

                var blendOverdraw = isOpaque && overdrawOpaque || isTransparent && overdrawTransparent;
                var destination   = blendOverdraw ? BlendMode.One : BlendMode.Zero;

                RenderTargetBlendState additiveBlend = new RenderTargetBlendState(sourceColorBlendMode: BlendMode.One, destinationColorBlendMode: destination);

                // Additive-blend but leave z-write and culling as they are when we draw normally
                renderStateBlock.blendState = new BlendState {
                    blendState0 = additiveBlend
                };
                renderStateBlock.mask = RenderStateMask.Blend;
                break;
            }

            case DebugSceneOverrideMode.SolidWireframe:
            case DebugSceneOverrideMode.ShadedWireframe:
            {
                if (m_Index == 1)
                {
                    // Ensure we render the wireframe in front of the solid triangles of the previous pass...
                    renderStateBlock.rasterState = new RasterState(offsetUnits: -1, offsetFactor: -1);
                    renderStateBlock.mask        = RenderStateMask.Raster;
                }
                break;
            }
            }

            return(renderStateBlock);
        }