VkCV Framework  0.0.1
CV Vulkan framework
vkcv::camera::PilotCameraController Class Referencefinal

Used to move around a camera object in world space. More...

#include <PilotCameraController.hpp>

Inheritance diagram for vkcv::camera::PilotCameraController:
Collaboration diagram for vkcv::camera::PilotCameraController:

Public Member Functions

 PilotCameraController ()
 The default constructor of the PilotCameraController.
 
 ~PilotCameraController ()=default
 The destructor of the PilotCameraController (default behavior).
 
void changeFov (double offset, Camera &camera)
 Changes the field of view of camera with an offset in degrees. More...
 
void panView (double xOffset, double yOffset, Camera &camera)
 Pans the view of camera according to the pitch and yaw values and additional offsets xOffset and yOffset. More...
 
void updateCamera (double deltaTime, Camera &camera)
 Updates camera in respect to deltaTime. More...
 
void keyCallback (int key, int scancode, int action, int mods, Camera &camera)
 A callback function for key events. Currently, 3D camera movement via W, A, S, D, E, Q are supported. More...
 
void scrollCallback (double offsetX, double offsetY, Camera &camera)
 A callback function for mouse scrolling events. Currently, this leads to changes in the field of view of camera. More...
 
void mouseMoveCallback (double x, double y, Camera &camera)
 A callback function for mouse movement events. Currently, this leads to panning the view of the camera, if #mouseButtonCallback(int button, int action, int mods) enabled panning. More...
 
void mouseButtonCallback (int button, int action, int mods, Camera &camera)
 A callback function for mouse button events. Currently, the right mouse button enables panning the view of the camera as long as it is pressed. More...
 
void gamepadCallback (int gamepadIndex, Camera &camera, double frametime)
 A callback function for gamepad input events. More...
 
- Public Member Functions inherited from vkcv::camera::CameraController
 CameraController ()=default
 The constructor of the CameraController (default behavior).
 

Private Member Functions

void moveForward (int action)
 Indicates forward movement of the camera depending on the performed action. More...
 
void moveBackward (int action)
 Indicates backward movement of the camera depending on the performed action. More...
 
void moveLeft (int action)
 Indicates left movement of the camera depending on the performed action. More...
 
void moveRight (int action)
 Indicates right movement of the camera depending on the performed action. More...
 
void moveUpward (int action)
 Indicates upward movement of the camera depending on the performed action. More...
 
void moveDownward (int action)
 Indicates downward movement of the camera depending on the performed action. More...
 

Private Attributes

bool m_forward
 
bool m_backward
 
bool m_upward
 
bool m_downward
 
bool m_left
 
bool m_right
 
float m_gamepadX
 
float m_gamepadY
 
float m_gamepadZ
 
bool m_rotationActive
 
float m_cameraSpeed
 
int m_fov_nsteps
 
float m_fov_min
 
float m_fov_max
 

Detailed Description

Used to move around a camera object in world space.

Member Function Documentation

◆ changeFov()

void vkcv::camera::PilotCameraController::changeFov ( double  offset,
Camera camera 
)

Changes the field of view of camera with an offset in degrees.

Parameters
[in]offsetThe offset in degrees.
[in]cameraThe camera object.

References vkcv::camera::Camera::getFov(), and vkcv::camera::Camera::setFov().

Referenced by gamepadCallback(), and scrollCallback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gamepadCallback()

void vkcv::camera::PilotCameraController::gamepadCallback ( int  gamepadIndex,
Camera camera,
double  frametime 
)
virtual

A callback function for gamepad input events.

Parameters
gamepadIndexThe gamepad index.
cameraThe camera object.
frametimeThe current frametime.

Implements vkcv::camera::CameraController.

References changeFov(), and panView().

Here is the call graph for this function:

◆ keyCallback()

void vkcv::camera::PilotCameraController::keyCallback ( int  key,
int  scancode,
int  action,
int  mods,
Camera camera 
)
virtual

A callback function for key events. Currently, 3D camera movement via W, A, S, D, E, Q are supported.

Parameters
[in]keyThe keyboard key.
[in]scancodeThe platform-specific scancode.
[in]actionThe key action.
[in]modsThe modifier bits.
[in]cameraThe camera object.

Implements vkcv::camera::CameraController.

