From 8067b205f4e6419ee1a6bec98245787858525d33 Mon Sep 17 00:00:00 2001 From: Mathias Paulin <mathias.paulin@irit.fr> Date: Thu, 25 Mar 2021 08:50:46 +0100 Subject: [PATCH] Add some todos to remember what's next --- src/DemoApp/main.cpp | 44 ++++++++++--------- src/libRender/RadiumNBR/Gui/RendererPanel.cpp | 4 +- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/src/DemoApp/main.cpp b/src/DemoApp/main.cpp index c54ff6f..9c7b0d2 100644 --- a/src/DemoApp/main.cpp +++ b/src/DemoApp/main.cpp @@ -57,25 +57,6 @@ class RendererController : public RadiumNBR::VisualizationController }; }; -/** - * Define a factory that set the wanted renderer on the window - */ -class DemoWindowFactory : public Ra::Gui::BaseApplication::WindowFactory -{ - public: - DemoWindowFactory() = delete; - ~DemoWindowFactory() = default; - explicit DemoWindowFactory( std::shared_ptr<RadiumNBR::NodeBasedRenderer> r ) : renderer( r ) {} - inline Ra::Gui::MainWindowInterface* createMainWindow() const override { - auto window = new Ra::Gui::SimpleWindow(); - window->addRenderer( renderer->getRendererName(), renderer ); - return window; - } - - private: - std::shared_ptr<RadiumNBR::NodeBasedRenderer> renderer; -}; - /** Process the scene to add the custom attribs to all objects */ void AddCustomAttributeToMeshes() { @@ -184,6 +165,29 @@ const std::string customFragmentColor{ "return vec4( (specColor+col)*max(lightDir.z, 0), 1); \n" "}\n"}; +/** + * Main code to demonstrate the use of a self configured node based renderer + */ + +/** + * Define a factory that set the wanted renderer on the window + */ +class DemoWindowFactory : public Ra::Gui::BaseApplication::WindowFactory +{ + public: + DemoWindowFactory() = delete; + ~DemoWindowFactory() = default; + explicit DemoWindowFactory( std::shared_ptr<RadiumNBR::NodeBasedRenderer> r ) : renderer( r ) {} + inline Ra::Gui::MainWindowInterface* createMainWindow() const override { + auto window = new Ra::Gui::SimpleWindow(); + window->addRenderer( renderer->getRendererName(), renderer ); + return window; + } + + private: + std::shared_ptr<RadiumNBR::NodeBasedRenderer> renderer; +}; + /** * main function. */ @@ -215,7 +219,7 @@ int main( int argc, char* argv[] ) { return app.exec(); } - +// Will be removed soon #if 0 int main( int argc, char* argv[] ) { diff --git a/src/libRender/RadiumNBR/Gui/RendererPanel.cpp b/src/libRender/RadiumNBR/Gui/RendererPanel.cpp index 518fabb..8cd9070 100644 --- a/src/libRender/RadiumNBR/Gui/RendererPanel.cpp +++ b/src/libRender/RadiumNBR/Gui/RendererPanel.cpp @@ -168,7 +168,9 @@ void RendererPanel::addSeparator() { void RendererPanel::addCodeEditor( const std::string& name, std::function<void( std::string )> callback, const std::string& initialText ) { - +// @todo : get a full featured code editor +// cf https://www.codeproject.com/Articles/1139741/QCodeEditor-Widget-for-Qt +// (code at https://www.codeproject.com/script/Articles/ViewDownloads.aspx?aid=1139741) auto button = new QPushButton( name.c_str(), this ); QDialog* dialog = nullptr; auto editDialog = [this, callback, initialText, dialog]() mutable { -- GitLab