Open Source Tomb Raider Engine
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

Camera.h 2.0KB

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