Class CameraController
Controller for interactive camera manipulation via user input. More...
#include <CameraController.h>
Inherits the following classes: Controllers
Public Functions
| Type | Name |
|---|---|
| virtual void | bind (EventPool & pool) override Bind to EventPool to subscribe to input events. |
Public Functions inherited from Controllers
See Controllers
| Type | Name |
|---|---|
| virtual void | bind (EventPool & pool) = 0 Subscribe to relevant events in the EventPool . |
Detailed Description
CameraController translates mouse and keyboard input into camera transform updates, enabling standard 3D viewport navigation. It subscribes to input events and directly modifies the active Camera's position and rotation.
Supported Operations: * Orbit (Alt+LMB Drag): Rotate camera around target point * Pan (Alt+MMB Drag): Translate camera perpendicular to view direction * Zoom (Mouse Wheel): Move camera toward/away from target * Fly (Shift+WASD): Free-form movement without target constraint
Event Integration: * Subscribes to: MouseButtonEvent, MouseMoveEvent, MouseScrollEvent, KeyEvent * Emits: CameraEvent (on transform change), CameraTargetEvent (on target update)
State Management: * Reads active camera from SceneContext * Updates camera Transform3D (position, rotation) * Maintains look-at target for orbit mode (stored in Camera::cam_tar)
Mathematical Conventions: * Orbit uses spherical coordinates (azimuth, elevation, radius) * Pan uses camera's right and up vectors for screen-space movement * Zoom modifies distance from target while preserving direction
Note:
CameraController does not own the camera - it operates on active camera from Context.
Note:
Multiple cameras can exist; controller affects whichever is currently active.
Public Functions Documentation
function bind
Bind to EventPool to subscribe to input events.
virtual void CameraController::bind (
EventPool & pool
) override
Subscribes to mouse and keyboard events required for camera manipulation: * MouseButtonEvent: Detect drag start/end * MouseMoveEvent: Track cursor delta for orbit/pan * MouseScrollEvent: Handle zoom via wheel * KeyEvent: WASD for fly mode, modifiers for mode switching
Event handlers query SceneContext for active camera and update its transform based on input deltas. Changes are applied incrementally each frame.
Parameters:
poolEventPool to subscribe to for input events
Note:
Handlers are stateless - camera state lives in Camera object.
Note:
Input sensitivity can be configured via constants or settings.
Implements Controllers::bind
The documentation for this class was generated from the following file src/editor/controllers/CameraController.h