49 lines
1.2 KiB
C++
49 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include "InputMap.hpp"
|
|
|
|
#include <GL/glew.h>
|
|
#include <GLFW/glfw3.h>
|
|
#include "../data/glm.hpp"
|
|
|
|
/// Moving perspective camera
|
|
class Camera {
|
|
public:
|
|
Camera(GLFWwindow*, const InputMap&);
|
|
Camera(Camera &&) = default;
|
|
Camera(const Camera &) = default;
|
|
Camera &operator=(Camera &&) = default;
|
|
Camera &operator=(const Camera &) = default;
|
|
~Camera();
|
|
|
|
void update(bool captureMouse, bool captureKeys);
|
|
void updateProjection();
|
|
|
|
glm::vec3 getDirection() const { return glm::vec3(cos(VerticalAngle) * sin(HorizontalAngle), sin(VerticalAngle), cos(VerticalAngle) * cos(HorizontalAngle)); }
|
|
|
|
glm::mat4 getViewMatrix() const { return ViewMatrix; }
|
|
glm::mat4 getProjectionMatrix() const { return ProjectionMatrix; }
|
|
camera_pos getPosition() const { return Position; }
|
|
|
|
float FoV = glm::radians(70.f);
|
|
float Near = 0.1;
|
|
float Far = 64;
|
|
|
|
float Speed = 5.0f;
|
|
int Sensibility = 50;
|
|
|
|
private:
|
|
GLFWwindow *window;
|
|
const InputMap &inputs;
|
|
|
|
glm::mat4 ViewMatrix;
|
|
glm::mat4 ProjectionMatrix;
|
|
|
|
camera_pos Position = glm::vec3(0, 0, 5);
|
|
|
|
float HorizontalAngle = 3.14f;
|
|
float VerticalAngle = 0.0f;
|
|
|
|
bool capturingMouse = false;
|
|
};
|