28 lines
476 B
C++
28 lines
476 B
C++
#pragma once
|
|
|
|
#include "glm/glm.hpp"
|
|
#include "glm/gtc/matrix_transform.hpp"
|
|
#include <numbers>
|
|
|
|
struct camera_view
|
|
{
|
|
glm::vec3 position;
|
|
glm::vec3 front;
|
|
glm::vec3 right;
|
|
glm::vec3 up;
|
|
float aspect_ratio;
|
|
float fov;
|
|
|
|
[[nodiscard]] glm::mat4 create_view_matrix() const {
|
|
return glm::lookAt(position, position + front, up);
|
|
}
|
|
|
|
[[nodiscard]] glm::mat4 create_projection_matrix() const {
|
|
return glm::perspective(
|
|
fov,
|
|
aspect_ratio,
|
|
0.1f, 1000.0f
|
|
);
|
|
}
|
|
};
|