diff --git a/src/DemoApp/main.cpp b/src/DemoApp/main.cpp index c54ff6f722b48d7cb11c15e73c08b2c11d30a430..9c7b0d26205cf0dd780942f0e9e04de527c7790c 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 518fabb2caee7ecb547fa8a614dada5ed36ff22f..8cd9070678c1d3e33cfad7600ae9fed11bb351c2 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 {