3#include <Gui/RaGui.hpp>
5#include <Core/CoreMacros.hpp>
7#include <Engine/RadiumEngine.hpp>
8#include <Engine/Rendering/Renderer.hpp>
9#include <Engine/Scene/CameraComponent.hpp>
10#include <Gui/Utils/KeyMappingManager.hpp>
11#include <Gui/Viewer/WindowQt.hpp>
25class CameraManipulator;
28class RadiumHelpDialog;
60 explicit Viewer( QScreen* screen =
nullptr );
66 virtual void setupKeyMappingCallbacks();
73 virtual bool prepareDisplay();
79 QOpenGLContext*
getContext()
const {
return m_context.get(); }
87 void resetToDefaultCamera();
112 PickingManager* getPickingManager();
118 virtual void update(
const Scalar dt );
124 void startRendering(
const Scalar dt );
134 void processPicking();
137 void fitCameraToScene(
const Core::Aabb& sceneAabb );
157 Scalar getDepthUnderMouse()
const {
return m_depthUnderMouse; }
165 Core::Vector2
toDevice(
const Core::Vector2& logicCoordinates ) {
166 return static_cast<Scalar
>( devicePixelRatio() ) * logicCoordinates;
173 bool glInitialized();
193 void reloadShaders();
196 void displayTexture(
const QString& tex );
199 bool changeRenderer(
int index );
202 void enablePostProcess(
int enabled );
205 void enableDebugDraw(
int enabled );
209 void displayHelpDialog();
214 void onAboutToCompose();
215 void onAboutToResize();
217 void onFrameSwapped();
221 void createGizmoManager();
230 bool initializeGL()
override;
233 void resizeGL( QResizeEvent* event )
override;
243 void keyPressEvent( QKeyEvent* event )
override;
244 void keyReleaseEvent( QKeyEvent* event )
override;
248 void mousePressEvent( QMouseEvent* event )
override;
250 void mouseReleaseEvent( QMouseEvent* event )
override;
252 void mouseMoveEvent( QMouseEvent* event )
override;
254 void wheelEvent( QWheelEvent* event )
override;
257 void showEvent( QShowEvent* ev )
override;
260 void focusOutEvent( QFocusEvent* event )
override;
266 virtual bool handleKeyPressEvent( QKeyEvent* event );
267 virtual bool handleKeyReleaseEvent( QKeyEvent* event );
268 virtual void handleMousePressEvent( QMouseEvent* event,
270 virtual void handleMouseReleaseEvent( QMouseEvent* event );
271 virtual void handleMouseMoveEvent( QMouseEvent* event,
273 virtual void handleWheelEvent( QWheelEvent* event );
280 static void configureKeyMapping_impl();
284 void propagateEventToParent( QEvent* event );
289 getComponentActions(
const Qt::MouseButtons& buttons,
290 const Qt::KeyboardModifiers& modifiers,
294 Scalar m_depthUnderMouse;
307 bool m_isBrushPickingEnabled;
308 Scalar m_brushRadius;
328#define KeyMappingViewer \
329 KMA_VALUE( VIEWER_PICKING ) \
330 KMA_VALUE( VIEWER_PICKING_VERTEX ) \
331 KMA_VALUE( VIEWER_PICKING_EDGE ) \
332 KMA_VALUE( VIEWER_PICKING_TRIANGLE ) \
333 KMA_VALUE( VIEWER_PICKING_MULTI_CIRCLE ) \
334 KMA_VALUE( VIEWER_RAYCAST ) \
335 KMA_VALUE( VIEWER_SCALE_BRUSH ) \
336 KMA_VALUE( VIEWER_RELOAD_SHADERS ) \
337 KMA_VALUE( VIEWER_TOGGLE_WIREFRAME ) \
338 KMA_VALUE( VIEWER_SWITCH_CAMERA ) \
339 KMA_VALUE( VIEWER_CAMERA_FIT_SCENE ) \
340 KMA_VALUE( VIEWER_HELP )
342#define KMA_VALUE( x ) static KeyMappingManager::KeyMappingAction x;
Result of a PickingQuery.
The CameraManipulator class is the generic class for camera manipulators.
This class manage a collection of binding/callback associated with a context.
KeyMappingManageable decorator to use as CRTP.
Inner class to store event binding.
Ra::Core::Utils::Index KeyMappingAction
handle to an action
Ra::Core::Utils::Index Context
handle to a Context
const Core::Utils::Color & getBackgroundColor() const
get the currently used background color
std::unique_ptr< CameraManipulator > m_camera
Owning pointer to the camera.
KeyEventType
Name of the customisable key actions.
PickingManager * m_pickingManager
Owning Pointer to the feature picking manager.
void rendererReady()
Emitted when GL context is ready. We except call to addRenderer here.
void requestEngineOpenGLInitialization()
void onMousePress(QMouseEvent *event)
Event sent after a mouse press event has been processed, but before emitting needUpdate()
void toggleBrushPicking(bool on)
Emitted when the corresponding key is released (see keyReleaseEvent)
std::vector< std::shared_ptr< Engine::Rendering::Renderer > > m_renderers
Core::Vector2 toDevice(const Core::Vector2 &logicCoordinates)
QOpenGLContext * getContext() const
Access to the OpenGL context of the Viewer.
void onMouseRelease(QMouseEvent *event)
Event sent after a mouse release event has been processed, but before emitting needUpdate()
std::array< std::map< Core::Utils::Index, std::function< void(QKeyEvent *)> >, KeyEventTypeCount > m_customKeyActions
GizmoManager * m_gizmoManager
Owning (QObject child) pointer to gizmo manager.
void rightClickPicking(const Ra::Engine::Rendering::Renderer::PickingResult &result)
Emitted when the rendered is correctly initialized.
void onMouseMove(QMouseEvent *event)
Event sent after a mouse move event has been processed, but before emitting needUpdate()
Base class for OpenGL widgets, compatble with Qt and globjects/glbindings.
hepler function to manage enum as underlying types in VariableSet