// 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 position of the camera. Camera.SetPosition(0.0f, 0.0f, -5.0f); #endregion #region Initialize Models //// Create the Flat Plane model class. Model = new DModel(); //// Initialize the ground model object. if (!Model.Initialize(D3D.Device, "square.txt", new[] { "fire01.bmp", "noise01.bmp", "alpha02.bmp" })) { MessageBox.Show("Could not initialize the ground model object", "Error", MessageBoxButtons.OK); return(false); } #endregion #region Initialize Shaders // Create the fire shader object. FireShader = new DFireShader(); if (!FireShader.Initialize(D3D.Device, windowHandle)) { return(false); } #endregion return(true); } catch (Exception ex) { MessageBox.Show("Could not initialize Direct3D\nError is '" + ex.Message + "'"); return(false); } }
public void Shutdown() { // Release the camera object. Camera = null; // Release the GlassShader object. FireShader?.ShutDown(); FireShader = null; // Release the model object. Model?.Shutdown(); Model = null; // Release the Direct3D object. D3D?.ShutDown(); D3D = null; }