References moveBackward(), moveDownward(), moveForward(), moveLeft(), moveRight(), and moveUpward().

Here is the call graph for this function:

◆ mouseButtonCallback()

void vkcv::camera::PilotCameraController::mouseButtonCallback ( int  button,
int  action,
int  mods,
Camera camera 
)
virtual

A callback function for mouse button events. Currently, the right mouse button enables panning the view of the camera as long as it is pressed.

Parameters
[in]buttonThe mouse button
[in]actionThe button action
[in]modsThe modifier bits
[in]cameraThe camera object.

Implements vkcv::camera::CameraController.

◆ mouseMoveCallback()

void vkcv::camera::PilotCameraController::mouseMoveCallback ( double  x,
double  y,
Camera camera 
)
virtual

A callback function for mouse movement events. Currently, this leads to panning the view of the camera, if #mouseButtonCallback(int button, int action, int mods) enabled panning.

Parameters
[in]xThe horizontal mouse position
[in]yThe vertical mouse position
[in]cameraThe camera object.

Implements vkcv::camera::CameraController.

References panView().

Here is the call graph for this function:

◆ moveBackward()

void vkcv::camera::PilotCameraController::moveBackward ( int  action)
private

Indicates backward movement of the camera depending on the performed action.

Parameters
[in]actionThe performed action.

Referenced by keyCallback().

Here is the caller graph for this function:

◆ moveDownward()

void vkcv::camera::PilotCameraController::moveDownward ( int  action)
private

Indicates downward movement of the camera depending on the performed action.

Parameters
[in]actionThe performed action.

Referenced by keyCallback().

Here is the caller graph for this function:

◆ moveForward()

void vkcv::camera::PilotCameraController::moveForward ( int  action)
private

Indicates forward movement of the camera depending on the performed action.

Parameters
[in]actionThe performed action.

Referenced by keyCallback().

Here is the caller graph for this function:

◆ moveLeft()

void vkcv::camera::PilotCameraController::moveLeft ( int  action)
private

Indicates left movement of the camera depending on the performed action.

Parameters
[in]actionThe performed action.

Referenced by keyCallback().

Here is the caller graph for this function:

◆ moveRight()

void vkcv::camera::PilotCameraController::moveRight ( int  action)
private

Indicates right movement of the camera depending on the performed action.

Parameters
[in]actionThe performed action.

Referenced by keyCallback().

Here is the caller graph for this function:

◆ moveUpward()

void vkcv::camera::PilotCameraController::moveUpward ( int  action)
private

Indicates upward movement of the camera depending on the performed action.

Parameters
[in]actionThe performed action.

Referenced by keyCallback().

Here is the caller graph for this function:

◆ panView()

void vkcv::camera::PilotCameraController::panView ( double  xOffset,
double  yOffset,
Camera camera 
)

Pans the view of camera according to the pitch and yaw values and additional offsets xOffset and yOffset.

Parameters
[in]xOffsetThe offset added to the yaw value.
[in]yOffsetThe offset added to the pitch value.
[in]cameraThe camera object.

References vkcv::camera::Camera::getPitch(), vkcv::camera::Camera::getYaw(), vkcv::camera::Camera::setPitch(), and vkcv::camera::Camera::setYaw().

Referenced by gamepadCallback(), and mouseMoveCallback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ scrollCallback()

void vkcv::camera::PilotCameraController::scrollCallback ( double  offsetX,
double  offsetY,
Camera camera 
)
virtual

A callback function for mouse scrolling events. Currently, this leads to changes in the field of view of camera.

Parameters
[in]offsetXThe offset in horizontal direction.
[in]offsetYThe offset in vertical direction.
[in]cameraThe camera object.

Implements vkcv::camera::CameraController.

References changeFov().

Here is the call graph for this function:

◆ updateCamera()

void vkcv::camera::PilotCameraController::updateCamera ( double  deltaTime,
Camera camera 
)
virtual

Updates camera in respect to deltaTime.

Parameters
[in]deltaTimeThe time that has passed since last update.
[in]cameraThe camera object.

Implements vkcv::camera::CameraController.

References vkcv::camera::Camera::getFront(), vkcv::camera::Camera::getPosition(), vkcv::camera::Camera::getUp(), and vkcv::camera::Camera::lookAt().

Here is the call graph for this function:

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