| Fling Engine 0.00.1 Fling Engine is a game engine written in Vulkan

Camera.h
Go to the documentation of this file.
1 #pragma once
2 #include "FlingMath.h"
3
4 namespace Fling
5 {
10 class Camera
11 {
12 public:
13 Camera() :
14 m_nearPlane(0.1f),
15 m_farPlane(1000.0f),
16 m_fieldOfView(glm::radians(45.0f)),
17 m_aspectRatio(1.6180f) //golden ratio
18 {
19 }
20
21 virtual ~Camera() = default;
22 virtual void Update(float dt) = 0;
23
29 const float GetNearPlane() const { return m_nearPlane; }
30 void SetNearPlane(const float& nearPlane) { m_nearPlane = nearPlane; }
31
37 const float GetFarPlane() const { return m_farPlane; }
38 void SetFarPlane(const float& farPlane) { m_farPlane = farPlane; }
39
45 const float GetFieldOfView() const { return m_fieldOfView; }
46 void SetFieldOfView(const float& fieldOfView) { m_fieldOfView = fieldOfView; }
47
48 const glm::vec3& GetPosition() const { return m_position; }
49 const glm::vec3& GetRotation() const { return m_rotation; }
50 const float GetSpeed() const { return m_speed; }
51 const float GetAspectRatio() const { return m_aspectRatio; }
52
58 const glm::mat4& GetViewMatrix() const {return m_viewMatrix; }
59
65 const glm::mat4& GetProjectionMatrix() const { return m_projectionMatrix; }
66
67 float GetGamma() const { return m_Gamma; }
68 void SetGamma(float t_Gam) { m_Gamma = t_Gam; }
69
70 float GetExposure() const { return m_Exposure; }
71 void SetExposure(float t_Val) { m_Exposure = t_Val; }
72
73 protected:
74 glm::mat4 m_viewMatrix;
75 glm::mat4 m_projectionMatrix;
76
77 glm::vec3 m_position;
78 float m_speed; //padding 12 + 4 = 16
79
80 glm::vec3 m_rotation;
81 float m_aspectRatio;
82
83 float m_nearPlane;
84 float m_farPlane;
85 float m_fieldOfView;
86
87 float m_Gamma = 2.2f;
88 float m_Exposure = 4.5f;
89 };
90 } //namespace fling
Fling::Camera::GetGamma
float GetGamma() const
Definition: Camera.h:67
Fling::Camera::m_position
glm::vec3 m_position
Definition: Camera.h:77
Fling::Camera::m_fieldOfView
float m_fieldOfView
Definition: Camera.h:85
Fling::Camera::m_speed
float m_speed
Definition: Camera.h:78
Fling::Camera::m_farPlane
float m_farPlane
Definition: Camera.h:84
Fling::Camera::m_viewMatrix
glm::mat4 m_viewMatrix
Definition: Camera.h:74
Fling::Camera
Base class for camera, meant to be overridden.
Definition: Camera.h:10
Fling::Camera::GetRotation
const glm::vec3 & GetRotation() const
Definition: Camera.h:49
Fling::Camera::SetGamma
void SetGamma(float t_Gam)
Definition: Camera.h:68
Fling::Camera::m_rotation
glm::vec3 m_rotation
Definition: Camera.h:80
Fling::Camera::m_nearPlane
float m_nearPlane
Definition: Camera.h:83
Fling::Camera::m_Exposure
float m_Exposure
Definition: Camera.h:88
Fling::Camera::GetAspectRatio
const float GetAspectRatio() const
Definition: Camera.h:51
FlingMath.h
Fling::Camera::SetNearPlane
void SetNearPlane(const float &nearPlane)
Definition: Camera.h:30
Fling::Camera::GetNearPlane
const float GetNearPlane() const
Gets the near plane of the view frustrum.
Definition: Camera.h:29
Fling::Camera::GetPosition
const glm::vec3 & GetPosition() const
Definition: Camera.h:48
Fling::Camera::m_projectionMatrix
glm::mat4 m_projectionMatrix
Definition: Camera.h:75
Fling::Camera::~Camera
virtual ~Camera()=default
Fling::Camera::GetProjectionMatrix
const glm::mat4 & GetProjectionMatrix() const
Gets the projection matrix used by camera.
Definition: Camera.h:65
Fling::Camera::Update
virtual void Update(float dt)=0
Fling::Camera::GetFieldOfView
const float GetFieldOfView() const
Gets the field of view angle from the view frustrum.
Definition: Camera.h:45
Fling::Camera::SetFieldOfView
void SetFieldOfView(const float &fieldOfView)
Definition: Camera.h:46
Fling::Camera::GetSpeed
const float GetSpeed() const
Definition: Camera.h:50
Fling::Camera::GetViewMatrix
const glm::mat4 & GetViewMatrix() const
Gets the view matrix created by the current camera position and rotation.
Definition: Camera.h:58
Fling::Camera::SetExposure
void SetExposure(float t_Val)
Definition: Camera.h:71
Fling::Camera::SetFarPlane
void SetFarPlane(const float &farPlane)
Definition: Camera.h:38
Fling::Camera::GetFarPlane
const float GetFarPlane() const
Gets the far plane of the view frustrum.
Definition: Camera.h:37
Fling::Camera::m_aspectRatio
float m_aspectRatio
Definition: Camera.h:81
Fling
Definition: Engine.h:29
Fling::Camera::m_Gamma
float m_Gamma
Definition: Camera.h:87
Fling::Camera::GetExposure
float GetExposure() const
Definition: Camera.h:70
Fling::Camera::Camera
Camera()
Definition: Camera.h:13