Open Source Tomb Raider Engine
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Camera.h 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*!
  2. * \file include/Camera.h
  3. * \brief Camera, View Frustum
  4. *
  5. * \author xythobuz
  6. */
  7. #ifndef _CAMERA_H_
  8. #define _CAMERA_H_
  9. #include <glm/gtc/type_precision.hpp>
  10. #include "RoomData.h"
  11. class Camera {
  12. public:
  13. static void reset();
  14. static bool update();
  15. static void setSize(glm::i32vec2 s);
  16. static void handleAction(ActionEvents action, bool isFinished);
  17. static void handleMouseMotion(int x, int y);
  18. static void handleControllerAxis(float value, KeyboardButton axis);
  19. static void setPosition(glm::vec3 p) { pos = p; dirty = true; }
  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 void setRoom(int r) { if (room != r) dirty = true; room = r; }
  31. static int getRoom() { return room; }
  32. static void setKeepInRoom(bool k) { keepInRoom = k; }
  33. static bool getKeepInRoom() { return keepInRoom; }
  34. static bool boxInFrustum(BoundingBox b);
  35. static void displayFrustum(glm::mat4 MVP);
  36. static const float fov;
  37. static const float nearDist;
  38. static const float farDist;
  39. private:
  40. static void calculateFrustumPlanes();
  41. static glm::vec3 pos;
  42. static glm::vec2 rot;
  43. static glm::vec3 posSpeed;
  44. static glm::vec2 rotSpeed;
  45. static glm::mat4 projection;
  46. static glm::mat4 view;
  47. static float rotationDeltaX, rotationDeltaY;
  48. static bool updateViewFrustum, dirty, movingFaster;
  49. static bool keepInRoom;
  50. static int room;
  51. };
  52. #endif