diff --git a/lib/ui/src/ui/qt/tool/render/widget/opengl_widget.cpp b/lib/ui/src/ui/qt/tool/render/widget/opengl_widget.cpp index c13ab36ae..f133bf6ec 100644 --- a/lib/ui/src/ui/qt/tool/render/widget/opengl_widget.cpp +++ b/lib/ui/src/ui/qt/tool/render/widget/opengl_widget.cpp @@ -3,8 +3,11 @@ #include #include #include +#include +#include #include #include +#include #include namespace VTX::UI::QT::Tool::Render::Widget @@ -18,6 +21,22 @@ namespace VTX::UI::QT::Tool::Render::Widget format.setSwapBehavior( QSurfaceFormat::DoubleBuffer ); format.setSwapInterval( 0 ); QSurfaceFormat::setDefaultFormat( format ); + + // TO_REMOVE : Force update camera position + App::VTXApp::get().onUpdate().addCallback( + this, + []( const float p_deltaTime ) + { + const App::Component::Scene::Transform & transformComponent + = App::MAIN_REGISTRY().getComponent( App::SCENE().getCamera() ); + + const App::Component::Render::ProxyCamera & proxyComponent + = App::MAIN_REGISTRY().getComponent( App::SCENE().getCamera() + ); + + proxyComponent.getProxy().onCameraPosition( transformComponent.getPosition() ); + } + ); } OpenGLWidget::~OpenGLWidget() {} @@ -29,6 +48,7 @@ namespace VTX::UI::QT::Tool::Render::Widget App::RENDERER().build( defaultFramebufferObject() ); App::VTXApp::get().onPostRender().addCallback( this, [ this ]( float p_deltaTime ) { update(); } ); App::RENDERER().setProxyColorLayout( VTX::Core::ChemDB::Color::COLOR_LAYOUT_JMOL ); + App::RENDERER().setProxyRepresentations( { VTX::Renderer::Proxy::Representation() } ); } void OpenGLWidget::paintGL() { VTX::App::VTXApp::get().getRenderer().render( 0.15f ); }