Provides orbit, pan, and dolly control around a world-space or Node-relative target.
More...
#include <a3d/extension/camera/TurntableCameraController.h>
Provides orbit, pan, and dolly control around a world-space or Node-relative target.
update() consumes DesktopInputContext state and changes the controller's View; apply() then positions and orients a supplied point-of-view Node from that View. A Node-relative target is retained weakly and follows the selected local point while the Node exists. If it later expires, the controller preserves the last resolved world-space target position.
Definition at line 36 of file TurntableCameraController.h.
◆ Target
◆ TurntableCameraController() [1/2]
| a3d::ext::TurntableCameraController::TurntableCameraController |
( |
| ) |
|
Creates a controller with the default configuration and View.
◆ TurntableCameraController() [2/2]
| a3d::ext::TurntableCameraController::TurntableCameraController |
( |
const Config & |
config | ) |
|
|
explicit |
Creates a controller with config and the default View.
- Exceptions
-
| std::invalid_argument | if config is invalid. |
◆ apply()
| void a3d::ext::TurntableCameraController::apply |
( |
Node & |
pov | ) |
|
Applies the current View to pov so it looks at the resolved target.
The resulting world transform is converted into parent coordinates when the POV has a parent. Node-relative targets are resolved again each time apply() is called.
◆ config() [1/2]
| const Config & a3d::ext::TurntableCameraController::config |
( |
| ) |
const |
Returns the current controller configuration.
◆ config() [2/2]
| void a3d::ext::TurntableCameraController::config |
( |
const Config & |
config | ) |
|
Replaces the controller configuration and clamps the current View to its new limits.
- Exceptions
-
| std::invalid_argument | if config is invalid. |
◆ target() [1/3]
| void a3d::ext::TurntableCameraController::target |
( |
const math::vec3 & |
worldPosition | ) |
|
Sets a fixed world-space orbit target.
◆ target() [2/3]
| void a3d::ext::TurntableCameraController::target |
( |
const std::shared_ptr< Node > & |
node | ) |
|
Sets the orbit target to the local origin of node.
The Node is retained weakly.
- Exceptions
-
| std::invalid_argument | if node is null. |
◆ target() [3/3]
| void a3d::ext::TurntableCameraController::target |
( |
const std::shared_ptr< Node > & |
node, |
|
|
const math::vec3 & |
localPosition |
|
) |
| |
Sets the orbit target to localPosition in node coordinates.
The Node is retained weakly and the target follows changes to its world transform.
- Exceptions
-
| std::invalid_argument | if node is null. |
◆ update()
Updates the View from pointer-button, pointer-motion, and scroll input.
The orbit button normally orbits, or pans/dollies when the configured modifier was held when the button was pressed. The dedicated pan button always pans. A button released before crossing dragThreshold is reported as a click instead. This function changes controller state only; call apply() to update a POV Node.
- Parameters
-
| input | Current desktop-style input state. |
| vFov | Vertical camera field of view in radians. |
| viewportHeight | Logical viewport height used to scale panning. |
- Returns
- Input-processing results for this update.
- Exceptions
-
| std::invalid_argument | if vFov or viewportHeight is invalid. |
◆ view() [1/2]
| const View & a3d::ext::TurntableCameraController::view |
( |
| ) |
const |
Returns the current orbit View.
◆ view() [2/2]
| void a3d::ext::TurntableCameraController::view |
( |
const View & |
view | ) |
|
Replaces the orbit View, clamping pitch and distance to the configured limits.
A NodeTarget must contain a live Node at the time the View is assigned.
- Exceptions
-
| std::invalid_argument | if the View or its target is invalid. |
The documentation for this class was generated from the following file: