cae  0.0.0
Cross-API graphics engine
Loading...
Searching...
No Matches
cae::Camera Class Reference

Class for camera. More...

#include <Camera.hpp>

+ Collaboration diagram for cae::Camera:

Public Member Functions

 Camera (const glm::vec3 position, const glm::vec3 rotation, const glm::vec3 direction, const float moveSpeed=CAMERA::MOVE_SPEED, const float lookSpeed=CAMERA::LOOK_SPEED, const float fov=CAMERA::FOV, const float nearPlane=CAMERA::NEAR_PLANE, const float farPlane=CAMERA::FAR_PLANE)
 
 ~Camera ()=default
 
 Camera (const Camera &)=delete
 
Cameraoperator= (const Camera &)=delete
 
 Camera (Camera &&)=delete
 
Cameraoperator= (Camera &&)=delete
 
void setName (const std::string &name)
 
void setPosition (const glm::vec3 &position)
 
void setRotation (const glm::vec3 &rotation)
 
void setDirection (const glm::vec3 &direction)
 
void setMoveSpeed (const float speed)
 
void setLookSpeed (const float speed)
 
void setFov (const float fov)
 
void setNear (const float nearPlane)
 
void setFar (const float farPlane)
 
const std::string & getName () const
 
const glm::vec3 & getPosition () const
 
const glm::vec3 & getRotation () const
 
const glm::vec3 & getDirection () const
 
const float & getMoveSpeed () const
 
const float & getLookSpeed () const
 
const float & getFov () const
 
const float & getNear () const
 
const float & getFar () const
 
glm::mat4 getViewMatrix () const
 
glm::mat4 getProjectionMatrix (const float aspectRatio) const
 
glm::mat4 getViewProjection (const float aspectRatio) const
 
void move (const glm::vec3 &direction, const float deltaTime)
 Move the camera in a given direction.
 
void rotate (const float yawOffset, const float pitchOffset, const float deltaTime)
 Rotate the camera by given yaw and pitch offsets.
 

Private Member Functions

void updateDirectionFromRotation ()
 

Private Attributes

std::string m_name = CAMERA::NAME
 
glm::vec3 m_position = glm::vec3(0.0F, 0.0F, 0.0F)
 
glm::vec3 m_rotation = glm::vec3(0.0F, 0.0F, 0.0F)
 
glm::vec3 m_direction = glm::vec3(0.0F, 0.0F, -1.0F)
 
float m_moveSpeed = CAMERA::MOVE_SPEED
 
float m_lookSpeed = CAMERA::LOOK_SPEED
 
float m_fov = CAMERA::FOV
 
float m_near = CAMERA::NEAR_PLANE
 
float m_far = CAMERA::FAR_PLANE
 

Detailed Description

Class for camera.

Definition at line 23 of file Camera.hpp.

Constructor & Destructor Documentation

◆ Camera() [1/3]

cae::Camera::Camera ( const glm::vec3 position,
const glm::vec3 rotation,
const glm::vec3 direction,
const float moveSpeed = CAMERA::MOVE_SPEED,
const float lookSpeed = CAMERA::LOOK_SPEED,
const float fov = CAMERA::FOV,
const float nearPlane = CAMERA::NEAR_PLANE,
const float farPlane = CAMERA::FAR_PLANE )
inline

Definition at line 26 of file Camera.hpp.

◆ ~Camera()

cae::Camera::~Camera ( )
default

◆ Camera() [2/3]

cae::Camera::Camera ( const Camera & )
delete

◆ Camera() [3/3]

cae::Camera::Camera ( Camera && )
delete

Member Function Documentation

◆ getDirection()

const glm::vec3 & cae::Camera::getDirection ( ) const
inlinenodiscard

Definition at line 54 of file Camera.hpp.

References m_direction.

◆ getFar()

const float & cae::Camera::getFar ( ) const
inlinenodiscard

Definition at line 59 of file Camera.hpp.

References m_far.

◆ getFov()

const float & cae::Camera::getFov ( ) const
inlinenodiscard

Definition at line 57 of file Camera.hpp.

References m_fov.

◆ getLookSpeed()

const float & cae::Camera::getLookSpeed ( ) const
inlinenodiscard

Definition at line 56 of file Camera.hpp.

References m_lookSpeed.

◆ getMoveSpeed()

const float & cae::Camera::getMoveSpeed ( ) const
inlinenodiscard

Definition at line 55 of file Camera.hpp.

References m_moveSpeed.

◆ getName()

const std::string & cae::Camera::getName ( ) const
inlinenodiscard

Definition at line 51 of file Camera.hpp.

References m_name.

◆ getNear()

const float & cae::Camera::getNear ( ) const
inlinenodiscard

Definition at line 58 of file Camera.hpp.

References m_near.

◆ getPosition()

const glm::vec3 & cae::Camera::getPosition ( ) const
inlinenodiscard

Definition at line 52 of file Camera.hpp.

References m_position.

◆ getProjectionMatrix()

glm::mat4 cae::Camera::getProjectionMatrix ( const float aspectRatio) const
inlinenodiscard

Definition at line 65 of file Camera.hpp.

References m_far, m_fov, and m_near.

Referenced by getViewProjection().

+ Here is the caller graph for this function:

◆ getRotation()

const glm::vec3 & cae::Camera::getRotation ( ) const
inlinenodiscard

