9#ifndef AVARA3D_EXTENSION_CAMERA_TURNTABLECAMERACONTROLLER_H
10#define AVARA3D_EXTENSION_CAMERA_TURNTABLECAMERACONTROLLER_H
17#include "a3d/input/DesktopInputContext.h"
49 using Target = std::variant<math::vec3, NodeTarget>;
150 void target(
const std::shared_ptr<Node>& node);
189 enum class DragMode {
198 void translateTarget(
const math::vec3& worldTranslation);
205 bool _orbitButtonActive;
206 bool _orbitButtonDragging;
207 DragMode _orbitButtonDragMode;
209 bool _panButtonActive;
210 bool _panButtonDragging;
Exposes keyboard, pointer-button, pointer-motion, and scroll state.
MouseButton
Identifies one of up to eight pointer buttons.
Key
Identifies keyboard keys reported by desktop-style input contexts.
A transformable object in a Scene hierarchy.
Provides orbit, pan, and dolly control around a world-space or Node-relative target.
const Config & config() const
Returns the current controller configuration.
void target(const std::shared_ptr< Node > &node)
Sets the orbit target to the local origin of node.
std::variant< math::vec3, NodeTarget > Target
Orbit target represented by either a fixed world position or a Node-relative point.
const View & view() const
Returns the current orbit View.
void view(const View &view)
Replaces the orbit View, clamping pitch and distance to the configured limits.
TurntableCameraController()
Creates a controller with the default configuration and View.
void target(const std::shared_ptr< Node > &node, const math::vec3 &localPosition)
Sets the orbit target to localPosition in node coordinates.
void target(const math::vec3 &worldPosition)
Sets a fixed world-space orbit target.
void config(const Config &config)
Replaces the controller configuration and clamps the current View to its new limits.
UpdateResult update(DesktopInputContext &input, float vFov, float viewportHeight)
Updates the View from pointer-button, pointer-motion, and scroll input.
void apply(Node &pov)
Applies the current View to pov so it looks at the resolved target.
TurntableCameraController(const Config &config)
Creates a controller with config and the default View.
Limits, sensitivities, and input bindings used by the controller.
float dollySensitivity
Exponential dolly sensitivity for pointer dragging.
float orbitSensitivity
Orbit radians per logical pointer unit.
float dragThreshold
Pointer displacement required to convert a click candidate into a drag.
float maxDistance
Maximum target distance in scene units.
Controls controls
Pointer-button and modifier bindings.
float scrollDollySensitivity
Exponential dolly sensitivity per scroll unit.
float minDistance
Minimum positive target distance in scene units.
float maxPitch
Maximum pitch in radians; must remain below 90 degrees.
bool invertPitch
Reverses vertical orbit direction when true.
float minPitch
Minimum pitch in radians; must remain above -90 degrees.
Pointer buttons and modifier keys used for camera manipulation.
DesktopInputContext::Key dollyModifier
Makes orbit-button dragging dolly.
DesktopInputContext::MouseButton panButton
Dedicated pan/click button.
DesktopInputContext::MouseButton orbitButton
Primary orbit/click button.
DesktopInputContext::Key panModifier
Makes orbit-button dragging pan.
Target point expressed in the local coordinates of a weakly referenced Node.
std::weak_ptr< Node > node
Node whose transform supplies the target coordinate space.
math::vec3 localPosition
Target point in the Node's local coordinates.
Pointer click reported when a configured button is released without becoming a drag.
math::vec2 position
Release position in logical viewport coordinates.
Results produced by one input update.
std::optional< PointerClick > panButtonClick
Pan-button click released without crossing the drag threshold.
bool pointerDragging
Whether an orbit or pan button is currently dragging.
bool cameraChanged
Whether update() changed the View.
std::optional< PointerClick > orbitButtonClick
Orbit-button click released without crossing the drag threshold.
Camera orbit state around a target.
float distance
Distance from the target in scene units.
float yaw
Horizontal orbit angle in radians.
float pitch
Vertical orbit angle in radians.
Target target
Point around which the camera orbits.