VkCV Framework
0.0.1
CV Vulkan framework
|
Used to orbit a camera around its center point. More...
#include <TrackballCameraController.hpp>
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... | |
![]() | |
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 |
Used to orbit a camera around its center point.
|
virtual |
A callback function for gamepad input events.
gamepadIndex | The gamepad index. |
camera | The camera object. |
frametime | The current frametime. |
Implements vkcv::camera::CameraController.
References panView(), and updateRadius().
|
virtual |
A callback function for key events. Currently, the trackball camera does not support camera movement. It can only orbit around its center point.
[in] | key | The keyboard key. |
[in] | scancode | The platform-specific scancode. |
[in] | action | The key action. |
[in] | mods | The modifier bits. |
[in] | camera | The camera object. |
Implements vkcv::camera::CameraController.
|
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.
[in] | button | The mouse button. |
[in] | action | The button action. |
[in] | mods | The modifier bits. |
[in] | camera | The camera object. |
Implements vkcv::camera::CameraController.
|
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.
[in] | xoffset | The horizontal mouse position. |
[in] | yoffset | The vertical mouse position. |
[in] | camera | The camera object. |
Implements vkcv::camera::CameraController.
References 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
.
[in] | xOffset | The offset added to the yaw value. |
[in] | yOffset | The offset added to the pitch value. |
[in] | camera | The camera object. |
Referenced by gamepadCallback(), and mouseMoveCallback().
|
virtual |
A callback function for mouse scrolling events. Currently, this leads to changes in the field of view of the camera object.
[in] | offsetX | The offset in horizontal direction. |
[in] | offsetY | The offset in vertical direction. |
[in] | camera | The camera object. |
Implements vkcv::camera::CameraController.
References updateRadius().
void vkcv::camera::TrackballCameraController::setRadius | ( | const float | radius | ) |
Sets radius
as the new radius for orbiting around the camera's center point.
[in] | radius | The new radius. |
Referenced by updateRadius().
|
virtual |
Updates camera
in respect to deltaTime
.
[in] | deltaTime | The time that has passed since last update. |
[in] | camera | The camera object |
Implements vkcv::camera::CameraController.
References vkcv::camera::Camera::getCenter(), and vkcv::camera::Camera::lookAt().
|
private |
Updates the current radius of camera
in respect to the offset
.
[in] | offset | The offset between the old and new radius. |
[in] | camera | The camera object. |
References vkcv::camera::Camera::getCenter(), vkcv::camera::Camera::getPosition(), and setRadius().
Referenced by gamepadCallback(), and scrollCallback().