/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { Form xnaWindow = (Form)Control.FromHandle((this.Window.Handle)); xnaWindow.GotFocus += new EventHandler(xnaWindow_GotFocus); _editor.Show(); _beamer.Show(); _kinectSystem.StartKinect(); graphics.PreferredBackBufferWidth = _editor.panel1.Width; graphics.PreferredBackBufferHeight = _editor.panel1.Height; graphics.PreferMultiSampling = true; graphics.IsFullScreen = false; graphics.ApplyChanges(); _beamer.panel1.Resize += new EventHandler(_beamer_ResizeEnd); _editor.panel1.Resize += new EventHandler(_editor_ResizeEnd); // Create perspective camera for the editor _perspCamera = new Camera(new Viewport(0, 0, _editor.panel1.Width, _editor.panel1.Height)); _perspCamera.Orientation = Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), MathHelper.PiOver4); _cameraController = new CameraController(_perspCamera); // Create orthographic camera for the beamer _orthoCamera = new Camera(new Viewport(0, 0, _beamer.panel1.Width, _beamer.panel1.Height)); //_orthoCamera.Orientation = Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), MathHelper.PiOver2); Quaternion rot1 = Quaternion.CreateFromAxisAngle(new Vector3(-1, 0, 0), MathHelper.PiOver2); Quaternion rot2 = Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0), MathHelper.Pi); _cameraController2 = new CameraController(_orthoCamera); _orthoCamera.Orientation = Quaternion.Multiply(rot1, rot2); _orthoCamera.Type = Camera.ProjectionType.ORTHOGRAPHIC_PROJECTION; _particleSystem = new Galaxy(GraphicsDevice, Content, _perspCamera); _heightMap = new HeightMap(GraphicsDevice, Content); base.Initialize(); }
public CameraController(Camera pCamera) { _camera = pCamera; }