public bool Initialze(DDX11 D3D, IntPtr windowHandle, DSystemConfiguration configuration) { // Create the user interface object. UserInterface = new DUserInterface(); // Initialize the user interface object. if (!UserInterface.Initialize(D3D, configuration)) { return(false); } // Create the camera object Camera = new DCamera(); // Initialize a base view matrix with the camera for 2D user interface rendering. Camera.SetPosition(0.0f, 0.0f, -10.0f); Camera.Render(); Camera.RenderBaseViewMatrix(); // Create the position object. Position = new DPosition(); // Set the initial position and rotation of the viewer.28.0f, 5.0f, -10.0f Position.SetPosition(512.0f, 30.0f, 1034.0f); Position.SetRotation(0.0f, 180.0f, 0.0f); // Create the light object. Light = new DLight(); // Initialize the light object. Light.SetDiffuseColor(1.0f, 1.0f, 1.0f, 1.0f); Light.Direction = new Vector3(-0.5f, -1.0f, -0.5f); // Create and initialize the frustum object. Frustum = new DFrustum(); Frustum.Initialize(DSystemConfiguration.ScreenDepth); // Create the sky dome object. SkyDomeModel = new DSkyDome(); // Initialize the sky dome object. if (!SkyDomeModel.Initialize(D3D.Device, "skydome.txt")) { return(false); } // Initialize the terrain object. Terrain = new DTerrain(); // Initialize the ground model object. if (!Terrain.Initialize(D3D.Device, "setupS2TutTerr08.txt")) { return(false); } // Set the UI to display by default. DisplayUI = true; // Set wire frame rendering initially to enabled. WireFrame = false; // Set the rendering of cell lines initially to enabled. CellLines = true; return(true); }
public bool Initialze(DDX11 D3D, IntPtr windowHandle, DSystemConfiguration configuration) { // Create the user interface object. UserInterface = new DUserInterface(); // Initialize the user interface object. if (!UserInterface.Initialize(D3D, configuration)) { return(false); } // Create the camera object Camera = new DCamera(); // Initialize a base view matrix with the camera for 2D user interface rendering. Camera.SetPosition(0.0f, 0.0f, -10.0f); Camera.Render(); Camera.RenderBaseViewMatrix(); // Create the position object. Position = new DPosition(); // Set the initial position and rotation of the viewer.28.0f, 5.0f, -10.0f Position.SetPosition(128.0f, 10.0f, -10.0f); Position.SetRotation(0.0f, 0.0f, 0.0f); // Initialize the terrain object. Terrain = new DTerrain(); // Initialize the ground model object. if (!Terrain.Initialize(D3D.Device, "setup.txt")) { return(false); } // Set the UI to display by default. DisplayUI = true; // Set wire frame rendering initially to enabled. WireFrame = true; return(true); }
// Methods. public bool Initialize(DSystemConfiguration configuration, IntPtr windowHandle) { try { // Create the input object. The input object will be used to handle reading the keyboard and mouse input from the user. Input = new DInput(); // Initialize the input object. if (!Input.Initialize(configuration, windowHandle)) { return(false); } // #region Initialize System // Create the Direct3D object. D3D = new DDX11(); // Initialize the Direct3D object. if (!D3D.Initialize(configuration, windowHandle)) { return(false); } // Create the shader manager object. ShaderManager = new DShaderManager(); // Initialize the shader manager object. if (!ShaderManager.Initilize(D3D, windowHandle)) { return(false); } // Create the position object. Position = new DPosition(); // Set the initial position and rotation of the viewer. Position.SetPosition(0.0f, 1.5f, -4.0f); Position.SetRotation(15.0f, 0.0f, 0.0f); // Create the camera object Camera = new DCamera(); // Initialize a base view matrix with the camera for 2D user interface rendering. Camera.SetPosition(0.0f, 0.0f, -10.0f); Camera.Render(); Camera.RenderBaseViewMatrix(); // Create the fps object. FPS = new DFPS(); //// Initialize the fps object. FPS.Initialize(); // Create the user interface object. UserInterface = new DUserInterface(); // Initialize the user interface object. if (!UserInterface.Initialize(D3D, configuration)) { return(false); } // Create the ground model object. GroundModel = new DModel(); // Initialize the ground model object. if (!GroundModel.Initialize(D3D.Device, "plane01.txt", "rock015.bmp")) { return(false); } // Create the foliage object. Foliage = new DFoliage(); // Initialize the foliage object. if (!Foliage.Initialize(D3D.Device, "grass01.bmp", 500)) { return(false); } return(true); } catch (Exception ex) { MessageBox.Show("Could not initialize Direct3D\nError is '" + ex.Message + "'"); return(false); } }