Open Source Tomb Raider Engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*!
  2. * \file include/Camera.h
  3. * \brief Camera class
  4. *
  5. * \author Mongoose
  6. * \author xythobuz
  7. */
  8. #ifndef _CAMERA_H_
  9. #define _CAMERA_H_
  10. #include "math/Quaternion.h"
  11. /*!
  12. * \brief Commands for interactive camera control
  13. */
  14. enum camera_command {
  15. CAMERA_ROTATE_RIGHT,
  16. CAMERA_ROTATE_LEFT,
  17. CAMERA_ROTATE_UP,
  18. CAMERA_ROTATE_DOWN
  19. };
  20. /*!
  21. * \brief Camera class
  22. */
  23. class Camera {
  24. public:
  25. /*!
  26. * \brief Constructs an object of Camera
  27. */
  28. Camera();
  29. /*!
  30. * \brief Get the target currently looked at
  31. * \param target where the target will be stored
  32. */
  33. void getTarget(float target[3]);
  34. /*!
  35. * \brief Get angle/yaw of camera
  36. * \returns theta angle/yaw of camera
  37. */
  38. float getRadianYaw();
  39. /*!
  40. * \brief Get angle/pitch of camera
  41. * \returns phi angle/pitch of camera
  42. */
  43. float getRadianPitch();
  44. /*!
  45. * \brief Set current position
  46. * \param pos new position
  47. */
  48. void setPosition(float pos[3]);
  49. void setSensitivityX(float sens);
  50. void setSensitivityY(float sens);
  51. /*!
  52. * \brief Updates view target
  53. */
  54. void update();
  55. /*!
  56. * \brief Sends interactive command to camera
  57. * \param cmd valid camera command
  58. */
  59. void command(enum camera_command cmd);
  60. private:
  61. void rotate(float angle, float x, float y, float z);
  62. Quaternion mQ; //!< Quaternion for rotation
  63. float mPos[4]; //!< Location in 3 space (aka eye)
  64. float mTarget[4]; //!< Postition we're looking at
  65. float mViewDistance; //!< Distance from target
  66. float mTheta; //!< View angle Y
  67. float mTheta2; //!< View angle Z
  68. float mRotationDeltaX; //!< Horizontal mouse sensitivity
  69. float mRotationDeltaY; //!< Vertical mouse sensitivity
  70. };
  71. Camera &getCamera();
  72. #endif