/* * Camera.cs * Authors: Bradley Blankenship * Copyright (c) 2007-2008 Cornell University This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Collections.Generic; using System.Text; using Microsoft.Xna.Framework; namespace tAC_Engine.Graphics.Cameras { /// /// Represents the base for a series of Camera models, used for /// storing and keeping track of cameras /// public abstract class Camera { #region Fields /// /// The view matrix for the Camera /// protected Matrix mView = Matrix.Identity; /// /// The projection matrix for the camera /// protected Matrix mProjection = Matrix.Identity; /// /// The eye position of the camera /// protected Vector3 mEye = Vector3.Zero; /// /// The lookAt vector of the camera /// protected Vector3 mLookAt = Vector3.Forward; /// /// The up vector of the camera /// protected Vector3 mUp = Vector3.Up; #endregion #region Properties /// /// Gets the view matrix /// public Matrix View { get { return mView; } } /// /// Gets the projection matrix /// public Matrix Projection { get { return mProjection; } } /// /// Gets/Sets the position of the camera eye via three dimensions /// *Note* classes must override both getters and setters /// public abstract Vector3 Eye { get; set; } /// /// Gets/Sets the position of where the camera is looking at via three dimensions /// *Note* classes must override both getters and setters /// public abstract Vector3 LookAt { get; set; } /// /// Gets/Sets the direction of where up is relative to the camera via three dimensions /// *Note* classes must override both getters and setters /// public abstract Vector3 Up { get; set; } #endregion #region Helpers /// /// CreateView - Creates the view Matrix for the given Camera. /// protected virtual void CreateView() { // Create the view matrix mView = Matrix.CreateLookAt(mEye, mLookAt, mUp); } /// /// CreateProjection - Creates the projection Matrix for the given camera. /// protected abstract void CreateProjection(); #endregion } }