My Project
Loading...
Searching...
No Matches
Camera Class Referenceabstract

Base camera class used to handle camera transformations, movement, and view/projection matrix generation. This class provides common camera functionality and must be inherited to implement specific camera behaviors. More...

#include <Camera.hpp>

Inheritance diagram for Camera:
EditorCamera

Public Member Functions

 Camera ()
 Default camera constructor.
virtual void Update (Engine::InputManager &input)=0
 Updates the camera state. Must be implemented by derived camera classes.
float ToRadians (float degree)
 Converts degrees to radians.
Maths::Mat4f Getprojection () const
 Returns the projection matrix.
Maths::Mat4f Getview () const
 Returns the view matrix.
Maths::Mat4f GetVP () const
 Returns the combined View-Projection matrix.

Protected Member Functions

void RotationUpdate (Engine::InputManager &input)
 Updates the camera rotation based on mouse input.
void FowardUpdate ()
 Updates the forward vector based on the current camera rotation.
void RightUpdate ()
 Updates the right vector based on the camera orientation.
void UpUpdate ()
 Updates the up vector based on the camera orientation.
void ProjectionMatrix ()
 Calculates the projection matrix using perspective projection.
void ViewMatrix ()
 Calculates the view matrix transforming world space to camera space.
void VPMatrix ()
 Updates the View-Projection matrix.
void MouseUpdate (Engine::InputManager &input)
 Updates camera rotation using mouse movement.
void MoveUpdate (Engine::InputManager &input)
 Updates camera position based on keyboard input.
void GlobalUpdate (Engine::InputManager &input)
 Updates the global camera state including movement, rotation, and matrix calculations.

Protected Attributes

Maths::Vec3f position
 Position of the camera in world space.
Maths::Quatf rotation
 Rotation of the camera represented as a quaternion.
Maths::Vec3f forward
 Forward direction vector of the camera.
Maths::Vec3f right
 Right direction vector of the camera.
Maths::Vec3f up
 Up direction vector of the camera.
float aspectRatio
 Aspect ratio of the camera viewport.
float nearPlane
 Near clipping plane distance.
float farPlane
 Far clipping plane distance.
float fov
 Field of view in degrees.
float moveSpeed = 0.5f
 Camera movement speed.
float sensitivity = 0.01f
 Mouse sensitivity used for camera rotation.
bool firstMousePos = true
 Indicates whether the first mouse position has been recorded.
Maths::Mat4f projection
 Projection matrix used for perspective transformation.
Maths::Mat4f view
 View matrix used to transform world coordinates into camera space.
Maths::Mat4f VP
 Combined View-Projection matrix (Projection * View).

Detailed Description

Base camera class used to handle camera transformations, movement, and view/projection matrix generation. This class provides common camera functionality and must be inherited to implement specific camera behaviors.

Constructor & Destructor Documentation

◆ Camera()

Camera::Camera ( )

Default camera constructor.

Member Function Documentation

◆ FowardUpdate()

void Camera::FowardUpdate ( )
protected

Updates the forward vector based on the current camera rotation.

◆ Getprojection()

Maths::Mat4f Camera::Getprojection ( ) const

Returns the projection matrix.

Returns
Projection matrix

◆ Getview()

Maths::Mat4f Camera::Getview ( ) const

Returns the view matrix.

Returns
View matrix

◆ GetVP()

Maths::Mat4f Camera::GetVP ( ) const

Returns the combined View-Projection matrix.

Returns
View-Projection matrix

◆ GlobalUpdate()

void Camera::GlobalUpdate ( Engine::InputManager & input)
protected

Updates the global camera state including movement, rotation, and matrix calculations.

Parameters
inputInput manager used for camera control

◆ MouseUpdate()

void Camera::MouseUpdate ( Engine::InputManager & input)
protected

Updates camera rotation using mouse movement.

Parameters
inputInput manager used to retrieve mouse input

◆ MoveUpdate()

void Camera::MoveUpdate ( Engine::InputManager & input)
protected

Updates camera position based on keyboard input.

Parameters
inputInput manager used to retrieve keyboard input

◆ ProjectionMatrix()

void Camera::ProjectionMatrix ( )
protected

Calculates the projection matrix using perspective projection.

◆ RightUpdate()

void Camera::RightUpdate ( )
protected

Updates the right vector based on the camera orientation.

◆ RotationUpdate()

void Camera::RotationUpdate ( Engine::InputManager & input)
protected

Updates the camera rotation based on mouse input.

Parameters
inputInput manager used to retrieve mouse input

◆ ToRadians()

float Camera::ToRadians ( float degree)

Converts degrees to radians.

Parameters
degreeAngle in degrees
Returns
Angle in radians

◆ Update()

virtual void Camera::Update ( Engine::InputManager & input)
pure virtual

Updates the camera state. Must be implemented by derived camera classes.

Parameters
inputInput manager used to control the camera

Implemented in EditorCamera.

◆ UpUpdate()

void Camera::UpUpdate ( )
protected

Updates the up vector based on the camera orientation.

◆ ViewMatrix()

void Camera::ViewMatrix ( )
protected

Calculates the view matrix transforming world space to camera space.

◆ VPMatrix()

void Camera::VPMatrix ( )
protected

Updates the View-Projection matrix.

Member Data Documentation

◆ aspectRatio

float Camera::aspectRatio
protected

Aspect ratio of the camera viewport.

◆ farPlane

float Camera::farPlane
protected

Far clipping plane distance.

◆ firstMousePos

bool Camera::firstMousePos = true
protected

Indicates whether the first mouse position has been recorded.

◆ forward

Maths::Vec3f Camera::forward
protected

Forward direction vector of the camera.

◆ fov

float Camera::fov
protected

Field of view in degrees.

◆ moveSpeed

float Camera::moveSpeed = 0.5f
protected

Camera movement speed.

◆ nearPlane

float Camera::nearPlane
protected

Near clipping plane distance.

◆ position

Maths::Vec3f Camera::position
protected

Position of the camera in world space.

◆ projection

Maths::Mat4f Camera::projection
protected

Projection matrix used for perspective transformation.

◆ right

Maths::Vec3f Camera::right
protected

Right direction vector of the camera.

◆ rotation

Maths::Quatf Camera::rotation
protected

Rotation of the camera represented as a quaternion.

◆ sensitivity

float Camera::sensitivity = 0.01f
protected

Mouse sensitivity used for camera rotation.

◆ up

Maths::Vec3f Camera::up
protected

Up direction vector of the camera.

◆ view

Maths::Mat4f Camera::view
protected

View matrix used to transform world coordinates into camera space.

◆ VP

Maths::Mat4f Camera::VP
protected

Combined View-Projection matrix (Projection * View).


The documentation for this class was generated from the following file:
  • Engine/Components/UserComponents/Headers/Camera/Camera.hpp