33 lines
957 B
C++
33 lines
957 B
C++
#pragma once
|
|
|
|
#include <glm/glm.hpp>
|
|
#include <glm/gtc/matrix_transform.hpp>
|
|
|
|
namespace TSR {
|
|
|
|
class Camera {
|
|
glm::vec3 world_up;
|
|
void UpdateVectors();
|
|
|
|
public:
|
|
glm::vec3 forward_backward_vector;
|
|
glm::vec3 front_vector;
|
|
glm::vec3 up_vector;
|
|
glm::vec3 right_vector;
|
|
|
|
enum class Movement { FORWARD, BACKWARD, LEFT, RIGHT, UP, DOWN };
|
|
|
|
glm::vec3 position;
|
|
float yaw;
|
|
float pitch;
|
|
float movement_speed;
|
|
float mouse_sensitivity;
|
|
float third_person_distance;
|
|
|
|
Camera(glm::vec3 i_position = glm::vec3(0.0f), float i_movement_speed = 20.0f, float i_mouse_sensitivity = 0.1f, float i_third_person_distance = 0.0f, float i_yaw = 0.0f, float i_pitch = 0.0f);
|
|
glm::mat4 GetViewMatrix(bool firstperson = false);
|
|
void ProcessMovement(Movement direction, float time);
|
|
void ProcessMouse(float x_offset, float y_offset);
|
|
|
|
};
|
|
} |