public void Shutdown()
        {
            // Release the camera object.
            Camera = null;

            // Release the glow shader object.
            GlowShader?.ShutDown();
            GlowShader = null;
            // Release the glow map shader object.
            GlowMapShader?.ShutDown();
            GlowMapShader = null;
            // Release the full screen ortho window object.
            FullScreenWindow?.Shutdown();
            FullScreenWindow = null;
            // Release the small ortho window object.
            SmallWindow?.Shutdown();
            SmallWindow = null;
            // Release the up sample render to texture object.
            UpSampleTexure?.Shutdown();
            UpSampleTexure = null;
            // Release the vertical blur render to texture object.
            VerticalBlurTexture?.Shutdown();
            VerticalBlurTexture = null;
            // Release the vertical blur shader object.
            VerticalBlurShader?.ShutDown();
            VerticalBlurShader = null;
            // Release the horizontal blur render to texture object.
            HorizontalBlurTexture?.Shutdown();
            HorizontalBlurTexture = null;
            // Release the horizontal blur shader object.
            HorizontalBlurShader?.ShutDown();
            HorizontalBlurShader = null;
            // Release the small ortho window object.
            SmallWindow?.Shutdown();
            SmallWindow = null;
            // Release the down sample render to texture object.
            DownSampleTexture?.Shutdown();
            DownSampleTexture = null;
            // Release the render to texture object.
            RenderTexture?.Shutdown();
            RenderTexture = null;
            // Release the model object.
            BitMap?.Shutdown();
            BitMap = null;
            // Release the texture shader object.
            TextureShader?.ShutDown();
            TextureShader = null;
            // Release the Direct3D object.
            D3D?.ShutDown();
            D3D = null;
        }
Beispiel #2
0
        private bool UpSampleTexture()
        {
            // Set the render target to be the render to texture.
            UpSampleTexure.SetRenderTarget(D3D.DeviceContext);

            // Clear the render to texture.
            UpSampleTexure.ClearRenderTarget(D3D.DeviceContext, 0.0f, 0.0f, 0.0f, 1.0f);

            // Generate the view matrix based on the camera's position.
            Camera.Render();

            // Get the world and view matrices from the camera and d3d objects.
            Matrix cameraViewMatrix = Camera.BaseViewMatrix;
            Matrix worldMatrix      = D3D.WorldMatrix;

            // Get the ortho matrix from the render to texture since texture has different dimensions.
            Matrix orthoMatrix = UpSampleTexure.OrthoMatrix;

            // Turn off the Z buffer to begin all 2D rendering.
            D3D.TurnZBufferOff();

            // Put the full screen ortho window vertex and index buffers on the graphics pipeline to prepare them for drawing.
            if (!FullScreenWindow.Render(D3D.DeviceContext))
            {
                return(false);
            }

            // Render the full screen ortho window using the texture shader and the small sized final blurred render to texture resource.
            if (!TextureShader.Render(D3D.DeviceContext, FullScreenWindow.IndexCount, worldMatrix, cameraViewMatrix, orthoMatrix, VerticalBlurTexture.ShaderResourceView))
            {
                return(false);
            }

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

            // Reset the render target back to the original back buffer and not the render to texture anymore.
            D3D.SetBackBufferRenderTarget();

            // Reset the viewport back to the original.
            D3D.ResetViewPort();

            return(true);
        }
Beispiel #3
0
        public void Shutdown()
        {
            // Release the light object.
            Light = null;
            // Release the camera object.
            Camera = null;

            // Release the soft shadow shader object.
            SoftShadowShader?.ShutDown();
            SoftShadowShader = null;
            // Release the full screen ortho window object.
            FullScreenWindow?.Shutdown();
            FullScreenWindow = null;
            // Release the up sample render to texture object.
            UpSampleTexure?.Shutdown();
            UpSampleTexure = null;
            // Release the vertical blur shader object.
            VerticalBlurShader?.ShutDown();
            VerticalBlurShader = null;
            // Release the vertical blur render to texture object.
            VerticalBlurTexture?.Shutdown();
            VerticalBlurTexture = null;
            // Release the horizontal blur shader object.
            HorizontalBlurShader?.ShutDown();
            HorizontalBlurShader = null;
            // Release the horizontal blur render to texture object.
            HorizontalBlurTexture?.Shutdown();
            HorizontalBlurTexture = null;
            // Release the texture shader object.
            TextureShader?.ShutDown();
            TextureShader = null;
            // Release the small ortho window object.
            SmallWindow?.Shutdown();
            SmallWindow = null;
            // Release the down sample render to texture object.
            DownSampleTexure?.Shutdown();
            DownSampleTexure = null;
            // Release the shadow shader object.
            ShadowShader?.ShutDown();
            ShadowShader = null;
            // Release the black and white render to texture.
            BlackWhiteRenderTexture?.Shutdown();
            BlackWhiteRenderTexture = null;
            // Release the depth shader object.
            DepthShader?.ShutDown();
            DepthShader = null;
            /// Release the render to texture object.
            RenderTexture?.Shutdown();
            RenderTexture = null;
            // Release the ground model object.
            GroundModel?.Shutdown();
            GroundModel = null;
            // Release the sphere model object.
            SphereModel?.Shutdown();
            SphereModel = null;
            // Release the cube model object.
            CubeModel?.Shutdown();
            CubeModel = null;
            // Release the Direct3D object.
            D3D?.ShutDown();
            D3D = null;
        }