home *** CD-ROM | disk | FTP | other *** search
- #ifndef __Camera_h__
- #define __Camera_h__
-
- #include "vectormath.h"
- #include "Input.h"
- #include "GameObject.h"
- #include "Vehicle.h"
-
- enum cameraModes_e{
- CAMERA_MODE_FIRST_PERSON=0,
- CAMERA_MODE_THIRD_PERSON,
- CAMERA_MODE_FREE,
-
- NUM_CAMERA_MODES
- };
-
- class Camera: public GameObject{
- public:
- int mode;
- bool noclip;
- Vehicle* target;
- float zoom; // for third person
- float azimutAngle;
- float elevationAngle;
- AABB_t moveAABB;
-
- unsigned int lastProcessMillis;
- unsigned int lastMoveMillis;
-
- Camera();
-
- void setMode(int mode);
- void setTarget(Vehicle* newTarget);
- void setPositionAndOrientation(vec3_t pos, vec3_t dir, vec3_t up);
- void setPositionAndOrientation(float posx,float posy,float posz, float dirx, float diry, float dirz, float upx,float upy,float upz);
- void lookAtScene();
-
- void processInputArray(inputArray_t inputArray);
- void turnLeft(float deltaT);
- void turnRight(float deltaT);
- void turnUp(float deltaT);
- void turnDown(float deltaT);
-
- void moveForward(float deltaT);
- void moveBackward(float deltaT);
- void moveLeft(float deltaT);
- void moveRight(float deltaT);
- void moveUp(float deltaT);
- void moveDown(float deltaT);
-
- void rotateLeft(float deltaT);
- void rotateRight(float deltaT);
- void rotateUp(float deltaT);
- void rotateDown(float deltaT);
-
- void move();
- bool collisionDetection(vec3_t displacement);
-
- void chaseNext();
- void chasePrevious();
-
- void zoomIn(float deltaT);
- void zoomOut(float deltaT);
-
- void reset();
-
- // This takes a 3D point and returns TRUE if it's inside of the frustum
- bool pointInFrustum(float x, float y, float z);
-
- // This takes a 3D point and a radius and returns TRUE if the sphere is inside of the frustum
- bool sphereInFrustum(float x, float y, float z, float radius);
- bool sphereInFrustum( vec3_t pos, float radius );
-
- // This takes the center and half the length of the cube.
- bool cubeInFrustum( float x, float y, float z, float size );
-
- bool AABBInFrustum( vec3_t min, vec3_t max );
-
- protected:
- // Call this every time the camera moves to update the frustum
- void calculateFrustum();
-
- // This holds the A B C and D values for each side of our frustum.
- float frustum[6][4];
-
- };
-
-
-
-
-
- #endif /* __Camera_h__*/
-