home *** CD-ROM | disk | FTP | other *** search
/ Enter 2005 March / ENTER.ISO / files / fwp-0.0.6-win32-installer.exe / Camera.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-12-23  |  2.2 KB  |  93 lines

  1. #ifndef __Camera_h__
  2. #define __Camera_h__
  3.  
  4. #include "vectormath.h"
  5. #include "Input.h"
  6. #include "GameObject.h"
  7. #include "Vehicle.h"
  8.  
  9. enum cameraModes_e{
  10.     CAMERA_MODE_FIRST_PERSON=0,
  11.     CAMERA_MODE_THIRD_PERSON,
  12.     CAMERA_MODE_FREE,
  13.  
  14.     NUM_CAMERA_MODES
  15. };
  16.  
  17. class Camera: public GameObject{
  18. public:
  19.     int mode;
  20.     bool noclip;
  21.     Vehicle* target;
  22.     float zoom; // for third person
  23.     float azimutAngle;
  24.     float elevationAngle;
  25.     AABB_t moveAABB;
  26.  
  27.     unsigned int lastProcessMillis;
  28.     unsigned int lastMoveMillis;
  29.  
  30.     Camera();
  31.  
  32.     void setMode(int mode);
  33.     void setTarget(Vehicle* newTarget);
  34.     void setPositionAndOrientation(vec3_t pos, vec3_t dir, vec3_t up);
  35.     void setPositionAndOrientation(float posx,float posy,float posz, float dirx, float diry, float dirz, float upx,float upy,float upz);
  36.     void lookAtScene();
  37.  
  38.     void processInputArray(inputArray_t inputArray);
  39.     void turnLeft(float deltaT);
  40.     void turnRight(float deltaT);
  41.     void turnUp(float deltaT);
  42.     void turnDown(float deltaT);
  43.  
  44.     void moveForward(float deltaT);
  45.     void moveBackward(float deltaT);
  46.     void moveLeft(float deltaT);
  47.     void moveRight(float deltaT);
  48.     void moveUp(float deltaT);
  49.     void moveDown(float deltaT);
  50.  
  51.     void rotateLeft(float deltaT);
  52.     void rotateRight(float deltaT);
  53.     void rotateUp(float deltaT);
  54.     void rotateDown(float deltaT);
  55.  
  56.     void move();
  57.     bool collisionDetection(vec3_t displacement);
  58.  
  59.     void chaseNext();
  60.     void chasePrevious();
  61.  
  62.     void zoomIn(float deltaT);
  63.     void zoomOut(float deltaT);
  64.  
  65.     void reset();
  66.  
  67.     // This takes a 3D point and returns TRUE if it's inside of the frustum
  68.     bool pointInFrustum(float x, float y, float z);
  69.  
  70.     // This takes a 3D point and a radius and returns TRUE if the sphere is inside of the frustum
  71.     bool sphereInFrustum(float x, float y, float z, float radius);
  72.     bool sphereInFrustum( vec3_t pos, float radius );
  73.  
  74.     // This takes the center and half the length of the cube.
  75.     bool cubeInFrustum( float x, float y, float z, float size );
  76.  
  77.     bool AABBInFrustum( vec3_t min, vec3_t max );
  78.  
  79. protected:
  80.     // Call this every time the camera moves to update the frustum
  81.     void calculateFrustum();
  82.  
  83.     // This holds the A B C and D values for each side of our frustum.
  84.     float frustum[6][4];
  85.  
  86. };
  87.  
  88.  
  89.  
  90.  
  91.  
  92. #endif    /* __Camera_h__*/
  93.