00001 // vuuvolumeadapted by Steven Bergner 00002 00003 // original header: 00004 // File: Camera.h 00005 // Author: Steve Kilthau 00006 // Date: August, 1999 00007 00008 /* 00009 modified February 2002 00010 File vuPerspectiveCamera.h 00011 Author Christopher Steinbach 00012 modified to enable recording and retrieval of camera data. 00013 00014 00015 Modified Mar 2002 00016 By Chris Steinbach 00017 Modified to add the interpolation capabilities that will be needed by 00018 the Key Frame Animator class 00019 00020 */ 00028 #ifndef _VUPERSPECTIVECAMERA_H_ 00029 #define _VUPERSPECTIVECAMERA_H_ 00030 00031 #include <stdlib.h> 00032 #include <stdio.h> 00033 00034 #include "../vuLinAlg/vuVector.h" 00035 #include "vuCamera.h" 00036 00037 #include "../vuMisc/vuRay.h" 00038 00040 00043 class vuPerspectiveCamera : public vuCamera 00044 { 00045 public: 00046 vuCameraType getType(void) {return vuPERSPECTIVE_CAMERA; }; 00047 00048 public: 00050 vuPerspectiveCamera(); 00051 00059 vuPerspectiveCamera(const vuPerspectiveCamera& c); 00060 00061 virtual ~vuPerspectiveCamera(); 00062 00063 float getFOV(void); 00064 void setFOV(const float fov); 00065 00066 float getAspect(void); 00067 void setAspect(const float aspect); 00068 00069 vuVector getTopLeft (void); 00070 void setTopLeft (vuVector &temp); 00071 00072 vuVector getXStep (void); 00073 void setXStep (vuVector &temp); 00074 00075 vuVector getYStep (void); 00076 void setYStep (vuVector &temp); 00077 00079 00082 void init(void); 00083 00085 void glInit(); 00086 00088 vuRay getRay(float xpixel, float ypixel); 00089 00091 virtual void TakeSnapShot (); 00093 virtual void TakeSnapShot (char* Shot); 00095 void TakeSnapShotPersp (char* Shot); 00097 virtual int RestoreShot (char* Shot); 00099 int RestoreShotPersp (char* Shot); 00105 virtual int RestoreNextShot (); 00111 virtual int RestorePreviousShot (); 00114 virtual char* get_id (); 00121 virtual bool verify_id (char* id); 00122 00124 virtual vuPerspectiveCamera& operator=(const vuPerspectiveCamera& rhs); 00125 00127 friend ostream& operator<<(ostream& out, vuPerspectiveCamera &cam); 00129 friend istream& operator>>(istream& in, vuPerspectiveCamera &cam); 00130 00137 virtual vuCamera* create_new (); 00138 00144 virtual vuCamera* operator* (float t); 00145 00150 virtual vuCamera* operator*= (float t); 00151 00157 virtual vuCamera* operator+ (vuPerspectiveCamera &rhs); 00158 00163 virtual vuCamera* operator+= (vuPerspectiveCamera &rhs); 00164 00172 virtual vuCamera* operator+ (vuPerspectiveCamera *rhs); 00173 00178 virtual vuCamera* operator+= (vuPerspectiveCamera *rhs); 00179 00184 virtual vuPerspectiveCamera* operator= (vuPerspectiveCamera *rhs); 00185 00190 friend vuCamera* operator*(float t, vuPerspectiveCamera &cam); 00191 00193 virtual void set_defaults (); 00194 00195 virtual vuCamera* set_equal_to_interp (vuCamera* cam1, vuCamera* cam2, float t1, float t2); 00196 00197 protected: 00198 float m_FOV; 00199 float m_Aspect; 00200 00201 vuVector m_TopLeft; 00202 vuVector m_XStep; 00203 vuVector m_YStep; 00204 }; 00205 00206 #endif