![]() |
ImFusion SDK 4.3
|
#include <ImFusion/GUI/CameraNavigation.h>
Helper class to manipulate a 3D Camera using classic metaphors such as zoom, pan, etc. More...
Helper class to manipulate a 3D Camera using classic metaphors such as zoom, pan, etc.
For instance InputEventHandlers for 3D views can leverage this class to reduce their implementation complexity. At the beginning of an interaction you call reset() with a reference state. Then you call any number of member functions to configure the camera movement. Finally, you can query the resulting camera state using camera().
Public Member Functions | |
| CameraNavigation (const Camera &referenceCam, double viewportHeight) | |
| Creates a new CameraNavigation object calling reset() with the given parameters. | |
| void | reset (const Camera &referenceCam, double viewportHeight) |
| Resets the internal state to the given reference camera and viewport height. | |
| const Camera & | referenceCamera () const |
| Returns the reference camera state as passed during the last call to reset(). | |
| Camera | newCamera () const |
| Returns the resulting camera setup after applying pan, zoom, and rotation to the reference camera passed during reset(). | |
| void | addPan (const vec2 &translationPx) |
| Accumulates in-plane panning to apply to the camera. | |
| void | setPan (const vec2 &translationPx) |
| Sets the in-plane panning to apply to the camera removing any previously accumulated panning. | |
| void | addZoom (double distance, bool adaptive=true) |
| Accumulates zooming to apply to the camera. | |
| void | setZoom (double distance, bool adaptive=true) |
| Sets the zooming to apply to the camera removing any previously accumulated zoom. | |
| void | setRotationCenter (const vec3 &position) |
| Sets the rotation center in world space around which the camera will be rotated. | |
| const vec3 & | rotationCenter () const |
| Returns the rotation center in world space around which the camera will be rotated. | |
| void | addRotation (const vec3 °reesXYZ) |
| Accumulates a rotation around the rotation center in terms of degrees around the camera's XYZ axes. | |
| void | setRotation (const vec3 °reesXYZ) |
| Sets the rotation around the rotation center in terms of degrees around the camera's XYZ axes. | |
| void addZoom | ( | double | distance, |
| bool | adaptive = true ) |
Accumulates zooming to apply to the camera.
| distance | Unit-less zoom amount, loosely relating to the camera movement in look direction for perspective projections, or a frustum height adjustment if similar scale for orthographic projections. |
| adaptive | If true, distance will be linearly scaled based on the current distance between camera and rotation center |
| void setZoom | ( | double | distance, |
| bool | adaptive = true ) |
Sets the zooming to apply to the camera removing any previously accumulated zoom.
| distance | Unit-less zoom amount, loosely relating to the camera movement in look direction for perspective projections, or a frustum height adjustment if similar scale for orthographic projections. |
| adaptive | If true, distance will be linearly scaled based on the current distance between camera and rotation center |