Beispiel #1
0
        private bool RenderRefractionToTexture()
        {
            // Set the render target to be the refraction render to texture.
            RenderRefractionTexture.SetRenderTarget(D3D.DeviceContext, D3D.DepthStencilView);

            // Clear the render to texture.
            RenderRefractionTexture.ClearRenderTarget(D3D.DeviceContext, D3D.DepthStencilView, 0, 0, 0, 1);

            // Render the scene now and it will draw to the render to texture instead of the back buffer.
            if (!RenderRefractionScene())
            {
                return(false);
            }

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

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

            // Release the water shader object.
            WaterShader?.ShutDown();
            WaterShader = null;
            // Release the refraction shader object.
            RefractionShader?.ShutDown();
            RefractionShader = null;
            /// Release the render to texture object.
            RenderReflectionTexture?.Shutdown();
            RenderReflectionTexture = null;
            // Release the render to texture object.
            RenderRefractionTexture?.Shutdown();
            RenderRefractionTexture = null;
            // Release the light shader object.
            LightShader?.ShutDown();
            LightShader = null;
            // Release the model object.
            GroundModel?.Shutdown();
            GroundModel = null;
            // Release the model object.
            WallModel?.Shutdown();
            WallModel = null;
            // Release the model object.
            BathModel?.Shutdown();
            BathModel = null;
            // Release the model object.
            WaterModel?.Shutdown();
            WaterModel = null;
            // Release the Direct3D object.
            D3D?.ShutDown();
            D3D = null;
        }