#include "rtsLinearAlgebra.h" #ifndef _RTSMATH_H #define _RTSMATH_H #define CAMERA_UP -1 #define CAMERA_DOWN 1 #define CAMERA_LEFT -1 #define CAMERA_RIGHT 1 struct rtsCameraState { point3D position; point3D lookat; vector3D up; float pers_view_angle; float ortho_width; float ortho_height; float near_plane; float far_plane; }; class rtsCamera { //members rtsCameraState m_camera_state; public: //methods void RotateUpDown(double degrees); void RotateLeftRight(double degrees); void Pan(double x, double y); void Yaw(double degrees); void Pitch(double degrees); void Forward(double distance); void ScaleForward(double factor, double min = 0, double max = 999999); void DollyLeftRight(double distance); void DollyUpDown(double distance); void Zoom(double angle); void LookAt(point3D point); void Position(point3D point); void Up(vector3D up); void DollyPosition(point3D point); //moves the camera but keeps the current orientation //get methods rtsCameraState getState(); vector3D getViewVector(); vector3D getUpVector(); point3D getPosition(); point3D getLookAtPoint(); double getViewAngle(){return m_camera_state.pers_view_angle;} double getNearPlane(){return m_camera_state.near_plane;} double getFarPlane(){return m_camera_state.far_plane;} double getOrthoWidth(){return m_camera_state.ortho_width;} double getOrthoHeight(){return m_camera_state.ortho_height;} //set methods void setState(rtsCameraState camera_state); //initialization methods //int SetPosition(double x, double y, double z); //int OrthogonalCamera(double width, double height, double near, double far); //int LookAt(double x, double y, double z); //looks at a point in space //int SetUpVector(double x, double y, double z); /*int InitializePerspectiveCamera(double position_x, double position_y, double position_z, double lookat_x, double lookat_y, double lookat_z, double up_x, double up_y, double up_z, double angle, double near_dist, double far_dist);*/ //int InitializeCamera(); //initializes a camera to defaults rtsCamera(); rtsCamera(rtsCameraState initial_state); ~rtsCamera(); }; #endif