Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
ControllableCamera Class Referencefinal

This camera can be controlled through the inputs received from the user. More...

#include <ControllableCamera.hpp>

Public Types

enum class  Mode : uint { FPS = 0 , TurnTable , Joystick }
 The interaction mode of the controllable camera.
 

Public Member Functions

 ControllableCamera ()
 Constructor.
 
void pose (const glm::vec3 &position, const glm::vec3 &center, const glm::vec3 &up) override
 
void reset ()
 Reset the position of the camera.
 
void update ()
 Update once-per-frame parameters.
 
void physics (double frameTime)
 
float & speed ()
 
void interface ()
 
- Public Member Functions inherited from Camera
 Camera ()
 Constructor.
 
virtual void pose (const glm::vec3 &position, const glm::vec3 &center, const glm::vec3 &up)
 
virtual void projection (float ratio, float fov, float near, float far)
 
void frustum (float near, float far)
 
void ratio (float ratio)
 
void fov (float fov)
 
void pixelShifts (glm::vec3 &corner, glm::vec3 &dx, glm::vec3 &dy) const
 
float fov () const
 
float ratio () const
 
const glm::mat4 & view () const
 
const glm::mat4 & projection () const
 
const glm::vec3 & position () const
 
const glm::vec3 & up () const
 
const glm::vec3 & center () const
 
const glm::vec3 direction () const
 
const glm::vec2 & clippingPlanes () const
 
void apply (const Camera &camera)
 
bool decode (const KeyValues &params)
 
KeyValues encode () const
 
virtual ~Camera ()=default
 
 Camera (const Camera &)=default
 
Cameraoperator= (const Camera &)=default
 
 Camera (Camera &&)=default
 
Cameraoperator= (Camera &&)=default
 

Private Member Functions

void updateUsingJoystick (double frameTime)
 
void updateUsingKeyboard (double frameTime)
 
void updateUsingTurnTable (double frameTime)
 

Private Attributes

float _speed = 1.2f
 Camera speed.
 
float _angularSpeed = 4.0f
 Camera angular speed.
 
glm::vec2 _angles = glm::vec2(glm::half_pi<float>(), 0.0f)
 Orientation angles.
 
float _radius = 1.0f
 Turntable radius.
 
Mode _mode = Mode::TurnTable
 The current interaction mode.
 
float _guiFOV
 Field of view in degrees for the GUI.
 

Additional Inherited Members

- Protected Member Functions inherited from Camera
void updateProjection ()
 Update the projection matrix using the camera parameters.
 
void updateView ()
 Update the view matrix using the camera position and orientation.
 
- Protected Attributes inherited from Camera
glm::mat4 _view = glm::mat4(1.0f)
 The view matrix.
 
glm::mat4 _projection = glm::mat4(1.0f)
 The projection matrix.
 
glm::vec3 _eye = glm::vec3(0.0, 0.0, 1.0)
 The camera position.
 
glm::vec3 _center = glm::vec3(0.0, 0.0, 0.0)
 The camera center (look-at point)
 
glm::vec3 _up = glm::vec3(0.0, 1.0, 0.0)
 The camera up vector.
 
glm::vec3 _right = glm::vec3(1.0, 0.0, 0.0)
 The camera right vector.
 
glm::vec2 _clippingPlanes = glm::vec2(0.01f, 100.0f)
 The near and far plane distances.
 
float _fov = 1.3f
 The vertical field of view, in radians.
 
float _ratio = 1.0f
 The aspect ratio.
 

Detailed Description

This camera can be controlled through the inputs received from the user.

It support turntable, fps and josytick based navigation methods, and handles their synchronization.

Inherits Camera.

Member Function Documentation

◆ interface()

void ControllableCamera::interface ( )

Display a user interface to edit camera parameters.

◆ physics()

void ControllableCamera::physics ( double  frameTime)

Update the camera position and orientation.

Parameters
frameTimethe time elapsed since the last frame, in seconds.

◆ pose()

void ControllableCamera::pose ( const glm::vec3 &  position,
const glm::vec3 &  center,
const glm::vec3 &  up 
)
overridevirtual

Update all view parameters

Parameters
positionthe camera position
centerthe camera center of interest
upthe camera vertical orientation

Reimplemented from Camera.

◆ speed()

float & ControllableCamera::speed ( )
inline

Access the speed parameter.

Returns
reference to the speed.

◆ updateUsingJoystick()

void ControllableCamera::updateUsingJoystick ( double  frameTime)
private

Update the camera state based on joystick inputs.

Parameters
frameTimethe time elapsed since the last frame, in seconds.

◆ updateUsingKeyboard()

void ControllableCamera::updateUsingKeyboard ( double  frameTime)
private

Update the camera state based on keyboard inputs, as a FPS camera.

Parameters
frameTimethe time elapsed since the last frame, in seconds.

◆ updateUsingTurnTable()

void ControllableCamera::updateUsingTurnTable ( double  frameTime)
private

Update the camera state based on keyboard inputs, as a turntable.

Parameters
frameTimethe time elapsed since the last frame, in seconds.

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