Particle​ Simulation Documentation
Loading...
Searching...
No Matches
Camera Class Reference

#include <camera.h>

Public Member Functions

 Camera (const glm::vec3 &position=glm::vec3(0.0f, 0.0f, 0.0f), const glm::vec3 &front=glm::vec3(1.0f, 0.0f, 0.0f), const glm::vec3 &up=glm::vec3(0.0f, 1.0f, 0.0f), float azimuth=0.0f, float elevation=0.0f, float speed=50.0f, float fov=45.0f, const float minRenderDistance=1, const float maxRenderDistance=10000)
 
void configurePerspective (double aspectRatio)
 Configure camera perspective.
 
void update ()
 Updates the camera position and orientation.
 
void computeNewPosition (const std::array< bool, 1024 > &keyStates, float deltaTime)
 Compute new camera position.
 
void computeNewOrientation (const double xOffset, const double yOffset)
 Compute new camera orientation.
 
void setPosition (const glm::vec3 &position)
 
void setSpeed (float speed)
 
const glm::vec3 & getPosition () const
 
const glm::vec3 & getFront () const
 
const glm::vec3 & getUp () const
 
const float getSpeed () const
 

Private Attributes

glm::vec3 m_position
 Camera position (in scene unit).
 
glm::vec3 m_front
 Normalized direction towards which the camera is oriented (in scene unit).
 
glm::vec3 m_up
 Normalized direction to top of camera (in scene unit).
 
glm::vec3 m_right
 Normalized direction to the right of camera (in scene unit).
 
float m_azimuth
 Azimut angle of the camera (in °).
 
float m_elevation
 Elevation angle of the camera (in °).
 
float m_speed
 Camera speed (in scene unit/sec).
 
float m_fov
 Camera field of view (in °).
 
const float m_minRenderDistance
 Minimal rendering distance (in scene unit).
 
const float m_maxRenderDistance
 Maximal rendering distance (in scene unit).
 

Constructor & Destructor Documentation

◆ Camera()

Camera::Camera ( const glm::vec3 & position = glm::vec3(0.0f, 0.0f, 0.0f),
const glm::vec3 & front = glm::vec3(1.0f, 0.0f, 0.0f),
const glm::vec3 & up = glm::vec3(0.0f, 1.0f, 0.0f),
float azimuth = 0.0f,
float elevation = 0.0f,
float speed = 50.0f,
float fov = 45.0f,
const float minRenderDistance = 1,
const float maxRenderDistance = 10000 )

Member Function Documentation

◆ computeNewOrientation()

void Camera::computeNewOrientation ( const double xOffset,
const double yOffset )

Compute new camera orientation.

Parameters
[in]xOffsetThe offset
[in]yOffsetThe y offset

◆ computeNewPosition()

void Camera::computeNewPosition ( const std::array< bool, 1024 > & keyStates,
float deltaTime )

Compute new camera position.

Parameters
keyStatesArray of all key states.
deltaTimeTime since the last frame (in seconds).

◆ configurePerspective()

void Camera::configurePerspective ( double aspectRatio)

Configure camera perspective.

Parameters
[in]aspectRatioThe aspect ratio

◆ getFront()

const glm::vec3 & Camera::getFront ( ) const
inline

◆ getPosition()

const glm::vec3 & Camera::getPosition ( ) const
inline

◆ getSpeed()

const float Camera::getSpeed ( ) const
inline

◆ getUp()

const glm::vec3 & Camera::getUp ( ) const
inline

◆ setPosition()

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

◆ setSpeed()

void Camera::setSpeed ( float speed)

◆ update()

void Camera::update ( )

Updates the camera position and orientation.

Member Data Documentation

◆ m_azimuth

float Camera::m_azimuth
private

Azimut angle of the camera (in °).

◆ m_elevation

float Camera::m_elevation
private

Elevation angle of the camera (in °).

◆ m_fov

float Camera::m_fov
private

Camera field of view (in °).

◆ m_front

glm::vec3 Camera::m_front
private

Normalized direction towards which the camera is oriented (in scene unit).

◆ m_maxRenderDistance

const float Camera::m_maxRenderDistance
private

Maximal rendering distance (in scene unit).

◆ m_minRenderDistance

const float Camera::m_minRenderDistance
private

Minimal rendering distance (in scene unit).

◆ m_position

glm::vec3 Camera::m_position
private

Camera position (in scene unit).

◆ m_right

glm::vec3 Camera::m_right
private

Normalized direction to the right of camera (in scene unit).

◆ m_speed

float Camera::m_speed
private

Camera speed (in scene unit/sec).

◆ m_up

glm::vec3 Camera::m_up
private

Normalized direction to top of camera (in scene unit).