Esempio n. 1
0
        public void ShutDown()
        {
            // Release the camera object.
            Camera = null;

            // Release the color shader object.
            ColorShader?.ShutDown();
            ColorShader = null;
            // Release the model object.
            Model?.ShutDown();
            Model = null;
            // Release the Direct3D object.
            D3D?.ShutDown();
            D3D = null;
        }
Esempio n. 2
0
        // Mathods
        public bool Initialize(DSystemConfiguration configuration, IntPtr windowHandle)
        {
            try
            {
                // Create the Direct3D object.
                D3D = new DDX11();

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

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

                // Set the initial position of the camera.
                Camera.SetPosition(0, 0, -3);

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

                // Initialize the model object.
                if (!Model.Initialize(D3D.Device))
                {
                    return(false);
                }

                // Create the color shader object.
                ColorShader = new DColorShader();

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

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