1 #include <glbinding-aux/ContextInfo.h>
2 #include <glbinding-aux/debug.h>
3 #include <glbinding-aux/types_to_string.h>
4 #include <glbinding/Binding.h>
5 #include <glbinding/glbinding.h>
7 #include <glbinding/Version.h>
9 #include <glbinding/gl/gl.h>
11 #include <globjects/globjects.h>
14 #include <Gui/Viewer/Viewer.hpp>
18 #include <QOpenGLContext>
20 #include <QApplication>
21 #include <QMouseEvent>
25 #define STB_IMAGE_WRITE_IMPLEMENTATION
26 #include <stb/stb_image_write.h>
28 #include <Core/Asset/Camera.hpp>
29 #include <Core/Asset/FileData.hpp>
30 #include <Core/Containers/MakeShared.hpp>
31 #include <Core/Math/Math.hpp>
32 #include <Core/Utils/Color.hpp>
33 #include <Core/Utils/Log.hpp>
34 #include <Core/Utils/StringUtils.hpp>
35 #include <Engine/Data/ShaderProgramManager.hpp>
36 #include <Engine/Data/ViewingParameters.hpp>
37 #include <Engine/Rendering/ForwardRenderer.hpp>
38 #include <Engine/Rendering/Renderer.hpp>
39 #include <Engine/Scene/CameraComponent.hpp>
40 #include <Engine/Scene/CameraManager.hpp>
41 #include <Engine/Scene/Component.hpp>
42 #include <Engine/Scene/DirLight.hpp>
43 #include <Engine/Scene/EntityManager.hpp>
44 #include <Engine/Scene/SystemDisplay.hpp>
45 #include <Gui/AboutDialog/RadiumHelpDialog.hpp>
46 #include <Gui/Utils/KeyMappingManager.hpp>
47 #include <Gui/Utils/Keyboard.hpp>
48 #include <Gui/Utils/PickingManager.hpp>
49 #include <Gui/Viewer/FlightCameraManipulator.hpp>
50 #include <Gui/Viewer/Gizmo/GizmoManager.hpp>
51 #include <Gui/Viewer/RotateAroundCameraManipulator.hpp>
52 #include <Gui/Viewer/TrackballCameraManipulator.hpp>
53 #include <Gui/Viewer/Viewer.hpp>
55 #include <QApplication>
56 #include <QMouseEvent>
63 using namespace Core::Utils;
64 using namespace glbinding;
66 using ViewerMapping = KeyMappingManageable<Viewer>;
68 #define KMA_VALUE( x ) KeyMappingManager::KeyMappingAction Viewer::x;
75 auto keyMappingManager = KeyMappingManager::getInstance();
80 keyMappingManager->addListener(
84 keyMappingManager->addListener( configureKeyMapping );
87 m_keyMappingCallbackManager.
addEventCallback( VIEWER_TOGGLE_WIREFRAME, [
this]( QEvent* event ) {
88 if ( event->type() == QEvent::KeyPress ) m_currentRenderer->toggleWireframe();
90 m_keyMappingCallbackManager.addEventCallback( VIEWER_RELOAD_SHADERS, [
this]( QEvent* event ) {
91 if ( event->type() == QEvent::KeyPress ) reloadShaders();
93 m_keyMappingCallbackManager.addEventCallback(
94 VIEWER_PICKING_MULTI_CIRCLE, [
this]( QEvent* event ) {
95 if ( event->type() == QEvent::KeyPress ) {
96 m_isBrushPickingEnabled = !m_isBrushPickingEnabled;
97 m_currentRenderer->setBrushRadius( m_isBrushPickingEnabled ? m_brushRadius : 0 );
98 emit toggleBrushPicking( m_isBrushPickingEnabled );
101 m_keyMappingCallbackManager.addEventCallback( VIEWER_SWITCH_CAMERA, []( QEvent* event ) {
102 if ( event->type() == QEvent::KeyPress ) {
103 auto cameraManager = static_cast<Ra::Engine::Scene::CameraManager*>(
104 Engine::RadiumEngine::getInstance()->getSystem(
"DefaultCameraManager" ) );
106 if ( cameraManager->count() > 0 ) {
107 idx %= cameraManager->count();
108 cameraManager->activate( idx );
114 m_keyMappingCallbackManager.addEventCallback( VIEWER_CAMERA_FIT_SCENE, [
this]( QEvent* event ) {
115 if ( event->type() == QEvent::KeyPress ) fitCamera();
117 m_keyMappingCallbackManager.addEventCallback( VIEWER_HELP, [
this]( QEvent* event ) {
118 if ( event->type() == QEvent::KeyPress ) {
125 void Viewer::configureKeyMapping_impl() {
126 auto keyMappingManager = KeyMappingManager::getInstance();
127 ViewerMapping::setContext( keyMappingManager->getContext(
"ViewerContext" ) );
128 if ( ViewerMapping::getContext().isInvalid() ) {
130 <<
"ViewerContext not defined (maybe the configuration file do not contains it)";
131 LOG( Ra::Core::Utils::logERROR ) <<
"ViewerContext all keymapping invalide !";
135 #define KMA_VALUE( XX ) XX = keyMappingManager->getAction( ViewerMapping::getContext(), #XX );
142 m_currentRenderer( nullptr ),
143 m_pickingManager( new PickingManager() ),
144 m_isBrushPickingEnabled( false ),
147 m_gizmoManager( nullptr ),
148 m_keyMappingCallbackManager {
ViewerMapping::getContext() } {}
151 if ( m_glInitialized.load() ) {
168 void Viewer::resetToDefaultCamera() {
171 Engine::RadiumEngine::getInstance()->getSystem(
"DefaultCameraManager" ) );
180 return m_currentRenderer;
184 return m_currentRenderer;
191 if ( m_glInitialized.load() ) {
194 LOG( logINFO ) <<
"[Viewer] New Renderer (" << e->getRendererName() <<
") added.";
198 LOG( logINFO ) <<
"[Viewer] New Renderer (" << e->getRendererName()
199 <<
") added with deferred init.";
200 m_pendingRenderers.push_back( e );
219 CORE_ASSERT( m_glInitialized.load(),
"OpenGL needs to be initialized before rendering." );
221 CORE_ASSERT( m_currentRenderer !=
nullptr,
"No renderer found." );
227 auto entityManager = Engine::RadiumEngine::getInstance()->getEntityManager();
228 if ( entityManager ) {
234 for (
const auto& entity : entityManager->getEntities() ) {
236 aabb.extend( entity->computeAabb() );
239 if ( !aabb.isEmpty() ) {
m_camera->getCamera()->fitZRange( aabb ); }
242 Engine::RadiumEngine::getInstance()->getSystem(
"DefaultCameraManager" ) );
245 m_camera->setCameraZNear( cameraManager->defaultCamera.getZNear() );
246 m_camera->setCameraZFar( cameraManager->defaultCamera.getZFar() );
252 if ( !m_currentRenderer->
hasLight() ) {
256 LOG( logDEBUG ) <<
"Unable to attach the head light!";
259 m_camera->getCamera()->getViewMatrix(),
m_camera->getCamera()->getProjMatrix(), dt };
260 m_currentRenderer->
render( data );
264 if ( isExposed() ) { m_context->swapBuffers(
this ); }
269 CORE_ASSERT( m_glInitialized.load(),
"OpenGL needs to be initialized before rendering." );
271 CORE_ASSERT( m_currentRenderer !=
nullptr,
"No renderer found." );
275 "There should be one result per query." );
281 if ( query.m_purpose == Engine::Rendering::Renderer::PickingPurpose::MANIPULATION ) {
290 if ( !aabb.isEmpty() ) {
291 CORE_ASSERT(
m_camera !=
nullptr,
"No camera found." );
298 else { LOG( logINFO ) <<
"Unable to fit the camera to the scene : empty Bbox."; }
301 void Viewer::fitCamera() {
302 auto aabb = Ra::Engine::RadiumEngine::getInstance()->computeSceneAabb();
308 std::vector<std::string> ret;
311 if ( renderer ) { ret.push_back( renderer->getRendererName() ); }
321 auto writtenPixels = m_currentRenderer->
grabFrame( w, h );
323 std::string ext = Core::Utils::getFileExt( filename );
325 if ( ext ==
"bmp" ) { stbi_write_bmp( filename.c_str(), w, h, 4, writtenPixels.get() ); }
326 else if ( ext ==
"png" ) {
327 stbi_write_png( filename.c_str(), w, h, 4, writtenPixels.get(), w * 4 *
sizeof( uchar ) );
330 LOG( logWARNING ) <<
"Cannot write frame to " << filename <<
" : unsupported extension";
336 void Viewer::enableDebug() {
337 glbinding::setCallbackMask( glbinding::CallbackMask::After |
338 glbinding::CallbackMask::ParametersAndReturnValue );
339 glbinding::setAfterCallback( [](
const glbinding::FunctionCall& call ) {
340 std::cerr << call.function->name() <<
"(";
341 for (
unsigned i = 0; i < call.parameters.size(); ++i ) {
342 std::cerr << call.parameters[i].get();
343 if ( i < call.parameters.size() - 1 ) { std::cerr <<
", "; }
346 if ( call.returnValue ) { std::cerr <<
" -> " << call.returnValue.get(); }
347 std::cerr << std::endl;
352 CORE_ASSERT( m_glInitialized.load(),
"OpenGL needs to be initialized reload shaders." );
365 CORE_ASSERT( m_glInitialized.load(),
"OpenGL needs to be initialized to display textures." );
377 if ( m_glInitialized.load() &&
m_renderers[index] ) {
380 if ( m_currentRenderer !=
nullptr ) { m_currentRenderer->
lockRendering(); }
384 auto deviceSize =
toDevice( { width(), height() } );
385 m_currentRenderer->
resize( deviceSize.x(), deviceSize.y() );
390 LOG( logINFO ) <<
"[Viewer] Set active renderer: " << m_currentRenderer->
getRendererName();
393 if (
m_camera ) {
m_camera->getCamera()->setViewport( deviceSize.x(), deviceSize.y() ); }
413 m_backgroundColor = background;
415 renderer->setBackgroundColor( m_backgroundColor );
420 void Viewer::onAboutToCompose() {
426 void Viewer::onAboutToResize() {
432 void Viewer::onResized() {
437 void Viewer::onFrameSwapped() {
448 auto deviceSize =
toDevice( { width(), height() } );
452 gl::glViewport( 0, 0, deviceSize.x(), deviceSize.y() );
454 renderer->
initialize( deviceSize.x(), deviceSize.y() );
460 globjects::init( getProcAddress );
462 m_glInitialized =
true;
464 LOG( logINFO ) <<
"*** Radium Engine OpenGL context ***";
465 LOG( logINFO ) <<
"Renderer (glbinding) : " << glbinding::aux::ContextInfo::renderer();
466 LOG( logINFO ) <<
"Vendor (glbinding) : " << glbinding::aux::ContextInfo::vendor();
467 LOG( logINFO ) <<
"OpenGL (glbinding) : "
468 << glbinding::aux::ContextInfo::version().toString();
469 LOG( logINFO ) <<
"GLSL : "
470 << gl::glGetString( gl::GLenum( GL_SHADING_LANGUAGE_VERSION ) );
472 LOG( logINFO ) <<
"*** Radium Engine Viewer ***";
479 auto deviceSize =
toDevice( { width(), height() } );
481 m_camera = std::make_unique<TrackballCameraManipulator>();
482 m_camera->getCamera()->setViewport( deviceSize.x(), deviceSize.y() );
484 Ra::Engine::Scene::SystemEntity::getInstance(),
"headlight" );
485 headlight->setColor( Ra::Core::Utils::Color::Grey( 1.0_ra ) );
491 Engine::RadiumEngine::getInstance()->getSystem(
"DefaultCameraManager" ) );
493 [
this, size = deviceSize]( Core::Utils::Index ) {
495 m_camera->getCamera()->setViewport( size.x(), size.y() );
499 for (
auto& rptr : m_pendingRenderers ) {
502 m_pendingRenderers.clear();
508 emit glInitialized();
513 LOG( logINFO ) <<
"[Viewer] No renderer added, adding default (Forward Renderer)";
514 std::shared_ptr<Ra::Engine::Rendering::Renderer> e(
521 return m_glInitialized;
527 auto deviceSize =
toDevice( {
event->size().width(), event->size().height() } );
528 gl::glViewport( 0, 0, deviceSize.x(), deviceSize.y() );
529 m_camera->getCamera()->setViewport( deviceSize.x(), deviceSize.y() );
530 m_currentRenderer->
resize( deviceSize.x(), deviceSize.y() );
537 if ( action == VIEWER_PICKING_VERTEX ) {
541 if ( action == VIEWER_PICKING_EDGE ) {
545 if ( action == VIEWER_PICKING_TRIANGLE ) {
553 void Viewer::propagateEventToParent( QEvent* event ) {
555 if ( !isTopLevel() ) { QApplication::sendEvent( parent(), event ); }
558 void Viewer::keyPressEvent( QKeyEvent* event ) {
559 keyPressed( event->key() );
560 if ( !m_glInitialized.load() || event->isAutoRepeat() || !handleKeyPressEvent( event ) )
561 propagateEventToParent( event );
566 void Viewer::keyReleaseEvent( QKeyEvent* event ) {
567 if ( !m_glInitialized.load() || !handleKeyReleaseEvent( event ) )
568 propagateEventToParent( event );
571 keyReleased( event->key() );
575 if ( !m_glInitialized.load() ) {
576 propagateEventToParent( event );
580 m_currentRenderer->setMousePosition(
toDevice( {
event->pos().x(), event->pos().y() } ) );
583 auto result = pickAtPosition(
toDevice( {
event->pos().x(), height() - event->pos().y() } ) );
584 m_depthUnderMouse = result.getDepth();
592 handleMouseReleaseEvent( event );
598 if ( !m_glInitialized.load() ) {
603 m_currentRenderer->setMousePosition(
toDevice( {
event->pos().x(), event->pos().y() } ) );
605 auto result = pickAtPosition(
toDevice( {
event->pos().x(), height() - event->pos().y() } ) );
606 m_depthUnderMouse = result.getDepth();
608 handleMouseMoveEvent( event, result );
615 if ( !m_glInitialized.load() ) {
620 handleWheelEvent( event );
625 void Viewer::showEvent( QShowEvent* ev ) {
626 WindowQt::showEvent( ev );
627 auto deviceSize =
toDevice( { width(), height() } );
628 m_camera->getCamera()->setViewport( deviceSize.x(), deviceSize.y() );
640 Viewer::getComponentActions(
const Qt::MouseButtons& buttons,
641 const Qt::KeyboardModifiers& modifiers,
644 auto keyMap = KeyMappingManager::getInstance();
647 keyMap->getAction( keyMap->getContext(
"CameraContext" ), buttons, modifiers, key, wheel );
649 keyMap->getAction( keyMap->getContext(
"GizmoContext" ), buttons, modifiers, key, wheel );
651 keyMap->getAction( keyMap->getContext(
"ViewerContext" ), buttons, modifiers, key, wheel );
652 return { actionCamera, actionGizmo, actionViewer };
655 bool Viewer::handleKeyPressEvent( QKeyEvent* event ) {
656 bool eventCatched =
false;
658 auto [actionCamera, actionGizmo, actionViewer] =
659 getComponentActions( Qt::NoButton, event->modifiers(), activeKey(),
false );
664 if ( actionCamera.isValid() ) {
665 eventCatched =
m_camera->handleKeyPressEvent( event, actionCamera );
667 else if ( actionGizmo.isValid() ) {
672 else if ( actionViewer.isValid() ) {
678 bool Viewer::handleKeyReleaseEvent( QKeyEvent* event ) {
679 bool eventCatched =
false;
683 auto [actionCamera, actionGizmo, actionViewer] =
684 getComponentActions( Qt::NoButton, event->modifiers(), activeKey(),
false );
686 if ( actionCamera.isValid() ) {
687 eventCatched =
m_camera->handleKeyReleaseEvent( event, actionCamera );
689 else if ( actionViewer.isValid() ) {
707 m_activeContext.setInvalid();
709 auto keyMap = KeyMappingManager::getInstance();
711 auto buttons =
event->buttons();
712 auto modifiers =
event->modifiers();
713 auto key = activeKey();
716 if ( result.getRoIdx().isInvalid() ) {
717 if (
m_camera->handleMousePressEvent( event, buttons, modifiers, key ) ) {
718 m_activeContext =
m_camera->mappingContext();
722 m_activeContext = KeyMappingManageable::getContext();
730 event, buttons, modifiers, key, *
m_camera->getCamera() ) ) {
731 m_activeContext = GizmoManager::getContext();
733 else if (
m_camera->handleMousePressEvent( event, buttons, modifiers, key ) ) {
734 m_activeContext =
m_camera->mappingContext();
737 m_activeContext = KeyMappingManageable::getContext();
738 auto action = keyMap->getAction( m_activeContext, buttons, modifiers, key );
739 auto pickingMode = getPickingMode( action );
744 toDevice( {
event->x(), height() - event->y() } ),
745 Engine::Rendering::Renderer::PickingPurpose::MANIPULATION,
753 void Viewer::handleMouseReleaseEvent( QMouseEvent* event ) {
754 if ( m_activeContext ==
m_camera->mappingContext() ) {
755 m_camera->handleMouseReleaseEvent( event );
757 if ( m_activeContext == GizmoManager::getContext() ) {
760 m_activeContext.setInvalid();
763 void Viewer::handleMouseMoveEvent( QMouseEvent* event,
766 auto keyMap = KeyMappingManager::getInstance();
767 auto buttons =
event->buttons();
768 auto modifiers =
event->modifiers();
769 auto key = activeKey();
773 if ( m_activeContext ==
m_camera->mappingContext() ) {
774 m_camera->handleMouseMoveEvent( event, buttons, modifiers, key );
776 else if ( m_activeContext == GizmoManager::getContext() ) {
778 event, buttons, modifiers, key, *
m_camera->getCamera() );
780 else if ( m_activeContext == KeyMappingManageable::getContext() ) {
781 auto action = keyMap->getAction( m_activeContext, buttons, modifiers, key );
782 auto pickingMode = getPickingMode( action );
784 Engine::Rendering::Renderer::PickingQuery query = {
785 toDevice( {
event->x(), height() - event->y() } ),
786 Engine::Rendering::Renderer::PickingPurpose::MANIPULATION,
794 void Viewer::handleWheelEvent( QWheelEvent* event ) {
796 auto keyMap = KeyMappingManager::getInstance();
797 auto buttons =
event->buttons();
798 auto modifiers =
event->modifiers();
799 auto key = activeKey();
801 keyMap->getAction( KeyMappingManageable::getContext(), buttons, modifiers, key,
true );
803 if ( action == VIEWER_SCALE_BRUSH && m_isBrushPickingEnabled ) {
805 (
event->angleDelta().y() * 0.01 +
event->angleDelta().x() * 0.01 ) > 0 ? 5 : -5;
806 m_brushRadius = std::max( m_brushRadius, Scalar( 5 ) );
807 m_currentRenderer->setBrushRadius( m_brushRadius );
809 else {
m_camera->handleWheelEvent( event, buttons, modifiers, key ); }
816 Engine::Rendering::Renderer::PickingPurpose::SELECTION,
818 {
m_camera->getCamera()->getViewMatrix(),
m_camera->getCamera()->getProjMatrix(), 0. } );
829 auto aabb = Ra::Engine::RadiumEngine::getInstance()->computeSceneAabb();
838 void Viewer::displayHelpDialog() {
839 if ( !m_helpDialog ) { m_helpDialog.reset(
new RadiumHelpDialog() ); }
840 m_helpDialog->show();
841 m_helpDialog->raise();
842 m_helpDialog->activateWindow();
848 std::function<
void( QEvent* )> callback ) {
int attach(Observer observer)
Result of a PickingQuery.
void render(const Data::ViewingParameters &renderData)
Tell the renderer it needs to render. This method does the following steps :
void initialize(uint width, uint height)
Initialize renderer.
PickingResult doPickingNow(const PickingQuery &query, const Data::ViewingParameters &renderData)
virtual void displayTexture(const std::string &texName)
Change the texture that is displayed on screen. Set m_displayedIsDepth to true if depth linearization...
void addPickingRequest(const PickingQuery &query)
virtual std::string getRendererName() const =0
Get the name of the renderer, e.g to be displayed in the UI.
void resize(uint width, uint height)
Resize the viewport and all the screen textures, fbos. This function must be overrided as soon as som...
void enableDebugDraw(bool enabled)
void enablePostProcess(bool enabled)
bool hasLight() const
Tell if the renderer has an usable light.
virtual void addLight(const Scene::Light *light)
int buildAllRenderTechniques() const
void setBackgroundColor(const Core::Utils::Color &color)
Update the background color (does not trigger a redraw)
virtual void reloadShaders()
virtual std::unique_ptr< uchar[]> grabFrame(size_t &w, size_t &h) const
@ C_VERTEX
Picks all vertices of a mesh within a screen space circle.
@ C_TRIANGLE
Picks all triangles of a mesh within a screen space circle.
@ C_EDGE
Picks all edges of a mesh within a screen space circle.
@ TRIANGLE
Pick a triangle of a mesh.
@ EDGE
Pick an edge of a mesh.
@ VERTEX
Pick a vertex of a mesh.
const std::vector< PickingResult > & getPickingResults() const
const std::vector< PickingQuery > & getPickingQueries() const
void resetActiveCamera()
reset the active camera data to default camera
Core::Utils::Observable< Core::Utils::Index > & activeCameraObservers()
get a ref to active camera observers to add/remove an observer
The CameraManipulator class is the generic class for camera manipulators.
virtual void resetCamera()=0
Reset the Camera settings to default values.
void updateValues() override
Retrieve the transform from the editable and update the gizmos.
virtual bool handleMouseMoveEvent(QMouseEvent *event, const Qt::MouseButtons &buttons, const Qt::KeyboardModifiers &modifiers, int key, const Core::Asset::Camera &cam)
void handlePickingResult(int drawableId)
Callback when a drawable is picked.
This class manage a collection of binding/callback associated with a context.
bool triggerEventCallback(QEvent *event, int key, bool wheel=false)
void addEventCallback(KeyMappingAction action, Callback callback)
KeyMappingManager::KeyMappingAction addActionAndCallback(const std::string &actionName, const KeyMappingManager::EventBinding &binding, Callback callback)
static void configureKeyMapping()
Inner class to store event binding.
Ra::Core::Utils::Index KeyMappingAction
handle to an action
virtual bool prepareDisplay()
void resizeGL(QResizeEvent *event) override
Resize the view port and the camera. Called by the resize event.
std::unique_ptr< CameraManipulator > m_camera
Owning pointer to the camera.
void startRendering(const Scalar dt)
Start rendering (potentially asynchronously in a separate thread)
bool initializeGL() override
void initializeRenderer(Engine::Rendering::Renderer *renderer)
Initialize renderer internal state + configure lights.
void enableDebugDraw(int enabled)
Toggle the debug drawing.
void swapBuffers()
Blocks until rendering is finished.
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 enablePostProcess(int enabled)
Toggle the post-process effetcs.
void onMousePress(QMouseEvent *event)
Event sent after a mouse press event has been processed, but before emitting needUpdate()
void mouseReleaseEvent(QMouseEvent *event) override
virtual void update(const Scalar dt)
Update the internal viewer state to the (application) time dt.
int addRenderer(const std::shared_ptr< Engine::Rendering::Renderer > &e)
PickingManager * getPickingManager()
Access to the feature picking manager.
std::vector< std::shared_ptr< Engine::Rendering::Renderer > > m_renderers
Core::Vector2 toDevice(const Core::Vector2 &logicCoordinates)
void mouseMoveEvent(QMouseEvent *event) override
void reloadShaders()
Tell the renderer to reload all shaders.
std::vector< std::string > getRenderersName() const
Returns the names of the different registred renderers.
void mousePressEvent(QMouseEvent *event) override
KeyMappingManager::KeyMappingAction addCustomAction(const std::string &actionName, const KeyMappingManager::EventBinding &binding, std::function< void(QEvent *)> callback)
Add a custom event callback.
Viewer(QScreen *screen=nullptr)
Constructor.
bool changeRenderer(int index)
Set the renderer.
void displayTexture(const QString &tex)
Set the final display texture.
void setCameraManipulator(CameraManipulator *ci)
Set the current camera interface.
const Engine::Rendering::Renderer * getRenderer() const
Read-only access to renderer.
void onMouseRelease(QMouseEvent *event)
Event sent after a mouse release event has been processed, but before emitting needUpdate()
virtual void setupKeyMappingCallbacks()
add observers to keyMappingManager for gizmo, camera and viewer.
void grabFrame(const std::string &filename)
Write the current frame as an image. Supports either BMP or PNG file names.
void createGizmoManager()
create gizmos
void fitCameraToScene(const Core::Aabb &sceneAabb)
Moves the camera so that the whole scene is visible.
~Viewer() override
Destructor.
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.
GizmoManager * getGizmoManager()
Access to gizmo manager.
void wheelEvent(QWheelEvent *event) override
CameraManipulator * getCameraManipulator()
Access to camera interface.
void onMouseMove(QMouseEvent *event)
Event sent after a mouse move event has been processed, but before emitting needUpdate()
void focusOutEvent(QFocusEvent *event) override
reset key pressed, in case a key is pressed when focus lost
void processPicking()
Emits signals corresponding to picking requests.
virtual void handleMousePressEvent(QMouseEvent *event, Ra::Engine::Rendering::Renderer::PickingResult &result)
Base class for OpenGL widgets, compatble with Qt and globjects/glbindings.
ScopedGLContext activateScopedContext()
QOpenGLContext * context()
the set of viewing parameters extracted from the camera and given to the renderer