/// <summary> /// Constructor for the Camera class. /// </summary> /// <param name="device">The device that will camera will operate in.</param> /// <param name="position">The initial position vector of the camera</param> /// <param name="m_target">The initial target vector</param> /// <param name="m_upVector">The initial up vector</param> /// <param name="windowWidth">The width of the application window</param> /// <param name="windowHeight">The height of the application window</param> /// <param name="aspectRatio">The aspect ratio of this game window</param> /// <param name="terrain">The terrain object that this camera will "walk" on</param> public Camera(Vector3 position, Vector3 target, Vector3 upVector, int windowWidth, int windowHeight, float aspectRatio, Terrain terrain) { m_position = position; m_target = target; m_upVector = upVector; m_windowWidth = windowWidth; m_windowHeight = windowHeight; m_aspectRatio = aspectRatio; mTerrain = terrain; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here mDevice = graphics.GraphicsDevice; effect = Content.Load<Effect>("effects"); // Load objects to draw mTerrain = new Terrain(Content); mXWing.load(Content, effect); mTable.load(Content, effect); mSkydome.load(Content, effect); Rectangle windowBounds = this.Window.ClientBounds; mCamera = new Camera(new Vector3(60, 30, -80), new Vector3(0, 0, 0), new Vector3(0, 1, 0), windowBounds.Width, windowBounds.Height, mDevice.Viewport.AspectRatio, mTerrain); }