protected override void Initialize() { // Copy over the device's rasterizer state to change the current fillMode this.GraphicsDevice.RasterizerState = new RasterizerState() { CullMode = CullMode.None }; // Set up the window this.graphics.PreferredBackBufferWidth = 800; this.graphics.PreferredBackBufferHeight = 600; this.graphics.IsFullScreen = false; // Let the renderer draw and update as often as possible this.graphics.SynchronizeWithVerticalRetrace = false; this.IsFixedTimeStep = false; // Flush the changes to the device parameters to the graphics card this.graphics.ApplyChanges(); // Initialize the camera this.camera = new Camera(new Vector3(0, 50, 100), new Vector3(0, 0, 0), new Vector3(0, 1, 0)); this.IsMouseVisible = true; base.Initialize(); }
protected override void Initialize() { device = graphics.GraphicsDevice; // Copy over the device's rasterizer state to change the current fillMode device.RasterizerState = new RasterizerState() { CullMode = CullMode.None }; // Set up the window graphics.PreferredBackBufferWidth = 800; graphics.PreferredBackBufferHeight = 600; graphics.IsFullScreen = false; // Let the renderer draw and update as often as possible graphics.SynchronizeWithVerticalRetrace = false; this.IsFixedTimeStep = false; // Flush the changes to the device parameters to the graphics card graphics.ApplyChanges(); // Initialize the camera camera = new Camera(camEye, new Vector3(0, 0, 0), new Vector3(0, 1, 0)); // initialize render target renderTarget = new RenderTarget2D(device, device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight, false, device.PresentationParameters.BackBufferFormat, DepthFormat.Depth24); IsMouseVisible = true; // generate several world matrices for translating the multiple models for use in the culling exersize Matrix World2 = Matrix.CreateScale(2.0f); Matrix Rotate2 = Matrix.CreateRotationY((float)Math.PI * rotationAmount); Matrix Translate; for (int i = 0; i < model2.Length; i++) { Translate = Matrix.CreateTranslation(new Vector3((i - 2) * 150, 0, 0)); World2n[i] = Rotate2 * World2 * Translate; } base.Initialize(); }