Engine
Frameworkcreatedbymeusableforthecreationofsimplegames.CurrentlysupportsOpenGL(Verysimple)andVulkan.
Camera.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Engine/api.hpp"
5 #include <ThirdParty/glm/glm/glm.hpp>
6 
7 namespace Engine
8 {
13  {
14  public:
15 
16  Camera() = delete;
26  Camera(glm::vec3 position, glm::vec3 rotation, float fov, float aspectRatio, float zNear, float zFar);
27  Camera(Camera const &other) = default;
28  Camera(Camera &&other) noexcept = default;
29  ~Camera() noexcept = default;
30 
31  Camera &operator=(Camera const &other) = default;
32  Camera &operator=(Camera &&other) noexcept = default;
33 
38  float GetFoV() const;
43  float GetAspectRatio() const;
48  glm::vec2 GetClippingPlanes() const;
53  glm::vec3 GetUp() const;
58  glm::vec3 GetRight() const;
63  glm::vec3 GetPosition() const;
68  glm::vec3 GetRotation() const;
73  glm::mat4x4 GetView() const;
78  glm::mat4x4 GetProjection() const;
83  glm::mat4x4 GetViewProjection() const;
88  Frustum GetFrustum() const;
89 
97  void SetProjection(float fov, float aspectRatio, float zNear, float zFar);
98 
103  void SetView(glm::mat4x4 view);
104 
113  void SetViewProjection(glm::mat4x4 view, float fov, float aspectRatio, float zNear, float zFar);
114 
120  void UpdateFrustum(glm::vec3 right, glm::vec3 up);
121 
126  void UpdateRotationOffset(glm::vec2 rotationOffset);
127 
132  void MoveLeft(float distanceToMove);
133 
138  void MoveRight(float distanceToMove);
139 
144  void MoveForwards(float distanceToMove);
145 
150  void MoveBackwards(float distanceToMove);
151 
157  void SetPostionAndRotation(glm::vec3 position, glm::vec3 rotation);
158 
163  void SetPosition(glm::vec3 position);
164 
169  void SetRotation(glm::vec3 rotation);
170 
171  private:
172  float fov;
173  float aspectRatio;
174  float horizontalAngle;
175  float verticalAngle;
176  glm::vec2 clippingPlanes;
177  glm::vec3 position;
178  glm::vec3 rotation;
179  glm::mat4x4 view;
180  glm::mat4x4 projection;
181  Frustum frustum;
182  };
183 } // namespace Engine
#define ENGINE_API
Definition: api.hpp:25
This class is used for the creation of a camera.
Definition: Camera.hpp:12
This object is used to keep track of the frustum area of the view and projection matrix. NOTE: only the Camera class is allowed to create this object.
Definition: Frustum.hpp:12