-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCamera.hpp
More file actions
59 lines (42 loc) · 1.47 KB
/
Camera.hpp
File metadata and controls
59 lines (42 loc) · 1.47 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
#ifndef CAMERA_HPP
#define CAMERA_HPP
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
namespace VoxelEngine
{
class Camera {
public:
Camera(glm::vec3 position, float yaw, float pitch,
float fovDeg, float aspectRatio, float nearPlane, float farPlane);
void SetPerspective(float fovDeg, float aspectRatio, float nearPlane, float farPlane);
void ProcessKeyboard(float deltaTime);
void ProcessMouseMovement();
void SetMovementSpeed(float speed) { MovementSpeed = speed; }
void SetMouseSensitivity(float sensitivity) { MouseSensitivity = sensitivity; }
const glm::mat4& GetViewMatrix() const { return viewMatrix; }
const glm::mat4& GetProjectionMatrix() const { return projectionMatrix; }
const glm::mat4& GetViewProjectionMatrix() const { return viewProjectionMatrix; }
glm::vec3 GetPosition() const { return Position; }
glm::vec3 GetForward() const { return Front; }
float GetYaw() const { return Yaw; }
float GetPitch() const { return Pitch; }
private:
void UpdateCameraVectors();
void UpdateViewMatrix();
void UpdateProjectionMatrix();
glm::vec3 Position;
glm::vec3 Front;
glm::vec3 Up;
glm::vec3 Right;
glm::vec3 WorldUp = glm::vec3(0.0f, 1.0f, 0.0f);
float Yaw, Pitch;
float MovementSpeed = 3.0f;
float MouseSensitivity = 0.1f;
float FovDeg, AspectRatio, NearPlane, FarPlane;
glm::mat4 viewMatrix;
glm::mat4 projectionMatrix;
glm::mat4 viewProjectionMatrix;
};
}
#endif