3#include <Gui/Viewer/TrackballCameraManipulator.hpp>
9class RA_GUI_API RotateAroundCameraManipulator
16 using KeyMapping = KeyMappingManageable<RotateAroundCameraManipulator>;
18 explicit RotateAroundCameraManipulator(
const CameraManipulator& cm,
Ra::Gui::Viewer* viewer );
21 bool handleMouseMoveEvent( QMouseEvent* event,
22 const Qt::MouseButtons& buttons,
23 const Qt::KeyboardModifiers& modifiers,
26 bool handleKeyPressEvent( QKeyEvent* event,
29 void setPivot( Ra::Core::Vector3 pivot );
31 void setPivotFromPixel( Scalar x, Scalar y );
35 void alignOnClosestAxis();
37 KeyMappingManager::Context mappingContext()
override;
40 void fitScene(
const Core::Aabb& aabb )
override;
43 virtual void handleCameraRotate( Scalar dx, Scalar dy )
override;
44 virtual void handleCameraForward( Scalar z );
45 virtual void handleCameraPan( Scalar dx, Scalar dy )
override;
49 Ra::Core::Quaternion deformedBallQuaternion( Scalar x, Scalar y, Scalar cx, Scalar cy );
50 Scalar projectOnBall( Scalar x, Scalar y );
53 void setupKeyMappingCallbacks();
54 void alignWithClosestAxisCallback( QEvent* event );
55 void moveForwardCallback( QEvent* event );
56 void panCallback( QEvent* event );
57 void rotateCallback( QEvent* event );
58 void setPivotCallback( QEvent* event );
59 void zoomCallback( QEvent* event );
61 KeyMappingCallbackManager m_keyMappingCallbackManager;
64 Ra::Core::Vector3 m_pivot { 0.0_ra, 0.0_ra, 0.0_ra };
66 static void configureKeyMapping_impl();
68#define KeyMappingRotateAroundCamera \
69 KMA_VALUE( ROTATEAROUND_ALIGN_WITH_CLOSEST_AXIS ) \
70 KMA_VALUE( ROTATEAROUND_SET_PIVOT )
72#define KMA_VALUE( XX ) static KeyMappingManager::KeyMappingAction XX;
73 KeyMappingRotateAroundCamera
KeyMappingManageable decorator to use as CRTP.
Ra::Core::Utils::Index KeyMappingAction
handle to an action
A Trackball manipulator for Cameras.
hepler function to manage enum as underlying types in VariableSet