-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCamera.h
More file actions
71 lines (56 loc) · 1.51 KB
/
Copy pathCamera.h
File metadata and controls
71 lines (56 loc) · 1.51 KB
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
#ifndef CAMERA_H
#define CAMERA_H
#include <QVector3D>
#include <QMatrix4x4>
#include <QKeyEvent>
#include <QOpenGLShader>
#include <QDebug>
enum Camera_Movement {
FORWARD,
BACKWARD,
LEFT,
RIGHT,
UP,
DOWN
};
const GLfloat YAW = -90.0f;
const GLfloat PITCH = 0.0f;
const GLfloat SPEED = 1.0f;
const GLfloat SENSITIVITY = 0.1f;
const GLfloat ZOOM = 45.0f;
class Camera {
public:
Camera(QVector3D position = QVector3D(0.0f, 0.0f, 0.0f), QVector3D up = QVector3D(0.0f, 1.0f, 0.0f),
GLfloat yaw = YAW, GLfloat pitch = PITCH)
: front(QVector3D(0.0f, 0.0f, -1.0f)), movementSpeed(SPEED), mouseSensitivity(SENSITIVITY), zoom(ZOOM)
{
this->position = position;
this->worldUp = up;
this->yaw = yaw;
this->picth = pitch;
this->updateCameraVectors();
for(GLuint i = 0; i != 1024; ++i)
this->keys[i] = GL_FALSE;
}
QMatrix4x4 getViewMatrix();
void processMouseMovement(GLfloat xoffset, GLfloat yoffset, GLboolean constraintPitch = true);
void processMouseScroll(GLfloat yoffset);
void processKeyboard(Camera_Movement direction, GLfloat deltaTime);
void processInput(GLfloat dt);
QVector3D position;
QVector3D worldUp;
QVector3D front;
QVector3D up;
QVector3D right;
//Eular Angles
GLfloat picth;
GLfloat yaw;
//Camera options
GLfloat movementSpeed;
GLfloat mouseSensitivity;
GLfloat zoom;
GLboolean keys[1024];
private:
void updateCameraVectors();
};
#endif // CAMERA_H