restructure v2
This commit is contained in:
parent
e01595e155
commit
dc5654ba9a
20 changed files with 910 additions and 791 deletions
51
engine/Backend/Camera.h
Normal file
51
engine/Backend/Camera.h
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Shader.h"
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
// Movement keys/buttons
|
||||
enum Camera_Movement {
|
||||
FORWARD,
|
||||
BACKWARD,
|
||||
LEFT,
|
||||
RIGHT,
|
||||
SPRINT
|
||||
};
|
||||
|
||||
// Default camera values
|
||||
const float YAW = -90.0f;
|
||||
const float PITCH = 0.0f;
|
||||
const float SPEED = 5.5f;
|
||||
const float SENSITIVITY = 0.1f;
|
||||
const float ZOOM = 45.0f;
|
||||
|
||||
class Camera
|
||||
{
|
||||
public:
|
||||
glm::vec3 position, front, up, right, worldUp;
|
||||
float yaw, pitch;
|
||||
float movementSpeed, mouseSensitivity, zoom;
|
||||
bool sprinting = false;
|
||||
|
||||
// constructor with vectors
|
||||
Camera(glm::vec3 newPosition = glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3 up = glm::vec3(0.0f, 1.0f, 0.0f), float newYaw = YAW, float newPitch = PITCH); // constructor with scalar values
|
||||
Camera(float posX, float posY, float posZ, float upX, float upY, float upZ, float newYaw, float newPitch);
|
||||
// returns the view matrix calculated using Euler Angles and the LookAt Matrix
|
||||
glm::mat4 GetViewMatrix();
|
||||
// processes input received from any keyboard-like input system. Accepts input parameter in the form of camera defined ENUM (to abstract it from windowing systems)
|
||||
void processKeyboard(Camera_Movement direction, float deltaTime);
|
||||
// processes input received from a mouse input system. Expects the offset value in both the x and y direction.
|
||||
void processMouseMovement(float xoffset, float yoffset, GLboolean constrainPitch = true);
|
||||
|
||||
// processes input received from a mouse scroll-wheel event. Only requires input on the vertical wheel-axis
|
||||
void processMouseScroll(float yoffset);
|
||||
void Update(Shader shader, int screenWidth, int screenHeight);
|
||||
|
||||
private:
|
||||
// calculates the front vector from the Camera's (updated) Euler Angles
|
||||
void updateCameraVectors();
|
||||
};
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue