Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

Camera.h

Go to the documentation of this file.
00001 #ifndef _CAMERA_H_
00002 #define _CAMERA_H_
00003 
00004 #include <iostream>
00005 #include <cmath>
00006 using namespace std;
00007 
00008 #include <GL/gl.h>
00009 #include <GL/glu.h>
00010 #include "SDL.h"
00011 
00012 #include "FrameRate.h"
00013 #include "Object.h"
00014 #include "Vector3.h"
00015 #include "VectorMath.h"
00016 
00017 class Camera
00018 {
00019 public:
00020   Camera ();
00021   virtual ~ Camera ();
00022   
00023   // Camera interface //
00027   void positionCamera (double position[], double view[], double upVector[]);
00028   void positionCamera (Vector3 position, Vector3 view, Vector3 upVector);
00029   static void positionCamera (double p1, double p2, double p3, double v1, double v2, double v3, double u1, double u2, double u3);
00033   void checkForMovement ();
00037   void rotateView (double angle, double x, double y, double z);
00041   void setViewFromMouse ();
00045   void moveCamera (double speed);
00049   void strafeCamera (double speed);
00053   void walk(double speed);
00057   void update ();
00061   static void look();
00062   
00063   void increaseSpeed() { _speed *= 2; }
00064   void decreaseSpeed() { _speed /= 2; }
00065   
00066   static void setScreenSize (int width, int height)
00067   {
00068     _screenWidth = width;
00069     _screenHeight = height;
00070   }
00071   
00072   // getter Functions //
00073   Vector3 getPosition ()
00074   {
00075     return _position;
00076   }
00077   double getPositionX ()
00078   {
00079     return _position.getX ();
00080   }
00081   void setPositionX(double t) { _position.setX(t); }
00082   double getPositionY ()
00083   {
00084     return _position.getY ();
00085   }
00086   double getPositionZ ()
00087   {
00088     return _position.getZ ();
00089   }
00090   Vector3 getView ()
00091   {
00092     return _view;
00093   }
00094   double getViewX ()
00095   {
00096     return _view.getX ();
00097   }
00098   double getViewY ()
00099   {
00100     return _view.getY ();
00101   }
00102   double getViewZ ()
00103   {
00104     return _view.getZ ();
00105   }
00106   Vector3 getUpVector ()
00107   {
00108     return _upVector;
00109   }
00110   double getUpVectorX ()
00111   {
00112     return _upVector.getX ();
00113   }
00114   double getUpVectorY ()
00115   {
00116     return _upVector.getY ();
00117   }
00118   double getUpVectorZ ()
00119   {
00120     return _upVector.getZ ();
00121   }
00122   Vector3 getStrafe ()
00123   {
00124     return _strafe;
00125   }
00126   
00127   void setPositionY(double y) { _position.setY(y); }
00128   void setViewY(double y) { _view.setY(y); }
00129 
00130   void setFocus(Object *o) { _focus = o; }
00131   
00132   static double getCurrentFPS() { return _fps; }
00133   static double getSpeed() { return _speed; }
00134 
00135  protected:
00139   void init ();
00143   void reFocus();
00144   
00145   // Camera variables //
00146   static Vector3 _position; // position of the camera
00147   static Vector3 _view; // view of the camera
00148   static Vector3 _upVector; // up vector
00149   Vector3 _strafe; // strafe vector
00150   Vector3 _walk;
00151   
00152   double _currentRotationX; // hold the rotation value
00153   
00154   Object *_focus;
00155 
00156   static double _speed; // the speed at which the camera moves
00157   static double _fps; // Frames Per Second
00158   
00159   static int _screenWidth;
00160   static int _screenHeight;
00161 };
00162 
00163 #endif //_CAMERA_H_

Generated on Wed Apr 21 11:10:53 2004 for naturecalls by doxygen1.2.18