-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCamera.h
55 lines (40 loc) · 1.11 KB
/
Camera.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef CAMERA_H
#define CAMERA_H
#include <glm/vec3.hpp> // glm::vec3
#include <glm/vec4.hpp> // glm::vec4
#include <glm/matrix.hpp>
#include <glm/mat4x4.hpp>
#include <glm/gtc/type_ptr.hpp>
class Camera
{
public:
Camera(int WindowWidth, int WindowHeight);
Camera(int WindowWidth, int WindowHeight, const glm::vec3& Pos, const glm::vec3& Target, const glm::vec3& Up);
void SetPosition(float x, float y, float z);
const glm::vec3& GetPosition() const;
const glm::vec3& GetFront() const;
void OnMouse(int deltaX, int deltaY);
void OnKeyboard(unsigned char key);
void OnRender();
glm::mat4x4 GetMatrix();
void Rotate(float verticalAngle, float horizontalAngle);
private:
void Init();
void Update();
glm::vec3 m_pos;
glm::vec3 m_target;
glm::vec3 m_up;
float m_speed = 0.25f;
float Yaw = 0.0f;
float Pitch = 0.0f;
int m_windowWidth;
int m_windowHeight;
float m_AngleH;
float m_AngleV;
bool m_OnUpperEdge;
bool m_OnLowerEdge;
bool m_OnLeftEdge;
bool m_OnRightEdge;
glm::ivec2 m_mousePos;
};
#endif /* CAMERA_H */