123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370 |
-
-
-
-
-
-
-
-
-
-
-
- enum camera_command
- {
- CAMERA_MOVE_FORWARD = 1,
- CAMERA_MOVE_BACKWARD,
- CAMERA_MOVE_UP,
- CAMERA_MOVE_DOWN,
- CAMERA_ROTATE_RIGHT,
- CAMERA_ROTATE_LEFT,
- CAMERA_SPEED_UP,
- CAMERA_SPEED_DOWN,
- CAMERA_ROTATE_UP,
- CAMERA_ROTATE_DOWN,
- CAMERA_MOVE_LEFT,
- CAMERA_MOVE_RIGHT
- };
-
- enum CameraFlags
- {
- Camera_FlyMode = 1
- };
-
-
- class Camera
- {
- public:
-
- ////////////////////////////////////////////////////////////
- // Constructors
- ////////////////////////////////////////////////////////////
-
- Camera();
- /*------------------------------------------------------
- * Pre :
- * Post : Constructs an object of Camera
- *
- *-- History ------------------------------------------
- *
- * 2001.05.18:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- ~Camera();
- /*------------------------------------------------------
- * Pre : Camera object is allocated
- * Post : Deconstructs an object of Camera
- *
- *-- History ------------------------------------------
- *
- * 2001.05.18:
- * Mongoose - Created
- ------------------------------------------------------*/
-
-
- ////////////////////////////////////////////////////////////
- // Public Accessors
- ////////////////////////////////////////////////////////////
-
- unsigned int getId();
-
-
-
- void getPosition(vec3_t pos);
-
-
-
- void getUp(vec3_t up);
-
-
-
- void getTarget(vec3_t target);
-
-
-
- float getYaw();
-
-
-
- double getRadianYaw();
-
-
-
- float getPitch();
-
-
-
- double getRadianPitch();
-
-
-
- bool isBehind(int x, int z);
-
-
-
-
- ////////////////////////////////////////////////////////////
- // Public Mutators
- ////////////////////////////////////////////////////////////
-
- void rotate(float angle, float x, float y, float z);
- /*------------------------------------------------------
- * Pre : x,y,z axis; angle in radians
- * Post : Rotates camera
- *
- *-- History ------------------------------------------
- *
- * 2001.06.04:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- void translate(float x, float y, float z);
- /*------------------------------------------------------
- * Pre :
- * Post : Camera position is set to x,y,z
- *
- *-- History ------------------------------------------
- *
- * 2001.05.18:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- void reset();
- /*------------------------------------------------------
- * Pre :
- * Post : Camera is set to inital state
- *
- *-- History ------------------------------------------
- *
- * 2001.05.18:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- void setSensitivityX(float angle);
- /*------------------------------------------------------
- * Pre : angle is theta's rotation delta in degrees
- * Post : Sets rotation delta
- *
- *-- History ------------------------------------------
- *
- * 2001.06.04:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- void setSensitivityY(float angle);
- /*------------------------------------------------------
- * Pre : angle is theta's rotation delta in degrees
- * Post : Sets rotation delta
- *
- *-- History ------------------------------------------
- *
- * 2001.06.04:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- void command(enum camera_command cmd);
- /*------------------------------------------------------
- * Pre : Command is valid camera command
- * Post : Sends interactive command to camera
- *
- *-- History ------------------------------------------
- *
- * 2001.05.18:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- void setSpeed(float s);
- /*------------------------------------------------------
- * Pre : s is 256 or greater in general
- * Post : Sets 'speed'
- *
- *-- History ------------------------------------------
- *
- * 2002.01.02:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- void update();
- /*------------------------------------------------------
- * Pre :
- * Post : Updates view target
- *
- *-- History ------------------------------------------
- *
- * 2001.05.18:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- void setPosition(vec3_t pos);
- /*------------------------------------------------------
- * Pre : Set current position
- * Post :
- *
- *-- History ------------------------------------------
- *
- * 2002.06.16:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- void setUp(vec3_t up);
- /*------------------------------------------------------
- * Pre :
- * Post : Sets up vector
- *
- *-- History ------------------------------------------
- *
- * 2001.05.18:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- void setTarget(vec3_t target);
- /*------------------------------------------------------
- * Pre :
- * Post : Sets target ( look at pos )
- *
- *-- History ------------------------------------------
- *
- * 2001.05.18:
- * Mongoose - Created
- ------------------------------------------------------*/
-
-
- private:
-
- ////////////////////////////////////////////////////////////
- // Private Accessors
- ////////////////////////////////////////////////////////////
-
-
- ////////////////////////////////////////////////////////////
- // Private Mutators
- ////////////////////////////////////////////////////////////
-
- unsigned int mId; /* Unquie id */
-
- Quaternion mQ; /* Quaternion for rotation */
-
- unsigned int mFlags; /* For testing with flags */
-
- double mPos[4]; /* Location in 3 space (aka eye) */
-
- double mTarget[4]; /* Postition we're looking at */
-
- double mUp[4]; /* Up vector */
-
- double mSide[4]; /* Side vector */
-
- double mViewDistance; /* Distance from target */
-
- double mTranslateDelta; /* Step size to move */
-
- double mRotateDelta; /* Radians to rotate Y */
-
- double mTheta; /* View angle Y */
-
- double mRotateDelta2; /* Radians to rotate Z */
-
- double mTheta2; /* View angle Z */
-
- bool mUpdate; /* Check to see if view needs updating */
-
- static unsigned int mCounter; /* Id system use */
- };
-
|