コード例 #1
0
        private bool RenderFadingScene()
        {
            // Turn off the Z buffer to begin all 2D rendering.
            D3D.TurnZBufferOff();

            // Get the world, view, and orthotic matrices from camera and d3d objects.
            var viewMatrix  = Camera.ViewMatrix;
            var worldMatrix = D3D.WorldMatrix;
            var orthoMatrix = D3D.OrthoMatrix;

            // Put the bitmap vertex and index buffers on the graphics pipeline to prepare them for drawing.
            if (!Bitmap.Render(D3D.DeviceContext, 0, 0))
            {
                return(false);
            }

            // Render the bitmap using the fade shader.
            if (!FadeShader.Render(D3D.DeviceContext, Bitmap.IndexCount, worldMatrix, viewMatrix, orthoMatrix, RenderTexture.ShaderResourceView, FadePercentage))
            {
                return(false);
            }

            // Turn the Z buffer back on now that all 2D rendering has completed.
            D3D.TurnZBufferOn();

            return(true);
        }
コード例 #2
0
        public void Shutdown()
        {
            // Release the camera object.
            Camera = null;

            // Release the model object.
            Bitmap?.Shutdown();
            Bitmap = null;
            // Release the fade shader object.
            FadeShader?.ShutDown();
            FadeShader = null;
            // Release the texture shader object.
            TextureShader?.ShutDown();
            TextureShader = null;
            // Release the render to texture object.
            RenderTexture?.Shutdown();
            RenderTexture = null;
            // Release the model object.
            Model?.Shutdown();
            Model = null;
            // Release the Direct3D object.
            D3D?.ShutDown();
            D3D = null;
        }