示例#1
0
            public void Restore(GraphicsDevice graphicsDevice)
            {
                graphicsDevice.SetDepthAndRenderTargets(DepthStencilBuffer, RenderTargets);

                graphicsDevice.SetBlendState(BlendState, BlendFactor, BlendMultiSampleMask);
                graphicsDevice.SetDepthStencilState(DepthStencilState, StencilReference);
                graphicsDevice.SetRasterizerState(RasterizerState);

                graphicsDevice.needViewportUpdate = true;
            }
示例#2
0
            public void Restore(GraphicsDevice graphicsDevice)
            {
                graphicsDevice.SetDepthAndRenderTargets(DepthStencilBuffer, RenderTargets);

                graphicsDevice.SetBlendState(BlendState, BlendFactor, BlendMultiSampleMask);
                graphicsDevice.SetDepthStencilState(DepthStencilState, StencilReference);
                graphicsDevice.SetRasterizerState(RasterizerState);

                // TODO: This is not optimized
                for (int i = 0; i < Viewports.Length; i++)
                {
                    var viewport = Viewports[i];
                    if (viewport != Graphics.Viewport.Empty)
                    {
                        graphicsDevice.SetViewport(i, viewport);
                    }
                }
            }
 /// <summary>
 /// Resets the <see cref="BlendState"/>, <see cref="DepthStencilState"/> and <see cref="RasterizerState"/> to their
 /// default values.
 /// </summary>
 /// <param name="device">The device.</param>
 public static void ResetStates(this GraphicsDevice device)
 {
     device.SetBlendState(device.BlendStates.Default);
     device.SetDepthStencilState(device.DepthStencilStates.Default);
     device.SetRasterizerState(device.RasterizerStates.CullBack);
 }