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

[node] Begin NodeAdapterModel usage generalization - editable parameter now...

[node] Begin NodeAdapterModel usage generalization - editable parameter now has ref instead of pointer to data and SourceNodeModel is made obsolete (to be removed)
parent f86d5e27
Branches
No related tags found
No related merge requests found
Showing
with 298 additions and 163 deletions
...@@ -218,6 +218,25 @@ void RadiumPlayer::addRenderers() { ...@@ -218,6 +218,25 @@ void RadiumPlayer::addRenderers() {
// 2 - Initialize the renderer using default or customized NodeGraphController // 2 - Initialize the renderer using default or customized NodeGraphController
auto renderControl = new RadiumNBR::NodeGraphController; auto renderControl = new RadiumNBR::NodeGraphController;
auto myRenderer = std::make_shared<RadiumNBR::NodeBasedRenderer>( *renderControl ); auto myRenderer = std::make_shared<RadiumNBR::NodeBasedRenderer>( *renderControl );
// TODO find why this is problematic as the graph is not displayed in the editor
#if 1
// 3 - load default graph or user provided graph
auto resourcesCheck =
Ra::Core::Resources::getResourcesPath( nullptr, { "Resources/RadiumNBR" } );
if ( !resourcesCheck )
{
LOG( Ra::Core::Utils::logERROR ) << "Unable to find resources for FakeNBRRenderer!";
return;
}
if ( m_graphOption.has_value() ) { myRenderer->setJsonFilePath( m_graphOption.value() ); }
else
{
auto resourcesPath{ *resourcesCheck };
myRenderer->setJsonFilePath( resourcesPath + "RenderGraphs/fullfeaturerenderer.flow" );
}
myRenderer->signalReloadJson();
#endif
std::string rendererName = myRenderer->getRendererName(); std::string rendererName = myRenderer->getRendererName();
// The panel returned by buildNodeGraphControllerGui will manage the Qt NodeEditor window // The panel returned by buildNodeGraphControllerGui will manage the Qt NodeEditor window
...@@ -226,6 +245,7 @@ void RadiumPlayer::addRenderers() { ...@@ -226,6 +245,7 @@ void RadiumPlayer::addRenderers() {
auto controlPanel = RadiumNBR::buildNodeGraphControllerGui( auto controlPanel = RadiumNBR::buildNodeGraphControllerGui(
myRenderer.get(), [this]() { this->askForUpdate(); } ); myRenderer.get(), [this]() { this->askForUpdate(); } );
mainWindow->addRenderer( rendererName, myRenderer, controlPanel ); mainWindow->addRenderer( rendererName, myRenderer, controlPanel );
} }
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#include <QColorDialog> #include <QColorDialog>
#include <QCoreApplication> #include <QCoreApplication>
#include <RadiumNBR/EnvMap.hpp>
#include <RadiumNBR/Gui/PowerSlider.hpp> #include <RadiumNBR/Gui/PowerSlider.hpp>
#include <RadiumNBR/Gui/RenderGraphEditor/ColorSlider.hpp> #include <RadiumNBR/Gui/RenderGraphEditor/ColorSlider.hpp>
#include <RadiumNBR/Gui/TransferEditor.hpp> #include <RadiumNBR/Gui/TransferEditor.hpp>
...@@ -16,6 +18,7 @@ ...@@ -16,6 +18,7 @@
#include <RadiumNBR/NodeBasedRenderer.hpp> #include <RadiumNBR/NodeBasedRenderer.hpp>
#include <RadiumNBR/Gui/RenderGraphEditor/WidgetFactory.hpp> #include <RadiumNBR/Gui/RenderGraphEditor/WidgetFactory.hpp>
#include <RadiumNBR/Gui/RendererPanel.hpp>
RenderGraphEditorView::RenderGraphEditorView( QWidget* parent ) : QWidget( parent, Qt::Window ) { RenderGraphEditorView::RenderGraphEditorView( QWidget* parent ) : QWidget( parent, Qt::Window ) {
QtNodes::ConnectionStyle::setConnectionStyle( QtNodes::ConnectionStyle::setConnectionStyle(
...@@ -66,13 +69,55 @@ RenderGraphEditorView::RenderGraphEditorView( QWidget* parent ) : QWidget( paren ...@@ -66,13 +69,55 @@ RenderGraphEditorView::RenderGraphEditorView( QWidget* parent ) : QWidget( paren
QCoreApplication::instance()->installEventFilter( this ); QCoreApplication::instance()->installEventFilter( this );
// Create widgets // Create widgets
WidgetFactory::registerWidget<std::shared_ptr<RadiumNBR::EnvMap>>(
[] (EditableParameterBase* editableParameter) {
auto editableEnvMap =
dynamic_cast<EditableParameter<std::shared_ptr<RadiumNBR::EnvMap>>*>( editableParameter );
auto controlPanel = new RadiumNBR::Gui::RendererPanel( "EnvMap", false );
auto envmpClbck = [editableEnvMap, controlPanel]( const std::string& files ) {
if ( files.empty() ) { editableEnvMap->m_data = nullptr; }
else
{
auto t = ( files.find( ';' ) != files.npos )
? RadiumNBR::EnvMap::EnvMapType::ENVMAP_CUBE
: RadiumNBR::EnvMap::EnvMapType::ENVMAP_PFM;
if ( t == RadiumNBR::EnvMap::EnvMapType::ENVMAP_PFM )
{
auto ext = files.substr( files.size() - 3 );
if ( ext != "pfm" ) { t = RadiumNBR::EnvMap::EnvMapType::ENVMAP_LATLON; }
}
// for now, only skyboxes are managed
editableEnvMap->m_data = std::make_shared<RadiumNBR::EnvMap>( files, t, true );
auto slider = controlPanel->findChild<PowerSlider*>( "Strength" );
if ( slider ) { editableEnvMap->m_data->setEnvStrength( slider->value() / 100. ); }
}
};
controlPanel->addFileInput(
"Image(s)", envmpClbck, "../", "Images (*.png *.jpg *.pfm *.exr *hdr)" );
auto strengthClbk = [editableEnvMap]( double v ) {
if ( editableEnvMap->m_data )
{
auto* env = editableEnvMap->m_data.get();
if ( env ) { env->setEnvStrength( v / 100. ); }
}
};
float s_init = 100.;
if ( editableEnvMap->m_data ) { s_init = editableEnvMap->m_data->getEnvStrength() * 100.; }
controlPanel->addPowerSliderInput( "Strength", strengthClbk, s_init, 0., 100 );
controlPanel->setVisible( true );
return controlPanel;
}
);
WidgetFactory::registerWidget<Scalar>( WidgetFactory::registerWidget<Scalar>(
[] (EditableParameterBase* editableParameter) { [] (EditableParameterBase* editableParameter) {
auto editableScalar = auto editableScalar =
dynamic_cast<EditableParameter<Scalar>*>( editableParameter ); dynamic_cast<EditableParameter<Scalar>*>( editableParameter );
auto powerSlider = new PowerSlider(); auto powerSlider = new PowerSlider();
powerSlider->setValue( *editableScalar->m_data ); powerSlider->setValue( editableScalar->m_data );
if ( editableScalar->additionalData.size() >= 2 ) if ( editableScalar->additionalData.size() >= 2 )
{ {
powerSlider->setRange( editableScalar->additionalData[0], powerSlider->setRange( editableScalar->additionalData[0],
...@@ -84,7 +129,7 @@ RenderGraphEditorView::RenderGraphEditorView( QWidget* parent ) : QWidget( paren ...@@ -84,7 +129,7 @@ RenderGraphEditorView::RenderGraphEditorView( QWidget* parent ) : QWidget( paren
PowerSlider::connect( powerSlider, PowerSlider::connect( powerSlider,
&PowerSlider::valueChanged, &PowerSlider::valueChanged,
[editableScalar]( double value ) { [editableScalar]( double value ) {
*( editableScalar->m_data ) = value; editableScalar->m_data = value;
} ); } );
return powerSlider; return powerSlider;
} }
...@@ -96,11 +141,11 @@ RenderGraphEditorView::RenderGraphEditorView( QWidget* parent ) : QWidget( paren ...@@ -96,11 +141,11 @@ RenderGraphEditorView::RenderGraphEditorView( QWidget* parent ) : QWidget( paren
dynamic_cast<EditableParameter<bool>*>( editableParameter ); dynamic_cast<EditableParameter<bool>*>( editableParameter );
auto checkBox = new QCheckBox(); auto checkBox = new QCheckBox();
checkBox->setCheckState(*(editableBoolean->m_data) ? Qt::CheckState::Checked : Qt::CheckState::Unchecked); checkBox->setCheckState(editableBoolean->m_data ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
QCheckBox::connect( checkBox, &QCheckBox::stateChanged, [editableBoolean]( int state ) { QCheckBox::connect( checkBox, &QCheckBox::stateChanged, [editableBoolean]( int state ) {
if ( state == Qt::Unchecked ) { *(editableBoolean->m_data) = false; } if ( state == Qt::Unchecked ) { editableBoolean->m_data = false; }
else if ( state == Qt::Checked ) else if ( state == Qt::Checked )
{ *(editableBoolean->m_data) = true; } { editableBoolean->m_data = true; }
} ); } );
return checkBox; return checkBox;
} }
...@@ -118,15 +163,15 @@ RenderGraphEditorView::RenderGraphEditorView( QWidget* parent ) : QWidget( paren ...@@ -118,15 +163,15 @@ RenderGraphEditorView::RenderGraphEditorView( QWidget* parent ) : QWidget( paren
#endif #endif
QColor tmpColor; QColor tmpColor;
tmpColor.setRed( editableColor->m_data->x() * 255); tmpColor.setRed( editableColor->m_data.x() * 255);
tmpColor.setRed( editableColor->m_data->y() * 255); tmpColor.setRed( editableColor->m_data.y() * 255);
tmpColor.setRed( editableColor->m_data->z() * 255); tmpColor.setRed( editableColor->m_data.z() * 255);
colorDialog->setCurrentColor( tmpColor ); colorDialog->setCurrentColor( tmpColor );
ColorSlider::connect( colorDialog, &QColorDialog::currentColorChanged, [editableColor]( QColor value ) { ColorSlider::connect( colorDialog, &QColorDialog::currentColorChanged, [editableColor]( QColor value ) {
int newR, newG, newB; int newR, newG, newB;
value.getRgb( &newR, &newG, &newB ); value.getRgb( &newR, &newG, &newB );
*(editableColor->m_data) = ( NodeTypeColor::sRGBToLinearRGB(NodeTypeColor::fromRGB( editableColor->m_data = ( NodeTypeColor::sRGBToLinearRGB(NodeTypeColor::fromRGB(
Ra::Core::Utils::ColorBase<float>( newR / 255.0f, newG / 255.0f, newB / 255.0f ) Ra::Core::Utils::ColorBase<float>( newR / 255.0f, newG / 255.0f, newB / 255.0f )
.rgb() ) ) ); .rgb() ) ) );
} ); } );
...@@ -154,13 +199,13 @@ RenderGraphEditorView::RenderGraphEditorView( QWidget* parent ) : QWidget( paren ...@@ -154,13 +199,13 @@ RenderGraphEditorView::RenderGraphEditorView( QWidget* parent ) : QWidget( paren
int pos = 0; int pos = 0;
for (int i = 0; i < 256; i++) { for (int i = 0; i < 256; i++) {
unsigned int color = transferEditor->colorAt( i ); unsigned int color = transferEditor->colorAt( i );
editableTransferFunction->m_data->at(pos) = editableTransferFunction->m_data.at(pos) =
(unsigned char)( ( 0x00ff0000 & color ) >> 16 ) / 255.f; (unsigned char)( ( 0x00ff0000 & color ) >> 16 ) / 255.f;
editableTransferFunction->m_data->at( pos + 1 ) = editableTransferFunction->m_data.at( pos + 1 ) =
(unsigned char)( ( 0x0000ff00 & color ) >> 8 ) / 255.f; (unsigned char)( ( 0x0000ff00 & color ) >> 8 ) / 255.f;
editableTransferFunction->m_data->at( pos + 2 ) = editableTransferFunction->m_data.at( pos + 2 ) =
(unsigned char)( ( 0x000000ff & color ) ) / 255.f; (unsigned char)( ( 0x000000ff & color ) ) / 255.f;
editableTransferFunction->m_data->at( pos + 3 ) = editableTransferFunction->m_data.at( pos + 3 ) =
(unsigned char)( ( 0xff000000 & color ) >> 24 ) / 255.f; (unsigned char)( ( 0xff000000 & color ) >> 24 ) / 255.f;
pos = pos + 4; pos = pos + 4;
} }
...@@ -255,19 +300,21 @@ std::shared_ptr<DataModelRegistry> initializeNodeRegistry(RenderGraph* renderGra ...@@ -255,19 +300,21 @@ std::shared_ptr<DataModelRegistry> initializeNodeRegistry(RenderGraph* renderGra
NodeCreator<NodeAdapterModel<WireframeNode>>( renderGraph ), NodeCreator<NodeAdapterModel<WireframeNode>>( renderGraph ),
"Premade Nodes" ); "Premade Nodes" );
ret->registerModel<SourceNodeModel<NodeTypeColor>>( ret->registerModel<NodeAdapterModel<SourceNode<NodeTypeColor>>>(
NodeCreator<SourceNodeModel<NodeTypeColor>>( renderGraph ), NodeCreator<NodeAdapterModel<SourceNode<NodeTypeColor>>>( renderGraph ),
"Sources" ); "Sources" );
ret->registerModel<SourceNodeModel<bool>>( ret->registerModel<NodeAdapterModel<SourceNode<bool>>>(
NodeCreator<SourceNodeModel<bool>>( renderGraph ), "Sources" ); NodeCreator<NodeAdapterModel<SourceNode<bool>>>( renderGraph ), "Sources" );
ret->registerModel<SourceNodeModel<float>>( ret->registerModel<NodeAdapterModel<SourceNode<float>>>(
NodeCreator<SourceNodeModel<float>>( renderGraph ), "Sources" ); NodeCreator<NodeAdapterModel<SourceNode<float>>>( renderGraph ), "Sources" );
ret->registerModel<NodeAdapterModel<SourceNode<EnvMapData>>>(
NodeCreator<NodeAdapterModel<SourceNode<EnvMapData>>>( renderGraph ), "Sources" );
ret->registerModel<SourceColorTextureModel>( ret->registerModel<SourceColorTextureModel>(
NodeCreator<SourceColorTextureModel>( renderGraph ), "Sources" ); NodeCreator<SourceColorTextureModel>( renderGraph ), "Sources" );
ret->registerModel<SourceDepthTextureModel>( ret->registerModel<SourceDepthTextureModel>(
NodeCreator<SourceDepthTextureModel>( renderGraph ), "Sources" ); NodeCreator<SourceDepthTextureModel>( renderGraph ), "Sources" );
ret->registerModel<EnvMapSourceModel>(
NodeCreator<EnvMapSourceModel>( renderGraph ), "Sources" );
ret->registerModel<NodeAdapterModel<DisplaySinkNode>>( ret->registerModel<NodeAdapterModel<DisplaySinkNode>>(
NodeCreator<NodeAdapterModel<DisplaySinkNode>>( renderGraph ), NodeCreator<NodeAdapterModel<DisplaySinkNode>>( renderGraph ),
......
...@@ -14,12 +14,13 @@ struct EditableParameterBase { ...@@ -14,12 +14,13 @@ struct EditableParameterBase {
template <typename T> template <typename T>
struct EditableParameter : public EditableParameterBase { struct EditableParameter : public EditableParameterBase {
EditableParameter( std::string name, T* data ) : EditableParameter() = delete;
EditableParameter( std::string name, T& data ) :
EditableParameterBase( name, typeid( T ).hash_code() ), m_data( data ){}; EditableParameterBase( name, typeid( T ).hash_code() ), m_data( data ){};
void addAdditionalData( T newData ) { additionalData.push_back( newData ); void addAdditionalData( T newData ) { additionalData.push_back( newData );
} }
T* m_data{ nullptr }; T& m_data;
std::vector<T> additionalData; std::vector<T> additionalData;
}; };
\ No newline at end of file
...@@ -27,9 +27,27 @@ constexpr std::string_view type_name() { ...@@ -27,9 +27,27 @@ constexpr std::string_view type_name() {
#elif defined( _MSC_VER ) #elif defined( _MSC_VER )
std::string_view p = __FUNCSIG__; std::string_view p = __FUNCSIG__;
return std::string_view( p.data() + 84, p.size() - 84 - 7 ); return std::string_view( p.data() + 84, p.size() - 84 - 7 );
#else
return type_id(T).type_name();
#endif #endif
} }
inline std::size_t replace_all_in_string(std::string& inout, std::string_view what, std::string_view with)
{
std::size_t count{};
for (std::string::size_type pos{};
inout.npos != (pos = inout.find(what.data(), pos, what.length()));
pos += with.length(), ++count) {
inout.replace(pos, what.length(), with.data(), with.length());
}
return count;
}
inline std::size_t remove_all_in_string(std::string& inout, std::string_view what) {
return replace_all_in_string(inout, what, "");
}
#include <Core/Utils/Color.hpp> #include <Core/Utils/Color.hpp>
#include <Engine/Data/ShaderProgramManager.hpp> #include <Engine/Data/ShaderProgramManager.hpp>
#include <Engine/Data/Texture.hpp> #include <Engine/Data/Texture.hpp>
......
...@@ -14,7 +14,14 @@ Node* createNode( std::string& nodeType, const nlohmann::json& data ) { ...@@ -14,7 +14,14 @@ Node* createNode( std::string& nodeType, const nlohmann::json& data ) {
if ( nodesCreators.find( nodeType ) != nodesCreators.end() ) if ( nodesCreators.find( nodeType ) != nodesCreators.end() )
{ return nodesCreators[nodeType]( data ); } { return nodesCreators[nodeType]( data ); }
else else
{ std::cerr << "NodeFactory: no defined node for type " << nodeType << "." << std::endl; } {
std::cerr << "NodeFactory: no defined node for type " << nodeType << "." << std::endl;
std::cerr << "Available nodes are : " << std::endl;
for(const auto&e : nodesCreators ) {
std::cerr << "\t" << e.first << std::endl;
}
}
return nullptr; return nullptr;
} }
...@@ -41,7 +48,8 @@ void initializeNodeFactory() { ...@@ -41,7 +48,8 @@ void initializeNodeFactory() {
NodeFactory::registerNode<SourceNode<bool>>( []( const nlohmann::json& data ) { NodeFactory::registerNode<SourceNode<bool>>( []( const nlohmann::json& data ) {
std::string value = data["model"]["boolean"]; std::string value = data["model"]["boolean"];
auto sourceBoolean = auto sourceBoolean =
new SourceNode<bool>( "boolean" + std::to_string( NodeFactory::newNodeId() ), ( value == "1" ) ); new SourceNode<bool>( "boolean" + std::to_string( NodeFactory::newNodeId() ) );
sourceBoolean->setData(value == "1");
return sourceBoolean; return sourceBoolean;
} ); } );
...@@ -49,7 +57,8 @@ void initializeNodeFactory() { ...@@ -49,7 +57,8 @@ void initializeNodeFactory() {
std::string value = data["model"]["number"]; std::string value = data["model"]["number"];
float scalar = std::stof( value ); float scalar = std::stof( value );
auto sourceScalar = auto sourceScalar =
new SourceNode<float>( "float" + std::to_string( NodeFactory::newNodeId() ), scalar ); new SourceNode<float>( "float" + std::to_string( NodeFactory::newNodeId() ) );
sourceScalar->setData( scalar );
return sourceScalar; return sourceScalar;
} ); } );
...@@ -61,9 +70,10 @@ void initializeNodeFactory() { ...@@ -61,9 +70,10 @@ void initializeNodeFactory() {
float green = std::stof( valueGreen ) / 255.0f; float green = std::stof( valueGreen ) / 255.0f;
float blue = std::stof( valueBlue ) / 255.0f; float blue = std::stof( valueBlue ) / 255.0f;
auto sourceColor = new SourceNode<NodeTypeColor>( auto sourceColor = new SourceNode<NodeTypeColor>(
"color" + std::to_string( NodeFactory::newNodeId() ), "color" + std::to_string( NodeFactory::newNodeId() ) );
NodeTypeColor::sRGBToLinearRGB( NodeTypeColor::fromRGB(
Ra::Core::Utils::ColorBase<float>( red, green, blue ).rgb() ) ) ); sourceColor->setData(NodeTypeColor::sRGBToLinearRGB( NodeTypeColor::fromRGB(
Ra::Core::Utils::ColorBase<float>( red, green, blue ).rgb() ) ));
return sourceColor; return sourceColor;
} ); } );
...@@ -193,7 +203,7 @@ void initializeNodeFactory() { ...@@ -193,7 +203,7 @@ void initializeNodeFactory() {
if ( !envmap_exist ) if ( !envmap_exist )
{ {
auto node = new SourceNode<std::shared_ptr<RadiumNBR::EnvMap>>( auto node = new SourceNode<std::shared_ptr<RadiumNBR::EnvMap>>(
name + "_" + std::to_string( NodeFactory::newNodeId() ), nullptr ); name + "_" + std::to_string( NodeFactory::newNodeId() ) );
return node; return node;
} }
else else
...@@ -201,7 +211,8 @@ void initializeNodeFactory() { ...@@ -201,7 +211,8 @@ void initializeNodeFactory() {
auto envmp = std::make_shared<RadiumNBR::EnvMap>( files, envType, true ); auto envmp = std::make_shared<RadiumNBR::EnvMap>( files, envType, true );
envmp->setEnvStrength( s ); envmp->setEnvStrength( s );
auto node = new SourceNode<std::shared_ptr<RadiumNBR::EnvMap>>( auto node = new SourceNode<std::shared_ptr<RadiumNBR::EnvMap>>(
name + "_" + std::to_string( NodeFactory::newNodeId() ), envmp ); name + "_" + std::to_string( NodeFactory::newNodeId() ) );
node->setData( envmp );
return node; return node;
} }
} ); } );
......
...@@ -24,7 +24,7 @@ LessThanThresholdNode::LessThanThresholdNode( const std::string& name ) : Node( ...@@ -24,7 +24,7 @@ LessThanThresholdNode::LessThanThresholdNode( const std::string& name ) : Node(
auto portOutColorTex = new PortOut<NodeTypeTexture>( "outColorTexture", this ); auto portOutColorTex = new PortOut<NodeTypeTexture>( "outColorTexture", this );
addOutput( portOutColorTex, m_colorTexture ); addOutput( portOutColorTex, m_colorTexture );
auto editableThreshold = new EditableParameter<float>( "threshold", &m_editableThreshold ); auto editableThreshold = new EditableParameter<float>( "threshold", m_editableThreshold );
editableThreshold->addAdditionalData(0.0f); editableThreshold->addAdditionalData(0.0f);
editableThreshold->addAdditionalData(1.0f); editableThreshold->addAdditionalData(1.0f);
addEditableParameter( editableThreshold ); addEditableParameter( editableThreshold );
......
...@@ -24,7 +24,7 @@ MoreThanThresholdNode::MoreThanThresholdNode( const std::string& name ) : Node( ...@@ -24,7 +24,7 @@ MoreThanThresholdNode::MoreThanThresholdNode( const std::string& name ) : Node(
auto portOutColorTex = new PortOut<NodeTypeTexture>( "outColorTexture", this ); auto portOutColorTex = new PortOut<NodeTypeTexture>( "outColorTexture", this );
addOutput( portOutColorTex, m_colorTexture ); addOutput( portOutColorTex, m_colorTexture );
auto editableThreshold = new EditableParameter<float>( "threshold", &m_editableThreshold ); auto editableThreshold = new EditableParameter<float>( "threshold", m_editableThreshold );
editableThreshold->addAdditionalData(0.0f); editableThreshold->addAdditionalData(0.0f);
editableThreshold->addAdditionalData(1.0f); editableThreshold->addAdditionalData(1.0f);
addEditableParameter( editableThreshold ); addEditableParameter( editableThreshold );
......
...@@ -33,11 +33,11 @@ AccessibilityBufferNode::AccessibilityBufferNode( const std::string& name ) : No ...@@ -33,11 +33,11 @@ AccessibilityBufferNode::AccessibilityBufferNode( const std::string& name ) : No
auto portOutAO = new PortOut<NodeTypeTexture>( "outAO", this ); auto portOutAO = new PortOut<NodeTypeTexture>( "outAO", this );
addOutput( portOutAO, m_AO ); addOutput( portOutAO, m_AO );
auto editableRadius = new EditableParameter( "radius", &m_editableAORadius ); auto editableRadius = new EditableParameter( "radius", m_editableAORadius );
editableRadius->addAdditionalData( 0. ); editableRadius->addAdditionalData( 0. );
editableRadius->addAdditionalData( 100. ); editableRadius->addAdditionalData( 100. );
addEditableParameter( editableRadius ); addEditableParameter( editableRadius );
auto editableSamples = new EditableParameter( "samples", &m_editableSamples ); auto editableSamples = new EditableParameter( "samples", m_editableSamples );
editableSamples->addAdditionalData( 0. ); editableSamples->addAdditionalData( 0. );
editableSamples->addAdditionalData( 4096. ); editableSamples->addAdditionalData( 4096. );
addEditableParameter( editableSamples ); addEditableParameter( editableSamples );
......
...@@ -18,7 +18,7 @@ ClearColorNode::ClearColorNode( const std::string& name ) : Node( name ) { ...@@ -18,7 +18,7 @@ ClearColorNode::ClearColorNode( const std::string& name ) : Node( name ) {
auto portOutColorTex = new PortOut<NodeTypeTexture>( "outColor", this ); auto portOutColorTex = new PortOut<NodeTypeTexture>( "outColor", this );
addOutput( portOutColorTex, m_colorTexture ); addOutput( portOutColorTex, m_colorTexture );
auto editableColor = new EditableParameter("clear color", &m_editableClearColor); auto editableColor = new EditableParameter("clear color", m_editableClearColor);
addEditableParameter(editableColor); addEditableParameter(editableColor);
} }
......
...@@ -18,7 +18,7 @@ VolumeVizualisationNode::VolumeVizualisationNode( const std::string& name ) : No ...@@ -18,7 +18,7 @@ VolumeVizualisationNode::VolumeVizualisationNode( const std::string& name ) : No
auto portOutColorTex = new PortOut<NodeTypeTexture>( "outColorTexture", this ); auto portOutColorTex = new PortOut<NodeTypeTexture>( "outColorTexture", this );
addOutput( portOutColorTex, m_colorTexture ); addOutput( portOutColorTex, m_colorTexture );
auto editableTransferFunction = new EditableParameter<std::array<float, 256 * 4>>( "transfer function", &m_editableTransferFunction); auto editableTransferFunction = new EditableParameter<std::array<float, 256 * 4>>( "transfer function", m_editableTransferFunction);
addEditableParameter( editableTransferFunction ); addEditableParameter( editableTransferFunction );
} }
...@@ -251,4 +251,4 @@ void VolumeVizualisationNode::buildRenderTechnique( const Ra::Engine::Rendering: ...@@ -251,4 +251,4 @@ void VolumeVizualisationNode::buildRenderTechnique( const Ra::Engine::Rendering:
rt.setConfiguration( theConfig, m_idx ); rt.setConfiguration( theConfig, m_idx );
} }
rt.setParametersProvider( paramProvider, m_idx ); rt.setParametersProvider( paramProvider, m_idx );
} }
\ No newline at end of file
...@@ -108,7 +108,7 @@ WireframeNode::WireframeNode( const std::string& name ) : Node( name ) { ...@@ -108,7 +108,7 @@ WireframeNode::WireframeNode( const std::string& name ) : Node( name ) {
auto portOutColorTex = new PortOut<NodeTypeTexture>( "outColorTexture", this ); auto portOutColorTex = new PortOut<NodeTypeTexture>( "outColorTexture", this );
addOutput( portOutColorTex, m_colorTexture ); addOutput( portOutColorTex, m_colorTexture );
auto editableActivate = new EditableParameter("activate", &m_editableActivate); auto editableActivate = new EditableParameter("activate", m_editableActivate);
addEditableParameter(editableActivate); addEditableParameter(editableActivate);
} }
......
...@@ -8,11 +8,11 @@ template <typename T> ...@@ -8,11 +8,11 @@ template <typename T>
class SourceNode : public Node class SourceNode : public Node
{ {
public: public:
SourceNode( const std::string& name, T data ) : Node( name ), m_data( data ) { SourceNode( const std::string& name ) : Node( name ) {
auto portOut = new PortOut<T>( "to", this ); auto portOut = new PortOut<T>( "to", this );
addOutput( portOut, &m_data ); addOutput( portOut, &m_data );
auto editableData = new EditableParameter( "data", &m_data ); auto editableData = new EditableParameter( "data", m_data );
addEditableParameter( editableData ); addEditableParameter( editableData );
} }
...@@ -59,9 +59,10 @@ class SourceNode : public Node ...@@ -59,9 +59,10 @@ class SourceNode : public Node
templatedTypeName = templatedTypeName.substr( pos + 1, templatedTypeName.size() ); } templatedTypeName = templatedTypeName.substr( pos + 1, templatedTypeName.size() ); }
pos = templatedTypeName.find_first_of('>'); pos = templatedTypeName.find_first_of('>');
if (pos != std::string::npos) { templatedTypeName = templatedTypeName.substr( 0, pos ); }*/ if (pos != std::string::npos) { templatedTypeName = templatedTypeName.substr( 0, pos ); }*/
remove_all_in_string(templatedTypeName, "::__1"); // --> HACK to put in type_name<T>
return "Source " + templatedTypeName; return "Source " + templatedTypeName;
} }
private: private:
T m_data; T m_data {};
}; };
{ {
"connections": [ "connections": [
{ {
"in_id": "{c4f37638-3568-46cd-acbe-622013f79c13}", "in_id": "{c66eb0ff-d015-4974-b729-a272678bce05}",
"in_index": 0, "in_index": 4,
"out_id": "{34e8d2d1-a2de-4ebe-a18f-4dcd5b440d1c}", "out_id": "{d07939d8-46d5-4d48-90fa-4ab2a4eebf30}",
"out_index": 0 "out_index": 0
}, },
{ {
"in_id": "{d79d27a4-64c1-4fa1-adc8-c39fd9da3008}", "in_id": "{c66eb0ff-d015-4974-b729-a272678bce05}",
"in_index": 3, "in_index": 3,
"out_id": "{b6e2da15-7b3c-4b85-b656-79a46d94c33d}", "out_id": "{ab3678ab-f0fd-4815-8fa7-7cd08bb239fd}",
"out_index": 0 "out_index": 0
}, },
{ {
"in_id": "{c4f37638-3568-46cd-acbe-622013f79c13}", "in_id": "{4eabb57e-6858-49aa-bfe2-c6a0a20850c3}",
"in_index": 4, "in_index": 3,
"out_id": "{6ceda554-f6d1-4cf0-a36d-e811fc0ad3f1}", "out_id": "{dbdcd645-0ee6-4f1f-8835-8ab1a04feb4c}",
"out_index": 0 "out_index": 0
}, },
{ {
"in_id": "{d79d27a4-64c1-4fa1-adc8-c39fd9da3008}", "in_id": "{4eabb57e-6858-49aa-bfe2-c6a0a20850c3}",
"in_index": 2,
"out_id": "{ab3678ab-f0fd-4815-8fa7-7cd08bb239fd}",
"out_index": 0
},
{
"in_id": "{34e8d2d1-a2de-4ebe-a18f-4dcd5b440d1c}",
"in_index": 1, "in_index": 1,
"out_id": "{9654598f-d4d4-494d-9f14-65d75606f1af}", "out_id": "{9654598f-d4d4-494d-9f14-65d75606f1af}",
"out_index": 0 "out_index": 0
}, },
{ {
"in_id": "{34e8d2d1-a2de-4ebe-a18f-4dcd5b440d1c}", "in_id": "{bdfe05be-3655-4d56-924d-ff3b1bbd709b}",
"in_index": 0, "in_index": 3,
"out_id": "{bdfe05be-3655-4d56-924d-ff3b1bbd709b}", "out_id": "{d07939d8-46d5-4d48-90fa-4ab2a4eebf30}",
"out_index": 0 "out_index": 0
}, },
{ {
"in_id": "{aa0f14a1-bb34-43a6-a11d-5b88404d254d}", "in_id": "{c66eb0ff-d015-4974-b729-a272678bce05}",
"in_index": 0, "in_index": 2,
"out_id": "{c4f37638-3568-46cd-acbe-622013f79c13}", "out_id": "{cb6e4c08-38bf-48fd-8cf2-392a5491751b}",
"out_index": 0 "out_index": 0
}, },
{ {
"in_id": "{cb6e4c08-38bf-48fd-8cf2-392a5491751b}", "in_id": "{c4f37638-3568-46cd-acbe-622013f79c13}",
"in_index": 4,
"out_id": "{6ceda554-f6d1-4cf0-a36d-e811fc0ad3f1}",
"out_index": 0
},
{
"in_id": "{34e8d2d1-a2de-4ebe-a18f-4dcd5b440d1c}",
"in_index": 2,
"out_id": "{9579a8e2-d2d0-4107-b7b5-32b4aa1e7ce9}",
"out_index": 0
},
{
"in_id": "{9654598f-d4d4-494d-9f14-65d75606f1af}",
"in_index": 1, "in_index": 1,
"out_id": "{9654598f-d4d4-494d-9f14-65d75606f1af}", "out_id": "{dbdcd645-0ee6-4f1f-8835-8ab1a04feb4c}",
"out_index": 2 "out_index": 0
}, },
{ {
"in_id": "{cb6e4c08-38bf-48fd-8cf2-392a5491751b}", "in_id": "{cb6e4c08-38bf-48fd-8cf2-392a5491751b}",
...@@ -49,9 +67,15 @@ ...@@ -49,9 +67,15 @@
"out_index": 0 "out_index": 0
}, },
{ {
"in_id": "{9654598f-d4d4-494d-9f14-65d75606f1af}", "in_id": "{34e8d2d1-a2de-4ebe-a18f-4dcd5b440d1c}",
"in_index": 1, "in_index": 0,
"out_id": "{dbdcd645-0ee6-4f1f-8835-8ab1a04feb4c}", "out_id": "{bdfe05be-3655-4d56-924d-ff3b1bbd709b}",
"out_index": 0
},
{
"in_id": "{bdfe05be-3655-4d56-924d-ff3b1bbd709b}",
"in_index": 4,
"out_id": "{6ceda554-f6d1-4cf0-a36d-e811fc0ad3f1}",
"out_index": 0 "out_index": 0
}, },
{ {
...@@ -66,10 +90,16 @@ ...@@ -66,10 +90,16 @@
"out_id": "{b6e2da15-7b3c-4b85-b656-79a46d94c33d}", "out_id": "{b6e2da15-7b3c-4b85-b656-79a46d94c33d}",
"out_index": 0 "out_index": 0
}, },
{
"in_id": "{c4f37638-3568-46cd-acbe-622013f79c13}",
"in_index": 3,
"out_id": "{d07939d8-46d5-4d48-90fa-4ab2a4eebf30}",
"out_index": 0
},
{ {
"in_id": "{c66eb0ff-d015-4974-b729-a272678bce05}", "in_id": "{c66eb0ff-d015-4974-b729-a272678bce05}",
"in_index": 2, "in_index": 0,
"out_id": "{cb6e4c08-38bf-48fd-8cf2-392a5491751b}", "out_id": "{d79d27a4-64c1-4fa1-adc8-c39fd9da3008}",
"out_index": 0 "out_index": 0
}, },
{ {
...@@ -79,57 +109,63 @@ ...@@ -79,57 +109,63 @@
"out_index": 1 "out_index": 1
}, },
{ {
"in_id": "{34e8d2d1-a2de-4ebe-a18f-4dcd5b440d1c}", "in_id": "{d79d27a4-64c1-4fa1-adc8-c39fd9da3008}",
"in_index": 4, "in_index": 3,
"out_id": "{c6d4682c-2a02-467a-9c5c-5511b63b17ba}", "out_id": "{b6e2da15-7b3c-4b85-b656-79a46d94c33d}",
"out_index": 0 "out_index": 0
}, },
{ {
"in_id": "{bdfe05be-3655-4d56-924d-ff3b1bbd709b}", "in_id": "{bdfe05be-3655-4d56-924d-ff3b1bbd709b}",
"in_index": 1,
"out_id": "{9654598f-d4d4-494d-9f14-65d75606f1af}",
"out_index": 0
},
{
"in_id": "{d79d27a4-64c1-4fa1-adc8-c39fd9da3008}",
"in_index": 2, "in_index": 2,
"out_id": "{cb6e4c08-38bf-48fd-8cf2-392a5491751b}", "out_id": "{cb6e4c08-38bf-48fd-8cf2-392a5491751b}",
"out_index": 0 "out_index": 0
}, },
{ {
"in_id": "{c4f37638-3568-46cd-acbe-622013f79c13}", "in_id": "{c4f37638-3568-46cd-acbe-622013f79c13}",
"in_index": 3, "in_index": 0,
"out_id": "{d07939d8-46d5-4d48-90fa-4ab2a4eebf30}", "out_id": "{34e8d2d1-a2de-4ebe-a18f-4dcd5b440d1c}",
"out_index": 0 "out_index": 0
}, },
{ {
"in_id": "{c66eb0ff-d015-4974-b729-a272678bce05}", "in_id": "{34e8d2d1-a2de-4ebe-a18f-4dcd5b440d1c}",
"in_index": 5, "in_index": 4,
"out_id": "{dbdcd645-0ee6-4f1f-8835-8ab1a04feb4c}", "out_id": "{c6d4682c-2a02-467a-9c5c-5511b63b17ba}",
"out_index": 0 "out_index": 0
}, },
{ {
"in_id": "{34e8d2d1-a2de-4ebe-a18f-4dcd5b440d1c}", "in_id": "{bdfe05be-3655-4d56-924d-ff3b1bbd709b}",
"in_index": 3, "in_index": 1,
"out_id": "{6ceda554-f6d1-4cf0-a36d-e811fc0ad3f1}", "out_id": "{9654598f-d4d4-494d-9f14-65d75606f1af}",
"out_index": 0 "out_index": 0
}, },
{ {
"in_id": "{c66eb0ff-d015-4974-b729-a272678bce05}", "in_id": "{aa0f14a1-bb34-43a6-a11d-5b88404d254d}",
"in_index": 0,
"out_id": "{c4f37638-3568-46cd-acbe-622013f79c13}",
"out_index": 0
},
{
"in_id": "{cb6e4c08-38bf-48fd-8cf2-392a5491751b}",
"in_index": 1, "in_index": 1,
"out_id": "{9654598f-d4d4-494d-9f14-65d75606f1af}", "out_id": "{9654598f-d4d4-494d-9f14-65d75606f1af}",
"out_index": 0 "out_index": 2
}, },
{ {
"in_id": "{34e8d2d1-a2de-4ebe-a18f-4dcd5b440d1c}", "in_id": "{d79d27a4-64c1-4fa1-adc8-c39fd9da3008}",
"in_index": 2, "in_index": 2,
"out_id": "{9579a8e2-d2d0-4107-b7b5-32b4aa1e7ce9}", "out_id": "{cb6e4c08-38bf-48fd-8cf2-392a5491751b}",
"out_index": 0 "out_index": 0
}, },
{ {
"in_id": "{4eabb57e-6858-49aa-bfe2-c6a0a20850c3}", "in_id": "{c66eb0ff-d015-4974-b729-a272678bce05}",
"in_index": 0, "in_index": 5,
"out_id": "{62ad7aec-1ea4-4f10-85cb-4be1ecda4263}", "out_id": "{dbdcd645-0ee6-4f1f-8835-8ab1a04feb4c}",
"out_index": 0
},
{
"in_id": "{c66eb0ff-d015-4974-b729-a272678bce05}",
"in_index": 1,
"out_id": "{9654598f-d4d4-494d-9f14-65d75606f1af}",
"out_index": 0 "out_index": 0
}, },
{ {
...@@ -139,9 +175,9 @@ ...@@ -139,9 +175,9 @@
"out_index": 0 "out_index": 0
}, },
{ {
"in_id": "{c66eb0ff-d015-4974-b729-a272678bce05}", "in_id": "{4eabb57e-6858-49aa-bfe2-c6a0a20850c3}",
"in_index": 0, "in_index": 0,
"out_id": "{d79d27a4-64c1-4fa1-adc8-c39fd9da3008}", "out_id": "{62ad7aec-1ea4-4f10-85cb-4be1ecda4263}",
"out_index": 0 "out_index": 0
}, },
{ {
...@@ -150,6 +186,12 @@ ...@@ -150,6 +186,12 @@
"out_id": "{c6d4682c-2a02-467a-9c5c-5511b63b17ba}", "out_id": "{c6d4682c-2a02-467a-9c5c-5511b63b17ba}",
"out_index": 0 "out_index": 0
}, },
{
"in_id": "{d79d27a4-64c1-4fa1-adc8-c39fd9da3008}",
"in_index": 1,
"out_id": "{9654598f-d4d4-494d-9f14-65d75606f1af}",
"out_index": 0
},
{ {
"in_id": "{9579a8e2-d2d0-4107-b7b5-32b4aa1e7ce9}", "in_id": "{9579a8e2-d2d0-4107-b7b5-32b4aa1e7ce9}",
"in_index": 0, "in_index": 0,
...@@ -157,15 +199,15 @@ ...@@ -157,15 +199,15 @@
"out_index": 0 "out_index": 0
}, },
{ {
"in_id": "{d79d27a4-64c1-4fa1-adc8-c39fd9da3008}", "in_id": "{34e8d2d1-a2de-4ebe-a18f-4dcd5b440d1c}",
"in_index": 0, "in_index": 3,
"out_id": "{4eabb57e-6858-49aa-bfe2-c6a0a20850c3}", "out_id": "{6ceda554-f6d1-4cf0-a36d-e811fc0ad3f1}",
"out_index": 0 "out_index": 0
}, },
{ {
"in_id": "{bdfe05be-3655-4d56-924d-ff3b1bbd709b}", "in_id": "{d79d27a4-64c1-4fa1-adc8-c39fd9da3008}",
"in_index": 2, "in_index": 0,
"out_id": "{cb6e4c08-38bf-48fd-8cf2-392a5491751b}", "out_id": "{4eabb57e-6858-49aa-bfe2-c6a0a20850c3}",
"out_index": 0 "out_index": 0
}, },
{ {
...@@ -173,46 +215,60 @@ ...@@ -173,46 +215,60 @@
"in_index": 4, "in_index": 4,
"out_id": "{dbdcd645-0ee6-4f1f-8835-8ab1a04feb4c}", "out_id": "{dbdcd645-0ee6-4f1f-8835-8ab1a04feb4c}",
"out_index": 0 "out_index": 0
}, }
],
"nodes": [
{ {
"in_id": "{bdfe05be-3655-4d56-924d-ff3b1bbd709b}", "id": "{ab3678ab-f0fd-4815-8fa7-7cd08bb239fd}",
"in_index": 3, "model": {
"out_id": "{d07939d8-46d5-4d48-90fa-4ab2a4eebf30}", "files": "/Users/mathias/Professionnel/Data/skyboxes/Spherical/spiaggia_di_mondello.jpg",
"out_index": 0 "name": "Source std::shared_ptr<RadiumNBR::EnvMap>",
"strength": "100",
"type": "2"
},
"position": {
"x": 555.6,
"y": -454.8
}
}, },
{ {
"in_id": "{bdfe05be-3655-4d56-924d-ff3b1bbd709b}", "id": "{bdfe05be-3655-4d56-924d-ff3b1bbd709b}",
"in_index": 4, "model": {
"out_id": "{6ceda554-f6d1-4cf0-a36d-e811fc0ad3f1}", "name": "Local Light Pass"
"out_index": 0 },
"position": {
"x": 1986.3119999999997,
"y": 270.06399999999996
}
}, },
{ {
"in_id": "{34e8d2d1-a2de-4ebe-a18f-4dcd5b440d1c}", "id": "{c66eb0ff-d015-4974-b729-a272678bce05}",
"in_index": 1, "model": {
"out_id": "{9654598f-d4d4-494d-9f14-65d75606f1af}", "name": "Environment Light Pass"
"out_index": 0 },
} "position": {
], "x": 1491.0201599999996,
"nodes": [ "y": -25.388160000000028
}
},
{ {
"id": "{c6d4682c-2a02-467a-9c5c-5511b63b17ba}", "id": "{c4f37638-3568-46cd-acbe-622013f79c13}",
"model": { "model": {
"name": "Lights" "name": "Wireframe Pass"
}, },
"position": { "position": {
"x": 1345.2000000000003, "x": 3098.303999999999,
"y": 722.3999999999999 "y": 412.9919999999999
} }
}, },
{ {
"id": "{9579a8e2-d2d0-4107-b7b5-32b4aa1e7ce9}", "id": "{dbdcd645-0ee6-4f1f-8835-8ab1a04feb4c}",
"model": { "model": {
"filteredType": "Transparent", "name": "Cameras"
"name": "Filter RenderObjects By Type"
}, },
"position": { "position": {
"x": 1717.9199999999996, "x": -298.08,
"y": 879.8399999999998 "y": 73.09440000000001
} }
}, },
{ {
...@@ -225,6 +281,27 @@ ...@@ -225,6 +281,27 @@
"y": 627.6 "y": 627.6
} }
}, },
{
"id": "{c6d4682c-2a02-467a-9c5c-5511b63b17ba}",
"model": {
"name": "Lights"
},
"position": {
"x": 1345.2000000000003,
"y": 722.3999999999999
}
},
{
"id": "{9579a8e2-d2d0-4107-b7b5-32b4aa1e7ce9}",
"model": {
"filteredType": "Transparent",
"name": "Filter RenderObjects By Type"
},
"position": {
"x": 1717.9199999999996,
"y": 879.8399999999998
}
},
{ {
"id": "{d07939d8-46d5-4d48-90fa-4ab2a4eebf30}", "id": "{d07939d8-46d5-4d48-90fa-4ab2a4eebf30}",
"model": { "model": {
...@@ -324,46 +401,6 @@ ...@@ -324,46 +401,6 @@
"x": 528.5280000000002, "x": 528.5280000000002,
"y": 201.216 "y": 201.216
} }
},
{
"id": "{dbdcd645-0ee6-4f1f-8835-8ab1a04feb4c}",
"model": {
"name": "Cameras"
},
"position": {
"x": -298.08,
"y": 73.09440000000001
}
},
{
"id": "{c4f37638-3568-46cd-acbe-622013f79c13}",
"model": {
"name": "Wireframe Pass"
},
"position": {
"x": 3098.303999999999,
"y": 412.9919999999999
}
},
{
"id": "{c66eb0ff-d015-4974-b729-a272678bce05}",
"model": {
"name": "Environment Light Pass"
},
"position": {
"x": 1491.0201599999996,
"y": -25.388160000000028
}
},
{
"id": "{bdfe05be-3655-4d56-924d-ff3b1bbd709b}",
"model": {
"name": "Local Light Pass"
},
"position": {
"x": 1986.3119999999997,
"y": 270.06399999999996
}
} }
] ]
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment