35 bool handleMousePressEvent( QMouseEvent* event,
36 const Qt::MouseButtons& buttons,
37 const Qt::KeyboardModifiers& modifiers,
39 bool handleMouseReleaseEvent( QMouseEvent* event )
override;
40 bool handleMouseMoveEvent( QMouseEvent* event,
41 const Qt::MouseButtons& buttons,
42 const Qt::KeyboardModifiers& modifiers,
44 bool handleWheelEvent( QWheelEvent* event,
45 const Qt::MouseButtons& buttons,
46 const Qt::KeyboardModifiers& modifiers,
49 bool handleKeyPressEvent( QKeyEvent* event,
52 void toggleRotateAround();
53 void updateCamera()
override;
58 void setTrackballRadius( Scalar rad );
61 Scalar getTrackballRadius()
const;
65 const Core::Transform::ConstTranslationPart getTrackballCenter()
const;
70 void setCameraPosition(
const Core::Vector3& position )
override;
71 void setCameraTarget(
const Core::Vector3& target )
override;
72 void fitScene(
const Core::Aabb& aabb )
override;
74 void resetCamera()
override;
77 virtual void handleCameraRotate( Scalar dx, Scalar dy );
78 virtual void handleCameraPan( Scalar dx, Scalar dy );
79 virtual void handleCameraZoom( Scalar dx, Scalar dy );
80 virtual void handleCameraZoom( Scalar z );
81 virtual void handleCameraMoveForward( Scalar dx, Scalar dy );
82 virtual void handleCameraMoveForward( Scalar z );
85 void updatePhiTheta();
95 Scalar m_phi { 0_ra };
96 Scalar m_theta { 0_ra };
98 Scalar m_phiDir { 1_ra };
104 Scalar m_distFromCenter { 0_ra };
109 void setupKeyMappingCallbacks();
110 bool checkIntegrity(
const std::string& mess )
const;
111 static void configureKeyMapping_impl();
112 void clampThetaPhi();
113 void rotateCallback( QEvent* event );
114 void panCallback( QEvent* event );
115 void moveForwardCallback( QEvent* event );
116 void zoomCallback( QEvent* event );
117 void mousePressSaveData(
const QMouseEvent* mouseEvent );
121#define KeyMappingCamera \
122 KMA_VALUE( TRACKBALLCAMERA_ROTATE ) \
123 KMA_VALUE( TRACKBALLCAMERA_PAN ) \
124 KMA_VALUE( TRACKBALLCAMERA_ZOOM ) \
125 KMA_VALUE( TRACKBALLCAMERA_PROJ_MODE ) \
126 KMA_VALUE( TRACKBALLCAMERA_MOVE_FORWARD ) \
127 KMA_VALUE( CAMERA_TOGGLE_QUICK )
129#define KMA_VALUE( XX ) static KeyMappingManager::KeyMappingAction XX;