diff --git a/code/nel/include/nel/3d/dynamic_material.h b/code/nel/include/nel/3d/dynamic_material.h
index e4db258f1..172b14149 100644
--- a/code/nel/include/nel/3d/dynamic_material.h
+++ b/code/nel/include/nel/3d/dynamic_material.h
@@ -25,7 +25,7 @@
namespace NL3D
{
- struct CDynMaterialProp
+ struct SDynMaterialProp
{
enum EPropertyType
{
@@ -43,8 +43,30 @@ namespace NL3D
std::string label;
uint8 type;
std::string value;
+
+ void serial( NLMISC::IStream &f );
};
+
+
+ struct SRenderPass
+ {
+ public:
+ void addProperty( const SDynMaterialProp &prop );
+ void removeProperty( const std::string &name );
+ void changeProperty( const std::string &name, const SDynMaterialProp &prop );
+ void setName( const std::string &n ){ name = n; }
+ void getName( std::string &n ) const { n = name; }
+ void serial( NLMISC::IStream &f );
+
+ private:
+ std::vector< SDynMaterialProp > properties;
+ std::string name;
+ };
+
+
+
+
class CDynMaterial : public NLMISC::IStreamable
{
public:
@@ -52,12 +74,12 @@ namespace NL3D
~CDynMaterial();
void serial( NLMISC::IStream &f );
- void addProperty( const CDynMaterialProp &prop );
- void removeProperty( const std::string &name );
- void changeProperty( const std::string &name, const CDynMaterialProp &prop );
+ void addPass( const SRenderPass &pass );
+ void removePass( const std::string &name );
+ SRenderPass* getPass( const std::string &name );
private:
- std::vector< CDynMaterialProp > properties;
+ std::vector< SRenderPass > passes;
};
}
diff --git a/code/nel/src/3d/dynamic_material.cpp b/code/nel/src/3d/dynamic_material.cpp
index 332a67841..875992773 100644
--- a/code/nel/src/3d/dynamic_material.cpp
+++ b/code/nel/src/3d/dynamic_material.cpp
@@ -18,33 +18,39 @@
namespace NL3D
{
- CDynMaterial::CDynMaterial()
- {
- }
-
- CDynMaterial::~CDynMaterial()
+ void SDynMaterialProp::serial( NLMISC::IStream &f )
{
+ f.serial( std::string( prop ) );
+ f.serial( std::string( label ) );
+ f.serial( uint8( type ) );
+ f.serial( std::string( value ) );
}
- void CDynMaterial::serial( NLMISC::IStream &f )
+ void SRenderPass::serial( NLMISC::IStream &f )
{
- int version = f.serialVersion( 1 );
+ f.serial( std::string( name ) );
- std::vector< CDynMaterialProp >::const_iterator itr = properties.begin();
- while( itr != properties.end() )
+ if( !f.isReading() )
{
- f.serial( std::string( itr->prop ) );
- f.serial( std::string( itr->label ) );
- f.serial( uint8( itr->type ) );
- f.serial( std::string( itr->value ) );
-
- ++itr;
+ std::vector< SDynMaterialProp >::iterator itr = properties.begin();
+ while( itr != properties.end() )
+ {
+ itr->serial( f );
+ ++itr;
+ }
+ }
+ else
+ {
+ SDynMaterialProp prop;
+ prop.serial( f );
+ properties.push_back( prop );
}
+
}
- void CDynMaterial::addProperty( const CDynMaterialProp &prop )
+ void SRenderPass::addProperty( const SDynMaterialProp &prop )
{
- std::vector< CDynMaterialProp >::const_iterator itr = properties.begin();
+ std::vector< SDynMaterialProp >::const_iterator itr = properties.begin();
while( itr != properties.end() )
{
if( itr->prop == prop.prop )
@@ -57,9 +63,9 @@ namespace NL3D
properties.push_back( prop );
}
- void CDynMaterial::removeProperty( const std::string &name )
+ void SRenderPass::removeProperty( const std::string &name )
{
- std::vector< CDynMaterialProp >::iterator itr = properties.begin();
+ std::vector< SDynMaterialProp >::iterator itr = properties.begin();
while( itr != properties.end() )
{
if( itr->prop == name )
@@ -72,9 +78,9 @@ namespace NL3D
properties.erase( itr );
}
- void CDynMaterial::changeProperty( const std::string &name, const CDynMaterialProp &prop )
+ void SRenderPass::changeProperty( const std::string &name, const SDynMaterialProp &prop )
{
- std::vector< CDynMaterialProp >::iterator itr = properties.begin();
+ std::vector< SDynMaterialProp >::iterator itr = properties.begin();
while( itr != properties.end() )
{
if( itr->prop == name )
@@ -90,6 +96,89 @@ namespace NL3D
itr->value = prop.value;
}
+
+
+ CDynMaterial::CDynMaterial()
+ {
+ }
+
+ CDynMaterial::~CDynMaterial()
+ {
+ }
+
+ void CDynMaterial::serial( NLMISC::IStream &f )
+ {
+ int version = f.serialVersion( 1 );
+
+ if( !f.isReading() )
+ {
+ std::vector< SRenderPass >::iterator itr = passes.begin();
+ while( itr != passes.end() )
+ {
+ itr->serial( f );
+ ++itr;
+ }
+ }
+ else
+ {
+ SRenderPass pass;
+ pass.serial( f );
+ passes.push_back( pass );
+ }
+ }
+
+ void CDynMaterial::addPass( const SRenderPass &pass )
+ {
+ std::string n;
+ std::string name;
+ pass.getName( name );
+
+ std::vector< SRenderPass >::iterator itr = passes.begin();
+ while( itr != passes.end() )
+ {
+ itr->getName( n );
+ if( n == name )
+ break;
+ ++itr;
+ }
+ if( itr != passes.end() )
+ return;
+
+ passes.push_back( pass );
+ }
+
+ void CDynMaterial::removePass( const std::string &name )
+ {
+ std::string n;
+ std::vector< SRenderPass >::iterator itr = passes.begin();
+ while( itr != passes.end() )
+ {
+ itr->getName( n );
+ if( n == name )
+ break;
+ ++itr;
+ }
+
+ if( itr != passes.end() )
+ passes.erase( itr );
+ }
+
+ SRenderPass* CDynMaterial::getPass( const std::string &name )
+ {
+ std::string n;
+ std::vector< SRenderPass >::iterator itr = passes.begin();
+ while( itr != passes.end() )
+ {
+ itr->getName( n );
+ if( n == name )
+ break;
+ ++itr;
+ }
+ if( itr == passes.end() )
+ return NULL;
+ else
+ return &( *itr );
+ }
}
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp
index d691ed445..81163dea1 100644
--- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp
@@ -18,7 +18,7 @@
#include "material_editor_constants.h"
#include "material_widget.h"
#include "shader_widget.h"
-#include "material_properties.h"
+#include "render_passes.h"
#include "../core/icore.h"
#include "../core/core_constants.h"
@@ -37,7 +37,7 @@ namespace MaterialEditor
{
m_ui.setupUi(this);
shaderWidget = new ShaderWidget();
- matPropWidget = new MatPropWidget();
+ passesWidget = new RenderPassesWidget();
createMenus();
createDockWidgets();
}
@@ -46,8 +46,8 @@ namespace MaterialEditor
{
delete shaderWidget;
shaderWidget = NULL;
- delete matPropWidget;
- matPropWidget = NULL;
+ delete passesWidget;
+ passesWidget = NULL;
}
void MaterialEditorWindow::onOpenClicked()
@@ -86,14 +86,14 @@ namespace MaterialEditor
);
}
- void MaterialEditorWindow::onEditMaterialClicked()
+ void MaterialEditorWindow::onShadersClicked()
{
- matPropWidget->show();
+ shaderWidget->show();
}
- void MaterialEditorWindow::onShadersClicked()
+ void MaterialEditorWindow::onPassesClicked()
{
- shaderWidget->show();
+ passesWidget->show();
}
void MaterialEditorWindow::createMenus()
@@ -118,17 +118,16 @@ namespace MaterialEditor
a = new QAction( tr( "Save material" ), NULL );
connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onSaveMaterialClicked() ) );
- mm->addAction( a );
-
- a = new QAction( tr( "Edit material" ), NULL );
- connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onEditMaterialClicked() ) );
- mm->addAction( a );
+ mm->addAction( a );
}
a = new QAction( tr( "Shaders" ), NULL );
connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onShadersClicked() ) );
m->addAction( a );
+ a = new QAction( tr( "Render passes" ), NULL );
+ connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onPassesClicked() ) );
+ m->addAction( a );
}
}
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.h
index e37790a23..4cb9dcd26 100644
--- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.h
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.h
@@ -22,8 +22,8 @@
namespace MaterialEditor
{
- class MatPropWidget;
class ShaderWidget;
+ class RenderPassesWidget;
class MaterialEditorWindow: public QMainWindow
{
@@ -38,15 +38,15 @@ private Q_SLOTS:
void onNewMaterialClicked();
void onOpenMaterialClicked();
void onSaveMaterialClicked();
- void onEditMaterialClicked();
void onShadersClicked();
+ void onPassesClicked();
private:
void createMenus();
void createDockWidgets();
ShaderWidget *shaderWidget;
- MatPropWidget *matPropWidget;
+ RenderPassesWidget *passesWidget;
Ui::MaterialEditorWindow m_ui;
};
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_properties.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_properties.ui
index e825fcc23..e9b2848f6 100644
--- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_properties.ui
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_properties.ui
@@ -9,83 +9,136 @@
0
0
- 603
- 320
+ 669
+ 504
- Material properties
+ Rendering pass properties
-
- -
-
+
+
-
+
-
-
-
-
- Property
-
-
-
-
- Label
-
-
-
-
- Type
-
-
+
+
+ Pass name
+
-
-
-
-
-
-
-
-
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Pass properties
+
+
+
-
+
+
-
+
+
- Add
+ Property
-
-
- -
-
+
+
- Remove
+ Label
-
-
- -
-
+
+
- Edit
+ Type
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
-
-
-
+
+
+
+ -
+
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Add
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Remove
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Edit
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+
+
- -
+
-
-
+
+
+ 0
+ 0
+
+
OK