-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCamera.h
73 lines (57 loc) · 1.08 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#pragma once
#include"Base.h"
enum class CAMERA_MOVE
{
MOVE_LEFT,
MOVE_RIGHT,
MOVE_FRONT,
MOVE_BACK
};
class Camera
{
private:
glm::vec3 m_position;
glm::vec3 m_front;
glm::vec3 m_up;
float m_speed;
float m_pitch;
float m_yaw;
float m_sensitivity;
float m_xpos;
float m_ypos;
bool m_firstMove;
glm::mat4 m_vMatrix;
glm::mat4 m_pMatrx;
public:
Camera()
{
m_position = glm::vec3(1.0f);
m_front = glm::vec3(1.0f);
m_up = glm::vec3(1.0f);
m_speed = 0.01f;
m_pitch = 0.0f;
m_yaw = -90.0f;
m_sensitivity = 0.1f;
m_xpos = 0;
m_ypos = 0;
m_firstMove = true;
m_vMatrix = glm::mat4(1.0f);
}
~Camera()
{
}
void lookAt(glm::vec3 _pos , glm::vec3 _front , glm::vec3 _up );
void update();
glm::mat4 getViewMatrix();
glm::mat4 getProjectMatrix();
void setSpeed(float _speed)
{
m_speed = _speed;
}
void move(CAMERA_MOVE _mode);
void pitch(float _yOffset);
void yaw(float _xOffset);
void setSentitivity(float _s);
void onMouseMove(double _xpos , double _ypos);
void setPerpective(float angle, float ratio, float near, float far);
};