-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcamera.h
48 lines (35 loc) · 956 Bytes
/
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
#pragma once
#include <vector>
#include <GL/glew.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include "transform.h"
const GLfloat SENSITIVITY = 0.25f;
const GLfloat NEAR_PLANE = 0.1f;
const GLfloat FAR_PLANE = 2000.0f;
const GLfloat DEFAULT_CAMDIST = 20.0f;
enum class CameraMode {
NORMAL,
AUTOSPIN,
DEATH
};
class Camera {
public:
glm::vec3 forward, up, right, worldUp;
Transform* transform;
CameraMode behavior;
Camera();
Camera(GLfloat yaw, GLfloat pitch, bool firstPerson = true);
void update(GLint mdx, GLint mdy, GLfloat delta);
void updateCameraDistance(GLfloat deltaScroll);
glm::mat4 getViewMatrix() const;
glm::mat4 getProjMatrix(GLuint w, GLuint h) const;
GLfloat getCamDist() const;
private:
GLfloat yaw;
GLfloat pitch;
GLfloat mouseSensitivity;
GLfloat camDist;
GLfloat targCamDist = DEFAULT_CAMDIST;
void updateCameraVectors();
};