Fireworks Engine  v2.0
Lightweight Sandbox Game Engine using OpenGL for additional Customisation and Quick Prototyping
perspectivecamera.h
Go to the documentation of this file.
1 #pragma once
2 
3 // Std. Includes
4 #include <vector>
5 
6 // GLM
7 #include <glm/glm.hpp>
8 #include <glm/gtc/matrix_transform.hpp>
9 #include <glm/gtx/string_cast.hpp>
10 
11 #include <glm/glm.hpp>
12 
13 namespace fireworks { namespace graphics {
14 
17  {
18  public:
20  glm::vec3 position;
22  glm::vec3 camFront;
24  glm::vec3 camUp;
26  glm::vec3 camRight;
28  glm::vec3 worldUp;
30  float FOV;
32  float aspectRatio;
34  float nearClipping;
36  float farClipping;
38  float yaw;
40  float pitch;
41  private:
42  glm::mat4 m_ViewMatrix;
43  glm::mat4 m_ProjectionsMatrix;
44  glm::mat4 m_ViewProjectionMatrix;
45  public:
52  PerspectiveCamera(glm::vec3 position = glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3 worldUp = glm::vec3(0.0f, 1.0f, 0.0f), float aspectRatio = 1.33f, float fov = 45.0f);
61  PerspectiveCamera(float posX, float posY, float posZ, float upX, float upY, float upZ);
62 
64  const glm::mat4& getViewMatrix() { updateViewMatrix(); return m_ViewMatrix; }
66  const glm::mat4& getProjectionMatrix() const { return m_ProjectionsMatrix;}
68  const glm::mat4& getViewProjectionsMatrix() const { return m_ViewProjectionMatrix;}
69  protected:
70  void updateCameraVectors();
71  void updateViewMatrix();
73  };
74 
75 } }
76 
const glm::mat4 & getViewMatrix()
Gets the reference to the camera&#39;s view matrix.
Definition: perspectivecamera.h:64
void updateViewMatrix()
Definition: perspectivecamera.cpp:40
void updateProjectionMatrix()
Definition: perspectivecamera.cpp:45
float farClipping
far clipping distance of the camera
Definition: perspectivecamera.h:36
float FOV
Field of view angle of the camera.
Definition: perspectivecamera.h:30
glm::vec3 camUp
The up vector of the camera.
Definition: perspectivecamera.h:24
float nearClipping
near clipping distance of the camera
Definition: perspectivecamera.h:34
float yaw
The yaw angle of the camera in world space.
Definition: perspectivecamera.h:38
Definition: audioclip.cpp:3
glm::vec3 worldUp
The world up vector.
Definition: perspectivecamera.h:28
glm::vec3 position
The position of the camera in 3d space.
Definition: perspectivecamera.h:20
PerspectiveCamera(glm::vec3 position=glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3 worldUp=glm::vec3(0.0f, 1.0f, 0.0f), float aspectRatio=1.33f, float fov=45.0f)
Creates a perspective camera.
Definition: perspectivecamera.cpp:5
glm::vec3 camRight
The right vector of the camera.
Definition: perspectivecamera.h:26
const glm::mat4 & getViewProjectionsMatrix() const
Gets the reference to the camera&#39;s ViewProjections matrix.
Definition: perspectivecamera.h:68
float pitch
The pitch angle of the camera in world space.
Definition: perspectivecamera.h:40
void updateCameraVectors()
Definition: perspectivecamera.cpp:25
A perspective camera to view objects in perspective projection.
Definition: perspectivecamera.h:16
const glm::mat4 & getProjectionMatrix() const
Gets the reference to the camera&#39;s projection matrix.
Definition: perspectivecamera.h:66
glm::vec3 camFront
The front vector of the camera.
Definition: perspectivecamera.h:22
float aspectRatio
Camera view&#39;s aspect ratio.
Definition: perspectivecamera.h:32