Exemple #1
0
        public void Draw(IRenderArgs args, params RenderStage[] stages)
        {
            var device = args.GraphicsDevice;

            var originalSamplerState = device.SamplerStates[0];

            device.SamplerStates[0] = RenderSampler;

            RasterizerState originalState = device.RasterizerState;

            args.GraphicsDevice.RasterizerState = RasterizerState;

            bool usingWireFrames = UseWireFrames;

            if (usingWireFrames)
            {
                originalState = device.RasterizerState;
                RasterizerState rasterizerState = originalState.Copy();
                rasterizerState.FillMode = FillMode.WireFrame;
                device.RasterizerState   = rasterizerState;
            }

            device.DepthStencilState = DepthStencilState;

            if (Block.FancyGraphics)
            {
                device.BlendState = BlendState.AlphaBlend;
            }
            else
            {
                device.BlendState = BlendState.Opaque;
            }

            DrawStaged(
                args, out int chunksRendered, out int verticesRendered, null,
                stages.Length > 0 ? stages : RenderStages);

            Vertices       = verticesRendered;
            RenderedChunks = chunksRendered;

            device.RasterizerState = originalState;

            device.SamplerStates[0] = originalSamplerState;
        }