Raftel Engine
 
Loading...
Searching...
No Matches
Raftel::Camera Class Reference

Camera class for handling movement and view transformations. More...

#include <camera.hpp>

Public Member Functions

 Camera (Raftel::Window *w)
 Constructs a Camera object.
 
float getMovementSpeed () const
 Gets the current movement speed of the camera.
 
glm::vec3 getPosition () const
 Gets the current position of the camera.
 
glm::vec3 getRotation () const
 Gets the current rotation of the camera.
 
glm::mat4 getViewMatrix () const
 Gets the view matrix of the camera.
 
glm::mat4 getProjectionMatrix () const
 Gets the projection matrix of the camera.
 
void SetPosition (const glm::vec3 &position)
 Sets the position of the camera.
 
void SetRotation (const glm::vec3 &rotation)
 Sets the rotation of the camera.
 
void Update (const std::unique_ptr< Window > &window)
 Updates the camera's transformation matrices.
 
void setUniforms (ShaderProgram &prg)
 Sets shader uniforms related to the camera.
 
void Translate (const glm::vec3 &translation)
 Moves the camera by a given translation vector.
 
void Rotate (float angle, const glm::vec3 &axis)
 Rotates the camera around an axis.
 
void SetState (CameraState newState, GLFWwindow *window)
 Sets the camera state.
 
CameraState GetState () const
 Gets the current camera state.
 
void ToggleState (Raftel::Window *window, Raftel::Input::Keys key_)
 Toggles the camera state using a keyboard key.
 
void ToggleState (Raftel::Window *window, Raftel::Input::Buttons button_)
 Toggles the camera state using a mouse button.
 
void ChangeSpeedWithKey (Raftel::Window *window, Raftel::Input::Keys key_, float fastSpeed=5.0f, float normalSpeed=2.0f)
 Changes camera movement speed when a specific key is pressed.
 
void ChangeSpeedWithScroll (Raftel::Window *window, float speedOffset)
 Adjusts camera movement speed using mouse scroll input.
 
void PossessedInput (Raftel::Window *window)
 Processes user input when the camera is in possessed mode.
 

Detailed Description

Camera class for handling movement and view transformations.

Definition at line 27 of file camera.hpp.

Constructor & Destructor Documentation

◆ Camera()

Raftel::Camera::Camera ( Raftel::Window * w)

Constructs a Camera object.

Parameters
inputRefPointer to the input handler.

Member Function Documentation

◆ ChangeSpeedWithKey()

void Raftel::Camera::ChangeSpeedWithKey ( Raftel::Window * window,
Raftel::Input::Keys key_,
float fastSpeed = 5.0f,
float normalSpeed = 2.0f )

Changes camera movement speed when a specific key is pressed.

Parameters
windowReference to the window.
key_Key used to adjust the speed.
fastSpeedSpeed when the key is held.
normalSpeedDefault speed when the key is not held.

◆ ChangeSpeedWithScroll()

void Raftel::Camera::ChangeSpeedWithScroll ( Raftel::Window * window,
float speedOffset )

Adjusts camera movement speed using mouse scroll input.

Parameters
windowReference to the window.
speedOffsetThe speed adjustment factor.

◆ getMovementSpeed()

float Raftel::Camera::getMovementSpeed ( ) const

Gets the current movement speed of the camera.

Returns
The movement speed.

◆ getPosition()

glm::vec3 Raftel::Camera::getPosition ( ) const

Gets the current position of the camera.

Returns
The camera position.

◆ getProjectionMatrix()

glm::mat4 Raftel::Camera::getProjectionMatrix ( ) const

Gets the projection matrix of the camera.

Returns
The projection matrix.

◆ getRotation()

glm::vec3 Raftel::Camera::getRotation ( ) const

Gets the current rotation of the camera.

Returns
The camera rotation (pitch, yaw, roll).

◆ GetState()

CameraState Raftel::Camera::GetState ( ) const

Gets the current camera state.

Returns
The camera state.

◆ getViewMatrix()

glm::mat4 Raftel::Camera::getViewMatrix ( ) const

Gets the view matrix of the camera.

Returns
The view matrix.

◆ PossessedInput()

void Raftel::Camera::PossessedInput ( Raftel::Window * window)

Processes user input when the camera is in possessed mode.

Parameters
windowReference to the window.

◆ Rotate()

void Raftel::Camera::Rotate ( float angle,
const glm::vec3 & axis )

Rotates the camera around an axis.

Parameters
angleRotation angle in degrees.
axisRotation axis.

◆ SetPosition()

void Raftel::Camera::SetPosition ( const glm::vec3 & position)

Sets the position of the camera.

Parameters
positionThe new position.

◆ SetRotation()

void Raftel::Camera::SetRotation ( const glm::vec3 & rotation)

Sets the rotation of the camera.

Parameters
rotationThe new rotation angles.

◆ SetState()

void Raftel::Camera::SetState ( CameraState newState,
GLFWwindow * window )

Sets the camera state.

Parameters
newStateThe new state to set.
windowThe GLFW window reference.

◆ setUniforms()

void Raftel::Camera::setUniforms ( ShaderProgram & prg)

Sets shader uniforms related to the camera.

Parameters
prgShader program to update.

◆ ToggleState() [1/2]

void Raftel::Camera::ToggleState ( Raftel::Window * window,
Raftel::Input::Buttons button_ )

Toggles the camera state using a mouse button.

Parameters
windowReference to the window.
button_Mouse button used to toggle the state.

◆ ToggleState() [2/2]

void Raftel::Camera::ToggleState ( Raftel::Window * window,
Raftel::Input::Keys key_ )

Toggles the camera state using a keyboard key.

Parameters
windowReference to the window.
key_Key used to toggle the state.

◆ Translate()

void Raftel::Camera::Translate ( const glm::vec3 & translation)

Moves the camera by a given translation vector.

Parameters
translationThe translation vector.

◆ Update()

void Raftel::Camera::Update ( const std::unique_ptr< Window > & window)

Updates the camera's transformation matrices.

Parameters
windowThe window reference used for retrieving screen size.

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