camera
This commit is contained in:
32
inc/engine/camera.hpp
Normal file
32
inc/engine/camera.hpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef CAMERA_HPP
|
||||
#define CAMERA_HPP
|
||||
|
||||
// Includes
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
|
||||
// Camera Class
|
||||
class Camera {
|
||||
public:
|
||||
Camera(const glm::vec3& position, const glm::vec3& target, const glm::vec3& up);
|
||||
|
||||
glm::mat4 getViewMatrix() const;
|
||||
glm::mat4 getProjectionMatrix() const;
|
||||
void setProjectionMatrix(float fov, float aspectRatio, float nearPlane, float farPlane);
|
||||
void setPosition(const glm::vec3& position);
|
||||
void setTarget(const glm::vec3& target);
|
||||
void setUp(const glm::vec3& up);
|
||||
glm::vec3 getPosition() const;
|
||||
|
||||
float fov = 45.0f;
|
||||
|
||||
private:
|
||||
glm::vec3 position;
|
||||
glm::vec3 target;
|
||||
glm::vec3 up;
|
||||
float aspectRatio = 4.0f / 3.0f;
|
||||
float nearPlane = 0.1f;
|
||||
float farPlane = 100.0f;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "engine/sdl.hpp"
|
||||
#include "engine/buffers.hpp"
|
||||
#include "engine/shaders.hpp"
|
||||
#include "engine/camera.hpp"
|
||||
|
||||
// OpenGL Context Class
|
||||
class OpenGLContext {
|
||||
|
||||
Reference in New Issue
Block a user