public void Shutdown() { Camera = null; // Release the light shader object. LightMapShader?.ShutDown(); LightMapShader = null; // Release the model object. Model?.Shutdown(); Model = null; // Release the Direct3D object. D3D?.ShutDown(); D3D = null; }
// Methods. 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(); // Initialize a base view matrix the camera for 2D user interface rendering. Camera.SetPosition(0, 0, -1); Camera.Render(); // Create the model class. Model = new DModel(); // Initialize the model object. if (!Model.Initialize(D3D.Device, "square.txt", new[] { "stone01.bmp", "light01.bmp" })) { MessageBox.Show("Could not initialize the model object", "Error", MessageBoxButtons.OK); return(false); } // Create the light shader object. LightMapShader = new DLightMapShader(); // Initialize the light shader object. if (!LightMapShader.Initialize(D3D.Device, windowHandle)) { MessageBox.Show("Could not initialize the light shader", "Error", MessageBoxButtons.OK); return(false); } return(true); } catch (Exception ex) { MessageBox.Show("Could not initialize Direct3D\nError is '" + ex.Message + "'"); return(false); } }