Skip to content
Snippets Groups Projects
Commit 52997cdb authored by Mathias Paulin's avatar Mathias Paulin :speech_balloon:
Browse files

Prepare for Radium integration - GuiBase

parent 4d4cad8b
Branches
No related tags found
No related merge requests found
#include <Gui/MainWindow.hpp>
#include <RadiumNBR/Gui/RendererPanel.hpp>
#include <RadiumNBR/GuiBase/RendererPanel.hpp>
#include <tuple>
......@@ -115,7 +115,7 @@ void MainWindow::onGLInitialized() {
// The renderer
auto forwardRenderer = std::make_shared<ForwardRenderer>();
// its control panel
auto controlPanel = new RadiumNBR::RendererPanel( "Forward Renderer" );
auto controlPanel = new RadiumNBR::GuiBase::RendererPanel( "Forward Renderer" );
auto defColor = Ra::Core::Utils::Color::linearRGBTosRGB( m_viewer->getBackgroundColor() );
auto clrClbck = [this]( const Ra::Core::Utils::Color& clr ) {
this->m_viewer->setBackgroundColor( clr );
......@@ -144,7 +144,7 @@ void MainWindow::addRenderer( const std::string& name, std::shared_ptr<Renderer>
void MainWindow::addRenderer( const std::string& name,
std::shared_ptr<Ra::Engine::Renderer> e,
RadiumNBR::RendererPanel* controlPanel ) {
RadiumNBR::GuiBase::RendererPanel* controlPanel ) {
auto id = m_viewer->addRenderer( e );
auto rendererCallback = [this, id]() { return this->m_viewer->changeRenderer( id ); };
m_rendererControler->addRenderer( name, e.get(), rendererCallback, controlPanel );
......
......@@ -57,7 +57,7 @@ class MainWindow : public Ra::GuiBase::MainWindowInterface, private Ui::MainWind
/// Add render in the application: UI, viewer.
void addRenderer( const std::string& name,
std::shared_ptr<Ra::Engine::Renderer> e,
RadiumNBR::RendererPanel* controlPanel );
RadiumNBR::GuiBase::RendererPanel* controlPanel );
/// Add a control to the application. This is defined a menu entry and an interaction panel
void addControl( const QString& tabName, const QKeySequence& shortcut );
......
......@@ -40,7 +40,7 @@ RendererControl::RendererControl( QWidget* /*parent*/ ) {
void RendererControl::addRenderer( const std::string& rendererName,
Ra::Engine::Renderer* const renderer,
std::function<bool()> callback,
RadiumNBR::RendererPanel* controlPanel ) {
RadiumNBR::GuiBase::RendererPanel* controlPanel ) {
m_renderersPanels.push_back( controlPanel );
if ( controlPanel != nullptr )
{
......
......@@ -3,7 +3,7 @@
#include <functional>
#include <vector>
#include <RadiumNBR/Gui/RendererPanel.hpp>
#include <RadiumNBR/GuiBase/RendererPanel.hpp>
namespace Ra::Engine {
class Renderer;
......@@ -52,9 +52,9 @@ class RendererControl : public QFrame, private Ui::RendererControler
* @param controlPanel The renderer specific control gui.
*/
void addRenderer( const std::string& rendererName,
Ra::Engine::Renderer* renderer,
Ra::Engine::Renderer* constrenderer,
std::function<bool()> callback,
RadiumNBR::RendererPanel* controlPanel = nullptr );
RadiumNBR::GuiBase::RendererPanel* controlPanel = nullptr );
signals:
/// Signal emitted when an internal state of the active renderer was changed.
......@@ -81,7 +81,7 @@ class RendererControl : public QFrame, private Ui::RendererControler
/// The Renderers/callbacks managed by the gui
std::vector<RendererInfo> m_renderersCallbacks;
/// The renderers specific control gui
std::vector<RadiumNBR::RendererPanel*> m_renderersPanels;
std::vector<RadiumNBR::GuiBase::RendererPanel*> m_renderersPanels;
/// combo bos to select one renderer output for display
QComboBox* m_textureList{ nullptr };
......
......@@ -156,12 +156,12 @@ set(gui_markdowns
set(gui_sources
RadiumNBR/Gui/NodeBasedRendererGui.cpp
RadiumNBR/Gui/RendererPanel.cpp
RadiumNBR/GuiBase/RendererPanel.cpp
)
set(gui_public_headers
RadiumNBR/Gui/NodeBasedRendererGui.hpp
RadiumNBR/Gui/RendererPanel.hpp
RadiumNBR/GuiBase/RendererPanel.hpp
)
set(gui_headers
......@@ -195,6 +195,8 @@ target_link_libraries(
)
message("Configure library ${PROJECT_NAME}/${libName}Gui for insertion into Radium exosystem")
# As the library use the same export macro than the renderer :
target_compile_definitions(${libName}Gui PRIVATE ${libName}_EXPORTS)
#add_package_component(
configure_radium_library(
TARGET ${libName}Gui
......
#include <RadiumNBR/Gui/NodeBasedRendererGui.hpp>
#include <RadiumNBR/NodeBasedRenderer.hpp>
namespace RadiumNBR {
using namespace GuiBase;
RadiumNBR::RendererPanel* buildRadiumNBRGui( NodeBasedRenderer* renderer, std::function<void()> appUpdateCallback ) {
RadiumNBR::GuiBase::RendererPanel* buildRadiumNBRGui( NodeBasedRenderer* renderer,
std::function<void()> appUpdateCallback ) {
auto controlPanel = new RendererPanel( renderer->getRendererName() );
auto defColor = Ra::Core::Utils::Color::linearRGBTosRGB( renderer->getBackgroundColor() );
......
#pragma once
#include <RadiumNBR/GuiBase/RendererPanel.hpp>
#include <RadiumNBR/NodeBasedRendererMacro.hpp>
#include <RadiumNBR/Gui/RendererPanel.hpp>
namespace RadiumNBR {
class NodeBasedRenderer;
NodeBasedRenderer_LIBRARY_API RadiumNBR::RendererPanel*
NodeBasedRenderer_LIBRARY_API RadiumNBR::GuiBase::RendererPanel*
buildRadiumNBRGui( NodeBasedRenderer* renderer, std::function<void()> appUpdateCallback );
} // namespace RadiumNBR
#include <RadiumNBR/Gui/RendererPanel.hpp>
#include <RadiumNBR/GuiBase/RendererPanel.hpp>
#include <QLabel>
#include <QVBoxLayout>
......@@ -11,6 +11,8 @@
#include <QSlider>
namespace RadiumNBR {
namespace GuiBase {
RendererPanel::RendererPanel( const std::string& name, QWidget* parent ) : QFrame( parent ) {
setObjectName( name.c_str() );
auto panelName = new QLabel( this );
......@@ -124,4 +126,5 @@ void RendererPanel::addFileInput( const std::string& name,
connect( button, &QPushButton::clicked, fileDialog );
m_contentLayout->addWidget( button );
}
}
} // namespace GuiBase
} // namespace RadiumNBR
......@@ -10,6 +10,7 @@
#include <Core/Utils/Color.hpp>
namespace RadiumNBR {
namespace GuiBase {
/**
* Renderer specific gui.
* A renderer panel will expose all configurable options of a renderer to allow the user to
......@@ -102,4 +103,5 @@ class NodeBasedRenderer_LIBRARY_API RendererPanel : public QFrame
/// The layout to organise the ui elements
QVBoxLayout* m_contentLayout;
};
}
} // namespace GuiBase
} // namespace RadiumNBR
#pragma once
#include <Core/CoreMacros.hpp>
/// Defines the correct macro to export dll symbols.
#if defined NodeBasedRenderer_EXPORTS
#if defined NBR_EXPORTS
# define NodeBasedRenderer_LIBRARY_API DLL_EXPORT
#else
# define NodeBasedRenderer_LIBRARY_API DLL_IMPORT
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment