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

Used to orbit a camera around its center point. More...

#include <TrackballCameraController.hpp>

Inheritance diagram for vkcv::camera::TrackballCameraController:
Collaboration diagram for vkcv::camera::TrackballCameraController:

Public Member Functions

 TrackballCameraController ()
 The default constructor of the TrackballCameraController.
 
 ~TrackballCameraController ()=default
 The destructor of the TrackballCameraController (default behavior).
 
void setRadius (const float radius)
 Sets radius as the new radius for orbiting around the camera's center point. 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, the trackball camera does not support camera movement. It can only orbit around its center point. 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 the camera object. More...
 
void mouseMoveCallback (double xoffset, double yoffset, 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 updateRadius (double offset, Camera &camera)
 Updates the current radius of camera in respect to the offset. More...
 

Private Attributes

bool m_rotationActive
 
float m_cameraSpeed
 
float m_scrollSensitivity
 
float m_radius
 
float m_pitch
 
float m_yaw
 

Detailed Description

Used to orbit a camera around its center point.

Member Function Documentation

◆ gamepadCallback()

void vkcv::camera::TrackballCameraController::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 panView(), and updateRadius().

Here is the call graph for this function:

◆ keyCallback()

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

A callback function for key events. Currently, the trackball camera does not support camera movement. It can only orbit around its center point.

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.

◆ mouseButtonCallback()

void vkcv::camera::TrackballCameraController::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::TrackballCameraController::mouseMoveCallback ( double  xoffset,
double  yoffset,
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]xoffsetThe horizontal mouse position.
[in]yoffsetThe vertical mouse position.
[in]cameraThe camera object.

Implements vkcv::camera::CameraController.

References panView().

Here is the call graph for this function:

◆ panView()

void vkcv::camera::TrackballCameraController::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.

Referenced by gamepadCallback(), and mouseMoveCallback().

Here is the caller graph for this function:

◆ scrollCallback()

void vkcv::camera::TrackballCameraController::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 the camera object.

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

Implements vkcv::camera::CameraController.

References updateRadius().

Here is the call graph for this function:

◆ setRadius()

void vkcv::camera::TrackballCameraController::setRadius ( const float  radius)

Sets radius as the new radius for orbiting around the camera's center point.

Parameters
[in]radiusThe new radius.

Referenced by updateRadius().

Here is the caller graph for this function:

◆ updateCamera()

void vkcv::camera::TrackballCameraController::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::getCenter(), and vkcv::camera::Camera::lookAt().

Here is the call graph for this function:

◆ updateRadius()

void vkcv::camera::TrackballCameraController::updateRadius ( double  offset,
Camera camera 
)
private

Updates the current radius of camera in respect to the offset.

Parameters
[in]offsetThe offset between the old and new radius.
[in]cameraThe camera object.

References vkcv::camera::Camera::getCenter(), vkcv::camera::Camera::getPosition(), and setRadius().

Referenced by gamepadCallback(), and scrollCallback().

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

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