public void Shutdown()
        {
            // Release the light object.
            Light = null;
            // Release the view point object.
            ViewPoint = null;
            // Release the camera object.
            Camera = null;

            // Release the projection texture object.
            ProjectionTexture?.ShutDown();
            ProjectionTexture = null;
            // Release the projection shader object.
            ProjectionShader?.ShutDown();
            ProjectionShader = null;
            // Release the ground model object.
            GroundModel?.Shutdown();
            GroundModel = null;
            // Release the cube model object.
            CubeModel?.Shutdown();
            CubeModel = null;
            // Release the Direct3D object.
            D3D?.ShutDown();
            D3D = null;
        }
        // Methods.
        public bool Initialize(DSystemConfiguration configuration, IntPtr windowHandle)
        {
            try
            {
                #region Initialize System
                // Create the Direct3D object.
                D3D = new DDX11();

                // Initialize the Direct3D object.
                if (!D3D.Initialize(configuration, windowHandle))
                {
                    return(false);
                }
                #endregion

                #region Initialize Camera
                // Create the camera object
                Camera = new DCamera();

                // Set the initial position and rotation of the camera.
                Camera.SetPosition(0.0f, 7.0f, -10.0f);
                Camera.SetRotation(35.0f, 0.0f, 0.0f);
                #endregion

                #region Initialize Models
                // Create the ground model object.
                GroundModel = new DModel();

                // Initialize the ground model object.
                if (!GroundModel.Initialize(D3D.Device, "floor.txt", "stone.bmp"))
                {
                    return(false);
                }

                // Create the ground model object.
                CubeModel = new DModel();

                // Initialize the cube model object.
                if (!CubeModel.Initialize(D3D.Device, "cube.txt", "seafloor.bmp"))
                {
                    return(false);
                }
                #endregion

                #region Data variables.
                // Create the light object.
                Light = new DLight();

                // Initialize the light object.
                Light.SetAmbientColor(0.15f, 0.15f, 0.15f, 1.0f);
                Light.SetDiffuseColor(1.0f, 1.0f, 1.0f, 1.0f);
                Light.Position = new Vector3(2.0f, 5.0f, -2.0f);
                #endregion

                #region Initialize Shaders
                // Create the projection shader object.
                ProjectionShader = new DProjectionShader();

                // Initialize the projection shader object.
                if (!ProjectionShader.Initialize(D3D.Device, windowHandle))
                {
                    return(false);
                }

                // Create the projection texture object.
                ProjectionTexture = new DTexture();

                // Initialize the projection texture object.
                if (!ProjectionTexture.Initialize(D3D.Device, DSystemConfiguration.DataFilePath + "grate.bmp"))
                {
                    return(false);
                }

                // Create the view point object.
                ViewPoint = new DViewPoint();

                // Initialize the view point object.
                ViewPoint.SetPosition(2.0f, 5.0f, -2.0f);
                ViewPoint.SetLookAt(0.0f, 0.0f, 0.0f);
                ViewPoint.SetProjectionParameters((float)(Math.PI / 2.0f), 1.0f, 0.1f, 100.0f);
                ViewPoint.GenerateViewMatrix();
                ViewPoint.GenerateProjectionMatrix();
                #endregion

                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Could not initialize Direct3D\nError is '" + ex.Message + "'");
                return(false);
            }
        }