-
Notifications
You must be signed in to change notification settings - Fork 0
/
Camera.h
57 lines (42 loc) · 1.1 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
#ifndef CAMERA_H
#define CAMERA_H
#include<vector>
#include<GL/glew.h>
#include<glm\glm.hpp>
#include<glm\gtc\matrix_transform.hpp>
enum Camera_movement{
FORWARD,
BACKWARD,
LEFT,
RIGHT,
UP,
DOWN
};
const GLfloat YAW = -90.0f;
const GLfloat PITCH = 0.0f;
const GLfloat MOUSESPEED = 3.0f;
const GLfloat SENSITIVTY = 0.25f;
const GLfloat ZOOM = 45.0f;
class Camera
{
public:
glm::vec3 Position;
glm::vec3 Front;
glm::vec3 Up;
glm::vec3 Right;
glm::vec3 WorldUp;
GLfloat Yaw;
GLfloat Pitch;
GLfloat MovementSpeed;
GLfloat MouseSensitivity;
GLfloat Zoom;
Camera(glm::vec3 position = glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3 up = glm::vec3(0.0f, 1.0f, 0.0f), GLfloat yaw = YAW, GLfloat pitch = PITCH);
Camera(GLfloat posX, GLfloat posY, GLfloat posZ, GLfloat upX, GLfloat upY, GLfloat upZ, GLfloat yaw, GLfloat pitch) ;
glm::mat4 GetViewMatrix();
void ProcessKeyboard(Camera_movement direction, GLfloat deltaTime);
void ProcessMouseMovement(GLfloat xoffset, GLfloat yoffset, GLboolean constrainPitch = true);
void ProcessMouseScroll(GLfloat yoffset);
private:
void updateCameraVectors();
};
#endif