mirror of
https://github.com/guezoloic/LearnOpenGL.git
synced 2026-01-25 12:34:15 +00:00
feat(camera): add camera file
This commit is contained in:
44
inc/camera.hpp
Executable file
44
inc/camera.hpp
Executable file
@@ -0,0 +1,44 @@
|
||||
#ifndef CAMERA_HPP
|
||||
#define CAMERA_HPP
|
||||
|
||||
#include <glfw/glfw3.h>
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
|
||||
class Camera {
|
||||
private:
|
||||
int screenWidth;
|
||||
int screenHeight;
|
||||
|
||||
double mousePosX;
|
||||
double mousePosY;
|
||||
bool firstMouse = true;
|
||||
|
||||
float cameraYaw;
|
||||
float cameraPitch;
|
||||
|
||||
glm::vec3 cameraFront;
|
||||
glm::vec3 cameraUp;
|
||||
glm::vec3 cameraRight;
|
||||
glm::vec3 worldUp;
|
||||
|
||||
GLFWwindow* window;
|
||||
|
||||
void processInput(float deltaTime);
|
||||
void processMouseMovement();
|
||||
void updateCameraVectors();
|
||||
|
||||
public:
|
||||
Camera(int width, int height, GLFWwindow* window, float sensitivity);
|
||||
|
||||
void update(float deltaTime);
|
||||
glm::mat4 getViewMatrix();
|
||||
|
||||
float speed;
|
||||
float cameraSensitivity;
|
||||
float fov;
|
||||
|
||||
glm::vec3 cameraPosition;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user