Engine
Frameworkcreatedbymeusableforthecreationofsimplegames.CurrentlysupportsOpenGL(Verysimple)andVulkan.
Public Member Functions | List of all members
Engine::Camera Class Reference

This class is used for the creation of a camera. More...

#include <Camera.hpp>

Public Member Functions

 Camera ()=delete
 
 Camera (glm::vec3 position, glm::vec3 rotation, float fov, float aspectRatio, float zNear, float zFar)
 Default camera initialization. More...
 
 Camera (Camera const &other)=default
 
 Camera (Camera &&other) noexcept=default
 
 ~Camera () noexcept=default
 
Cameraoperator= (Camera const &other)=default
 
Cameraoperator= (Camera &&other) noexcept=default
 
float GetFoV () const
 
float GetAspectRatio () const
 
glm::vec2 GetClippingPlanes () const
 
glm::vec3 GetUp () const
 
glm::vec3 GetRight () const
 
glm::vec3 GetPosition () const
 
glm::vec3 GetRotation () const
 
glm::mat4x4 GetView () const
 
glm::mat4x4 GetProjection () const
 
glm::mat4x4 GetViewProjection () const
 
Frustum GetFrustum () const
 
void SetProjection (float fov, float aspectRatio, float zNear, float zFar)
 This function allows you to set the projection matrix of the camera. Automatically creates a projection matrix for you. More...
 
void SetView (glm::mat4x4 view)
 Use this method to set the view matrix yourself. More...
 
void SetViewProjection (glm::mat4x4 view, float fov, float aspectRatio, float zNear, float zFar)
 This method allows you to set the view and projection matrices of the camera. This method will simply call the SetView and SetProjection methods for you. More...
 
void UpdateFrustum (glm::vec3 right, glm::vec3 up)
 This method will create a new frustum for you based on the new right and up values. More...
 
void UpdateRotationOffset (glm::vec2 rotationOffset)
 This method can be used to update the rotation of the camera based on the defined offset. More...
 
void MoveLeft (float distanceToMove)
 This method allows you to move X distance to the left axis of the camera. More...
 
void MoveRight (float distanceToMove)
 This method allows you to move X distance to the right axis of the camera. More...
 
void MoveForwards (float distanceToMove)
 This method allows you to move X distance to the forward axis of the camera. More...
 
void MoveBackwards (float distanceToMove)
 This method allows you to move X distance to the backward axis of the camera. More...
 
void SetPostionAndRotation (glm::vec3 position, glm::vec3 rotation)
 Use this method to set the position and the rotation of the camera. More...
 
void SetPosition (glm::vec3 position)
 This method allows you to set the position of the camera. More...
 
void SetRotation (glm::vec3 rotation)
 This method allows you to set the rotation of the camera. More...
 

Detailed Description

This class is used for the creation of a camera.

Definition at line 12 of file Camera.hpp.

Constructor & Destructor Documentation

Engine::Camera::Camera ( )
delete
Engine::Camera::Camera ( glm::vec3  position,
glm::vec3  rotation,
float  fov,
float  aspectRatio,
float  zNear,
float  zFar 
)

Default camera initialization.

Parameters
positionUse this value to define the starting position of the camera.
rotationUse this value to define the starting rotation of the camera.
fovUse this value to define the field of view of the camera.
aspectRatioUse this value to define the aspect ratio of the camera.
zNearUse this value to define the minimal render distance from the camera to where it should start to render.
zFarUse this value to define the maximal render distance from the zNear value to where it should end rendering.

Definition at line 11 of file Camera.cpp.

Engine::Camera::Camera ( Camera const &  other)
default
Engine::Camera::Camera ( Camera &&  other)
defaultnoexcept
Engine::Camera::~Camera ( )
defaultnoexcept

Member Function Documentation

float Engine::Camera::GetAspectRatio ( ) const

Returns
Returns the aspect ratio of the camera.

Definition at line 27 of file Camera.cpp.

glm::vec2 Engine::Camera::GetClippingPlanes ( ) const

Returns
Returns the zNear and zFar values of the camera. The x of the vector 2 being the zNear and the y of the vector 2 being the zFar.

Definition at line 32 of file Camera.cpp.

float Engine::Camera::GetFoV ( ) const

Returns
Returns the field of view of the camera.

Definition at line 22 of file Camera.cpp.

Frustum Engine::Camera::GetFrustum ( ) const

Returns
Returns the frustrum class of the camera. Which can be used for frustum culling.

Definition at line 85 of file Camera.cpp.

glm::vec3 Engine::Camera::GetPosition ( ) const

Returns
Gets the current position of the camera.

Definition at line 58 of file Camera.cpp.

glm::mat4x4 Engine::Camera::GetProjection ( ) const

