-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlve_camera.hpp
More file actions
31 lines (26 loc) · 1.13 KB
/
lve_camera.hpp
File metadata and controls
31 lines (26 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once
// libs
#define GLM_FORCE_RADIANS
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
#include <glm/glm.hpp>
namespace lve {
class LveCamera {
public:
void setOrthographicProjection(
float left, float right, float top, float bottom, float near, float far);
void setPerspectiveProjection(float fovy, float aspect, float near, float far);
void setViewDirection(
glm::vec3 position, glm::vec3 direction, glm::vec3 up = glm::vec3{ 0.f, -1.f, 0.f });
void setViewTarget(
glm::vec3 position, glm::vec3 target, glm::vec3 up = glm::vec3{ 0.f, -1.f, 0.f });
void setViewYXZ(glm::vec3 position, glm::vec3 rotation);
const glm::mat4& getProjection() const { return projectionMatrix; }
const glm::mat4& getView() const { return viewMatrix; }
const glm::mat4& getInverseView() const { return inverseViewMatrix; }
const glm::vec3 getPosition() const { return glm::vec3(inverseViewMatrix[3]); }
private:
glm::mat4 projectionMatrix{ 1.f };
glm::mat4 viewMatrix{ 1.f };
glm::mat4 inverseViewMatrix{ 1.f };
};
} // namespace lve