Class COrbitCameraController
Defined in File COrbitCameraController.h
Nested Relationships
Nested Types
Class Documentation
-
class COrbitCameraController
Framework-agnostic orbit/pan/zoom camera controller.
Encapsulates the camera state (azimuth, elevation, zoom distance, pointing-at, roll, FOV, projective flag) and the mouse-delta math that converts raw pointer/scroll events into camera changes.
It is intentionally free of any UI or OpenGL dependency so it can be reused by mrpt_gui (nanogui), mrpt_imgui (Dear ImGui), or any future frontend.
Typical usage - forward framework mouse events into the three
on*methods; then callapplyTo(camera)before rendering:mrpt::viz::COrbitCameraController ctrl; ctrl.setCameraPointing(0, 0, 0); ctrl.setZoomDistance(15.0f); // Inside your mouse-move handler: ctrl.onMouseMove(x, y, MouseButtons::Left, KeyModifiers::None); // Before rendering: ctrl.applyTo(myCamera);
Public Types
Public Functions
-
COrbitCameraController()
-
~COrbitCameraController() = default
-
COrbitCameraController(const COrbitCameraController&) = default
-
COrbitCameraController &operator=(const COrbitCameraController&) = default
-
COrbitCameraController(COrbitCameraController&&) = default
-
COrbitCameraController &operator=(COrbitCameraController&&) = default
-
void setCameraPointing(float x, float y, float z)
-
inline void setCameraPointing(const mrpt::math::TPoint3Df &pt)
-
inline void setCameraPointing(const mrpt::math::TPoint3D &pt)
-
inline float getCameraPointingX() const
-
inline float getCameraPointingY() const
-
inline float getCameraPointingZ() const
-
void setZoomDistance(float d)
-
inline float getZoomDistance() const
-
void setAzimuthDegrees(float deg)
-
inline float getAzimuthDegrees() const
-
void setElevationDegrees(float deg)
-
inline float getElevationDegrees() const
-
inline void setRollDegrees(float deg)
-
inline float getRollDegrees() const
-
inline void setProjectiveModel(bool isProjective)
-
inline bool isProjectiveModel() const
-
inline void setFOVdeg(float fov)
-
inline float getFOVdeg() const
-
void setZoomLimits(float minZoom, float maxZoom)
Clamp zoom to minZoom, maxZoom.
-
inline std::pair<float, float> getZoomLimits()
-
void onMouseMove(int x, int y, uint8_t buttons, uint8_t modifiers)
Call on pointer-move events while any button is held.
-
void onMouseButton(int x, int y, uint8_t button, bool down)
Call on button press/release.
-
void onScroll(float delta, uint8_t modifiers)
Call on scroll-wheel events.
- Parameters:
delta – +1 = wheel-up (zoom in), -1 = wheel-down (zoom out). Fractional values are accepted (high-DPI trackpads).
modifiers – KeyModifiers bitmask.
-
COrbitCameraController()