Returns
Returns the projection matrix of the camera.

Definition at line 75 of file Camera.cpp.

glm::vec3 Engine::Camera::GetRight ( ) const

Returns
Gets the right direction of the camera.

Definition at line 42 of file Camera.cpp.

glm::vec3 Engine::Camera::GetRotation ( ) const

Returns
Gets the current rotation of the camera.

Definition at line 63 of file Camera.cpp.

glm::vec3 Engine::Camera::GetUp ( ) const

Returns
Gets the up direction of the camera.

Definition at line 37 of file Camera.cpp.

glm::mat4x4 Engine::Camera::GetView ( ) const

Returns
Returns the view matrix of the camera.

Definition at line 68 of file Camera.cpp.

glm::mat4x4 Engine::Camera::GetViewProjection ( ) const

Returns
Returns the view * projection matrices.

Definition at line 80 of file Camera.cpp.

void Engine::Camera::MoveBackwards ( float  distanceToMove)

This method allows you to move X distance to the backward axis of the camera.

Parameters
distanceToMoveexpected value is postitive value of (camera movement speed * deltaTime)

Definition at line 145 of file Camera.cpp.

void Engine::Camera::MoveForwards ( float  distanceToMove)

This method allows you to move X distance to the forward axis of the camera.

Parameters
distanceToMoveexpected value is postitive value of (camera movement speed * deltaTime)

Definition at line 139 of file Camera.cpp.

void Engine::Camera::MoveLeft ( float  distanceToMove)

This method allows you to move X distance to the left axis of the camera.

Parameters
distanceToMoveexpected value is postitive value of (camera movement speed * deltaTime)

Definition at line 127 of file Camera.cpp.

void Engine::Camera::MoveRight ( float  distanceToMove)

This method allows you to move X distance to the right axis of the camera.

Parameters
distanceToMoveexpected value is postitive value of (camera movement speed * deltaTime)

Definition at line 133 of file Camera.cpp.

Camera& Engine::Camera::operator= ( Camera const &  other)
default
Camera& Engine::Camera::operator= ( Camera &&  other)
defaultnoexcept
void Engine::Camera::SetPosition ( glm::vec3  position)

This method allows you to set the position of the camera.

Parameters
positionThe new postion you want to use.

Definition at line 157 of file Camera.cpp.

void Engine::Camera::SetPostionAndRotation ( glm::vec3  position,
glm::vec3  rotation 
)

Use this method to set the position and the rotation of the camera.

Parameters
positionThis value is used to define the new position of the camera.
rotationThis value isu sed to define the new rotation of the camera.

Definition at line 151 of file Camera.cpp.

void Engine::Camera::SetProjection ( float  fov,
float  aspectRatio,
float  zNear,
float  zFar 
)

This function allows you to set the projection matrix of the camera. Automatically creates a projection matrix for you.

Parameters
fovUse this value to define the field of view of the camera.
aspectRatioUse this value to define the aspect ratio of the camera.
zNearUse this value to define the minimal render distance from the camera to where it should start to render.
zFarUse this value to define the maximal render distance from the zNear value to where it should end rendering.

Definition at line 90 of file Camera.cpp.

void Engine::Camera::SetRotation ( glm::vec3  rotation)

This method allows you to set the rotation of the camera.

Parameters
rotationThe new rotation you want to use.

Definition at line 162 of file Camera.cpp.

void Engine::Camera::SetView ( glm::mat4x4  view)

Use this method to set the view matrix yourself.

Parameters
viewThe new view matrix for the camera.

Definition at line 100 of file Camera.cpp.

void Engine::Camera::SetViewProjection ( glm::mat4x4  view,
float  fov,
float  aspectRatio,
float  zNear,
float  zFar 
)

This method allows you to set the view and projection matrices of the camera. This method will simply call the SetView and SetProjection methods for you.

Parameters
viewThe new view matrix for the camera.
fovUse this value to define the field of view of the camera.
aspectRatioUse this value to define the aspect ratio of the camera.
zNearUse this value to define the minimal render distance from the camera to where it should start to render.
zFarUse this value to define the maximal render distance from the zNear value to where it should end rendering.

Definition at line 105 of file Camera.cpp.

void Engine::Camera::UpdateFrustum ( glm::vec3  right,
glm::vec3  up 
)

This method will create a new frustum for you based on the new right and up values.

Parameters
rightThe right direction of the new frustrum
upThe up direction of the new frustrum

Definition at line 111 of file Camera.cpp.

void Engine::Camera::UpdateRotationOffset ( glm::vec2  rotationOffset)

This method can be used to update the rotation of the camera based on the defined offset.

Parameters
rotationOffset

Definition at line 116 of file Camera.cpp.


The documentation for this class was generated from the following files: