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 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 <glm/gtc/quaternion.hpp>
  13. #include <glm/gtc/type_precision.hpp>
  14. #include "RoomData.h"
  15. class Camera {
  16. public:
  17. static void reset();
  18. static bool update();
  19. static void setSize(glm::i32vec2 s);
  20. static void handleAction(ActionEvents action, bool isFinished);
  21. static void handleMouseMotion(int x, int y);
  22. static void handleControllerAxis(float value, KeyboardButton axis);
  23. static void handleControllerButton(KeyboardButton button, bool released);
  24. //! \fixme The Y axis seems to be the source of all evil?
  25. static void setPosition(glm::vec3 p) { pos = glm::vec3(p.x, -p.y, p.z); }
  26. static glm::vec3 getPosition() { return glm::vec3(pos.x, -pos.y, pos.z); }
  27. static glm::vec2 getRotation();
  28. static glm::mat4 getProjectionMatrix() { return projection; }
  29. static glm::mat4 getViewMatrix() { return view; }
  30. static void setSensitivityX(float sens) { rotationDeltaX = sens; }
  31. static float getSensitivityX() { return rotationDeltaX; }
  32. static void setSensitivityY(float sens) { rotationDeltaY = sens; }
  33. static float getSensitivityY() { return rotationDeltaY; }
  34. static void setUpdateViewFrustum(bool u) { updateViewFrustum = u; }
  35. static bool getUpdateViewFrustum() { return updateViewFrustum; }
  36. static bool boxInFrustum(BoundingBox b);
  37. static void displayFrustum(glm::mat4 MVP);
  38. private:
  39. static void calculateFrustumPlanes();
  40. static glm::vec3 pos;
  41. static glm::vec3 drawPos;
  42. static glm::quat quaternion;
  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;
  49. };
  50. #endif