Example #1
0
        private bool RenderToDebugTexture()
        {
            // Set the render to be the render to the texture.
            RenderDebugTexture.SetRenderTarget(D3D.DeviceContext, D3D.DepthStencilView);

            // Clear the render to texture.
            RenderDebugTexture.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 (!RenderScene() || !RenderReflectionScene())
            {
                return(false);
            }

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

            return(true);
        }
Example #2
0
        public void Shutdown()
        {
            // Release the reflection shader object.
            if (ReflectionShader != null)
            {
                ReflectionShader.Shuddown();
                ReflectionShader = null;
            }

            // Release the transparent shader object.
            if (TransparentShader != null)
            {
                TransparentShader.Shuddown();
                TransparentShader = null;
            }

            // Release the translate shader object.
            if (TranslateShader != null)
            {
                TranslateShader.Shuddown();
                TranslateShader = null;
            }

            // Release the clip plane shader object.
            if (ClipPlaneShader != null)
            {
                ClipPlaneShader.Shuddown();
                ClipPlaneShader = null;
            }

            // Release the fog shader object.
            if (FogShader != null)
            {
                FogShader.Shuddown();
                FogShader = null;
            }

            // Release the texture shader object.
            if (TextureShader != null)
            {
                TextureShader.Shuddown();
                TextureShader = null;
            }

            // Release the debug window object.
            if (DebugWindow != null)
            {
                DebugWindow.Shutdown();
                DebugWindow = null;
            }

            // Release the debug render to texture object.
            if (RenderDebugTexture != null)
            {
                RenderDebugTexture.Shutdown();
                RenderDebugTexture = null;
            }

            // Release the render to texture object.
            if (RenderReflectionTexture != null)
            {
                RenderReflectionTexture.Shutdown();
                RenderReflectionTexture = null;
            }

            // Release the light object.
            Light = null;

            // Release the shader object.
            if (LightShader != null)
            {
                LightShader.Shuddown();
                LightShader = null;
            }

            // Release the model object.
            if (Model != null)
            {
                Model.Shutdown();
                Model = null;
            }

            // Release the light shader object.
            if (BumpMapShader != null)
            {
                BumpMapShader.Shuddown();
                BumpMapShader = null;
            }

            // Release the model object.
            if (BumpMapModel != null)
            {
                BumpMapModel.Shutdown();
                BumpMapModel = null;
            }

            // Release the text object.
            if (Text != null)
            {
                Text.Shutdown();
                Text = null;
            }

            // Release the camera object.
            if (Camera != null)
            {
                Camera = null;
            }

            // Release the Direct3D object.
            if (D3D != null)
            {
                D3D.Shutdown();
                D3D = null;
            }
        }