Radium Engine  1.5.20
Loading...
Searching...
No Matches
FlightCameraManipulator.hpp
1#pragma once
2#include <Gui/RaGui.hpp>
3
4#include <Core/Asset/Camera.hpp>
5#include <Engine/Scene/CameraComponent.hpp>
6#include <Gui/Viewer/CameraManipulator.hpp>
7
8namespace Ra {
9namespace Gui {
10
14 public KeyMappingManageable<FlightCameraManipulator>
15{
16 Q_OBJECT
19
20 public:
22
24 explicit FlightCameraManipulator( const CameraManipulator& other );
26
27 KeyMappingManager::Context mappingContext() override;
28 bool handleMousePressEvent( QMouseEvent* event,
29 const Qt::MouseButtons& buttons,
30 const Qt::KeyboardModifiers& modifiers,
31 int key ) override;
32 bool handleMouseReleaseEvent( QMouseEvent* event ) override;
33 bool handleMouseMoveEvent( QMouseEvent* event,
34 const Qt::MouseButtons& buttons,
35 const Qt::KeyboardModifiers& modifiers,
36 int key ) override;
37 bool handleWheelEvent( QWheelEvent* event,
38 const Qt::MouseButtons& buttons,
39 const Qt::KeyboardModifiers& modifiers,
40 int key ) override;
41
42 bool handleKeyPressEvent( QKeyEvent* event,
43 const KeyMappingManager::KeyMappingAction& action ) override;
44
45 void updateCamera() override;
46
47 public slots:
48 void setCameraPosition( const Core::Vector3& position ) override;
49 void setCameraTarget( const Core::Vector3& target ) override;
50 void fitScene( const Core::Aabb& aabb ) override;
51
52 void resetCamera() override;
53
54 protected:
55 virtual void handleCameraRotate( Scalar dx, Scalar dy );
56 virtual void handleCameraPan( Scalar dx, Scalar dy );
57 virtual void handleCameraZoom( Scalar dx, Scalar dy );
58 virtual void handleCameraZoom( Scalar z );
59
60 private:
61 void setupKeyMappingCallbacks();
62 void panCallback( QEvent* event );
63 void rotateCallback( QEvent* event );
64 void zoomCallback( QEvent* event );
65
66 KeyMappingCallbackManager m_keyMappingCallbackManager;
67
68 void initializeFixedUpVector();
69 Ra::Core::Vector3 m_fixUpVector { 0_ra, 1_ra, 0_ra };
70 Scalar m_flightSpeed { 1._ra };
71 static void configureKeyMapping_impl();
72
73 protected:
74#define KeyMappingFlightManipulator \
75 KMA_VALUE( FLIGHTMODECAMERA_PAN ) \
76 KMA_VALUE( FLIGHTMODECAMERA_ROTATE ) \
77 KMA_VALUE( FLIGHTMODECAMERA_ZOOM )
78
79#define KMA_VALUE( XX ) static KeyMappingManager::KeyMappingAction XX;
80 KeyMappingFlightManipulator
81#undef KMA_VALUE
82};
83
84} // namespace Gui
85} // namespace Ra
The CameraManipulator class is the generic class for camera manipulators.
virtual ~FlightCameraManipulator()
[Constructor]
This class manage a collection of binding/callback associated with a context.
KeyMappingManageable decorator to use as CRTP.
Ra::Core::Utils::Index KeyMappingAction
handle to an action
Ra::Core::Utils::Index Context
handle to a Context
hepler function to manage enum as underlying types in VariableSet
Definition Cage.cpp:3