Definition at line 53 of file Camera.hpp.

References m_rotation.

◆ getViewMatrix()

glm::mat4 cae::Camera::getViewMatrix ( ) const
inlinenodiscard

Definition at line 61 of file Camera.hpp.

References m_direction, and m_position.

Referenced by getViewProjection().

+ Here is the caller graph for this function:

◆ getViewProjection()

glm::mat4 cae::Camera::getViewProjection ( const float aspectRatio) const
inlinenodiscard

Definition at line 69 of file Camera.hpp.

References getProjectionMatrix(), and getViewMatrix().

+ Here is the call graph for this function:

◆ move()

void cae::Camera::move ( const glm::vec3 & direction,
const float deltaTime )
inline

Move the camera in a given direction.

Parameters
directionDirection to move the camera
deltaTimeTime delta for movement

Definition at line 79 of file Camera.hpp.

References m_moveSpeed, and m_position.

◆ operator=() [1/2]

Camera & cae::Camera::operator= ( Camera && )
delete

◆ operator=() [2/2]

Camera & cae::Camera::operator= ( const Camera & )
delete

◆ rotate()

void cae::Camera::rotate ( const float yawOffset,
const float pitchOffset,
const float deltaTime )
inline

Rotate the camera by given yaw and pitch offsets.

Parameters
yawOffsetYaw offset to rotate the camera
pitchOffsetPitch offset to rotate the camera
deltaTimeTime delta for rotation

Definition at line 90 of file Camera.hpp.

References m_lookSpeed, m_rotation, and updateDirectionFromRotation().

+ Here is the call graph for this function:

◆ setDirection()

void cae::Camera::setDirection ( const glm::vec3 & direction)
inline

Definition at line 44 of file Camera.hpp.

References m_direction.

◆ setFar()

void cae::Camera::setFar ( const float farPlane)
inline

Definition at line 49 of file Camera.hpp.

References m_far.

◆ setFov()

void cae::Camera::setFov ( const float fov)
inline

Definition at line 47 of file Camera.hpp.

References m_fov.

◆ setLookSpeed()

void cae::Camera::setLookSpeed ( const float speed)
inline

Definition at line 46 of file Camera.hpp.

References m_lookSpeed.

◆ setMoveSpeed()

void cae::Camera::setMoveSpeed ( const float speed)
inline

Definition at line 45 of file Camera.hpp.

References m_moveSpeed.

◆ setName()

void cae::Camera::setName ( const std::string & name)
inline

Definition at line 41 of file Camera.hpp.

References m_name.

◆ setNear()

void cae::Camera::setNear ( const float nearPlane)
inline

Definition at line 48 of file Camera.hpp.

References m_near.

◆ setPosition()

void cae::Camera::setPosition ( const glm::vec3 & position)
inline

Definition at line 42 of file Camera.hpp.

References m_position.

◆ setRotation()

void cae::Camera::setRotation ( const glm::vec3 & rotation)
inline

Definition at line 43 of file Camera.hpp.

References m_rotation.

◆ updateDirectionFromRotation()

void cae::Camera::updateDirectionFromRotation ( )
inlineprivate

Definition at line 115 of file Camera.hpp.

References m_direction, and m_rotation.

Referenced by rotate().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_direction

glm::vec3 cae::Camera::m_direction = glm::vec3(0.0F, 0.0F, -1.0F)
private

Definition at line 106 of file Camera.hpp.

Referenced by getDirection(), getViewMatrix(), setDirection(), and updateDirectionFromRotation().

◆ m_far

float cae::Camera::m_far = CAMERA::FAR_PLANE
private

Definition at line 113 of file Camera.hpp.

Referenced by getFar(), getProjectionMatrix(), and setFar().

◆ m_fov

float cae::Camera::m_fov = CAMERA::FOV
private

Definition at line 111 of file Camera.hpp.

Referenced by getFov(), getProjectionMatrix(), and setFov().

◆ m_lookSpeed

float cae::Camera::m_lookSpeed = CAMERA::LOOK_SPEED
private

Definition at line 109 of file Camera.hpp.

Referenced by getLookSpeed(), rotate(), and setLookSpeed().

◆ m_moveSpeed

float cae::Camera::m_moveSpeed = CAMERA::MOVE_SPEED
private

Definition at line 108 of file Camera.hpp.

Referenced by getMoveSpeed(), move(), and setMoveSpeed().

◆ m_name

std::string cae::Camera::m_name = CAMERA::NAME
private

Definition at line 102 of file Camera.hpp.

Referenced by getName(), and setName().

◆ m_near

float cae::Camera::m_near = CAMERA::NEAR_PLANE
private

Definition at line 112 of file Camera.hpp.

Referenced by getNear(), getProjectionMatrix(), and setNear().

◆ m_position

glm::vec3 cae::Camera::m_position = glm::vec3(0.0F, 0.0F, 0.0F)
private

Definition at line 104 of file Camera.hpp.

Referenced by getPosition(), getViewMatrix(), move(), and setPosition().

◆ m_rotation

glm::vec3 cae::Camera::m_rotation = glm::vec3(0.0F, 0.0F, 0.0F)
private

Definition at line 105 of file Camera.hpp.

Referenced by getRotation(), rotate(), setRotation(), and updateDirectionFromRotation().


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