OpenRaider  0.1.4-dev
Open Source Tomb Raider Game Engine implementation
Camera.h
Go to the documentation of this file.
1 
8 #ifndef _CAMERA_H_
9 #define _CAMERA_H_
10 
11 #include <glm/gtc/type_precision.hpp>
12 
13 #include "RoomData.h"
14 
15 class Camera {
16  public:
17  static void reset();
18  static bool update();
19  static void setSize(glm::i32vec2 s);
20 
21  static void handleAction(ActionEvents action, bool isFinished);
22  static void handleMouseMotion(int x, int y);
23  static void handleControllerAxis(float value, KeyboardButton axis);
24 
26  static void setPosition(glm::vec3 p) { pos = glm::vec3(p.x, -p.y, p.z); dirty = true; }
27  static glm::vec3 getPosition() { return glm::vec3(pos.x, -pos.y, pos.z); }
28 
29  static glm::vec2 getRotation() { return rot; }
30  static glm::mat4 getProjectionMatrix() { return projection; }
31  static glm::mat4 getViewMatrix() { return view; }
32 
33  static void setSensitivityX(float sens) { rotationDeltaX = sens; }
34  static float getSensitivityX() { return rotationDeltaX; }
35 
36  static void setSensitivityY(float sens) { rotationDeltaY = sens; }
37  static float getSensitivityY() { return rotationDeltaY; }
38 
39  static void setUpdateViewFrustum(bool u) { updateViewFrustum = u; }
40  static bool getUpdateViewFrustum() { return updateViewFrustum; }
41 
42  static void setRoom(int r) { if (room != r) dirty = true; room = r; }
43  static int getRoom() { return room; }
44 
45  static void setShowOverlay(bool s) { showOverlay = s; }
46  static bool getShowOverlay() { return showOverlay; }
47 
48  static bool boxInFrustum(BoundingBox b);
49  static void displayFrustum(glm::mat4 MVP);
50 
51  static void displayUI();
52 
53  private:
54  static void calculateFrustumPlanes();
55 
56  static glm::vec3 pos;
57  static glm::vec2 rot;
58  static glm::vec3 posSpeed;
59  static glm::vec2 rotSpeed;
60  static glm::mat4 projection;
61  static glm::mat4 view;
64  static int room;
65 };
66 
67 #endif
68 
static bool boxInFrustum(BoundingBox b)
Definition: Camera.cpp:379
static float rotationDeltaY
Definition: Camera.h:62
static glm::mat4 getViewMatrix()
Definition: Camera.h:31
static bool getUpdateViewFrustum()
Definition: Camera.h:40
static bool getShowOverlay()
Definition: Camera.h:46
static int room
Definition: Camera.h:64
static bool movingFaster
Definition: Camera.h:63
static glm::vec2 rot
Definition: Camera.h:57
static void displayFrustum(glm::mat4 MVP)
Definition: Camera.cpp:396
static glm::mat4 projection
Definition: Camera.h:60
static glm::vec2 rotSpeed
Definition: Camera.h:59
static void reset()
Definition: Camera.cpp:67
static glm::vec3 posSpeed
Definition: Camera.h:58
static void displayUI()
Definition: Camera.cpp:214
static void setSensitivityX(float sens)
Definition: Camera.h:33
static float getSensitivityX()
Definition: Camera.h:34
static glm::vec3 getPosition()
Definition: Camera.h:27
KeyboardButton
Definition: global.h:34
Definition: Camera.h:15
static void setRoom(int r)
Definition: Camera.h:42
static void handleMouseMotion(int x, int y)
Definition: Camera.cpp:111
static void setSensitivityY(float sens)
Definition: Camera.h:36
static float getSensitivityY()
Definition: Camera.h:37
static void calculateFrustumPlanes()
Definition: Camera.cpp:279
Auxiliary Room classes.
ActionEvents
Definition: global.h:15
static glm::mat4 view
Definition: Camera.h:61
static int getRoom()
Definition: Camera.h:43
static glm::vec3 pos
Definition: Camera.h:56
static void setShowOverlay(bool s)
Definition: Camera.h:45
static bool showOverlay
Definition: Camera.h:63
static void setUpdateViewFrustum(bool u)
Definition: Camera.h:39
static bool updateViewFrustum
Definition: Camera.h:63
static void handleControllerAxis(float value, KeyboardButton axis)
Definition: Camera.cpp:140
static void handleAction(ActionEvents action, bool isFinished)
Definition: Camera.cpp:85
static glm::mat4 getProjectionMatrix()
Definition: Camera.h:30
static bool dirty
Definition: Camera.h:63
static void setPosition(glm::vec3 p)
Definition: Camera.h:26
static glm::vec2 getRotation()
Definition: Camera.h:29
static float rotationDeltaX
Definition: Camera.h:62
static bool update()
Definition: Camera.cpp:159
static void setSize(glm::i32vec2 s)
Definition: Camera.cpp:80