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.

Camera.h 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*!
  2. * \file include/Camera.h
  3. * \brief Camera class
  4. *
  5. * \author xythobuz
  6. */
  7. #ifndef _CAMERA_H_
  8. #define _CAMERA_H_
  9. #include <glm/vec2.hpp>
  10. #include <glm/vec3.hpp>
  11. #include <glm/mat4x4.hpp>
  12. #include "RoomData.h"
  13. class Camera {
  14. public:
  15. static void reset();
  16. static void handleAction(ActionEvents action, bool isFinished);
  17. static void handleMouseMotion(int x, int y);
  18. static bool update();
  19. static void setPosition(glm::vec3 p) { pos = p; }
  20. static glm::vec3 getPosition() { return pos; }
  21. static glm::vec2 getRotation() { return rot; }
  22. static glm::mat4 getProjectionMatrix() { return projection; }
  23. static glm::mat4 getViewMatrix() { return view; }
  24. static void setSensitivityX(float sens) { rotationDeltaX = sens; }
  25. static float getSensitivityX() { return rotationDeltaX; }
  26. static void setSensitivityY(float sens) { rotationDeltaY = sens; }
  27. static float getSensitivityY() { return rotationDeltaY; }
  28. static void setUpdateViewFrustum(bool u) { updateViewFrustum = u; }
  29. static bool getUpdateViewFrustum() { return updateViewFrustum; }
  30. static bool boxInFrustum(BoundingBox b);
  31. static void displayFrustum(glm::mat4 MVP);
  32. private:
  33. static glm::vec3 pos;
  34. static glm::vec2 rot;
  35. static glm::vec3 lastPos;
  36. static glm::vec2 lastRot;
  37. static glm::vec2 lastSize;
  38. static glm::mat4 projection;
  39. static glm::mat4 view;
  40. static float rotationDeltaX, rotationDeltaY;
  41. static bool updateViewFrustum;
  42. };
  43. #endif