vengine  0.1.0
3D graphics engine made with Vulkan
Loading...
Searching...
No Matches
Camera.hpp
Go to the documentation of this file.
1///
2/// @file Camera.hpp
3/// @brief This file contains the Camera class
4/// @namespace ven
5///
6
7#pragma once
8
9#define GLM_FORCE_RADIANS
10#define GLM_FORCE_DEPTH_ZERO_TO_ONE
11#include <glm/glm.hpp>
12
13namespace ven {
14
15///
16
17 class Camera {
18
19 public:
20
21 void setOrthographicProjection(float left, float right, float top, float bottom, float near, float far);
22 void setPerspectiveProjection(float fovy, float aspect, float near, float far);
23 void setViewDirection(glm::vec3 position, glm::vec3 direction, glm::vec3 up = glm::vec3{0.F, -1.F, 0.F});
24 void setViewTarget(glm::vec3 position, glm::vec3 target, glm::vec3 up = glm::vec3{0.F, -1.F, 0.F}) { setViewDirection(position, target - position, up); }
25 void setViewYXZ(glm::vec3 position, glm::vec3 rotation);
26
27 [[nodiscard]] const glm::mat4& getProjection() const { return m_projectionMatrix; }
28 [[nodiscard]] const glm::mat4& getView() const { return m_viewMatrix; }
29 [[nodiscard]] const glm::mat4& getInverseView() const { return m_inverseViewMatrix; }
30
31 private:
32
33 glm::mat4 m_projectionMatrix{1.F};
34 glm::mat4 m_viewMatrix{1.F};
35 glm::mat4 m_inverseViewMatrix{1.F};
36
37 }; // class Camera
38
39} // namespace ven
void setViewYXZ(glm::vec3 position, glm::vec3 rotation)
Definition camera.cpp:64
const glm::mat4 & getView() const
Definition Camera.hpp:28
const glm::mat4 & getInverseView() const
Definition Camera.hpp:29
glm::mat4 m_inverseViewMatrix
Definition Camera.hpp:35
const glm::mat4 & getProjection() const
Definition Camera.hpp:27
glm::mat4 m_projectionMatrix
Definition Camera.hpp:33
void setViewTarget(glm::vec3 position, glm::vec3 target, glm::vec3 up=glm::vec3{0.F, -1.F, 0.F})
Definition Camera.hpp:24
glm::mat4 m_viewMatrix
Definition Camera.hpp:34
void setOrthographicProjection(float left, float right, float top, float bottom, float near, float far)
Definition camera.cpp:6
void setPerspectiveProjection(float fovy, float aspect, float near, float far)
Definition camera.cpp:17
void setViewDirection(glm::vec3 position, glm::vec3 direction, glm::vec3 up=glm::vec3{0.F, -1.F, 0.F})
Definition camera.cpp:29