From dbd5185de1a2516edccab3d3610362d1288055f8 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Mon, 23 Sep 2013 16:52:15 +0200 Subject: [PATCH] Only use the shader combo box for the user shaders. --HG-- branch : gsoc2013-dfighter --- .../nel/src/3d/driver/OpenGL3/driver_opengl.h | 1 + code/nel/src/3d/material.cpp | 48 ------------------- .../material_editor/material_widget.cpp | 35 ++------------ .../plugins/material_editor/material_widget.h | 1 - 4 files changed, 4 insertions(+), 81 deletions(-) diff --git a/code/nel/src/3d/driver/OpenGL3/driver_opengl.h b/code/nel/src/3d/driver/OpenGL3/driver_opengl.h index e5fe91d75..fc3f51668 100644 --- a/code/nel/src/3d/driver/OpenGL3/driver_opengl.h +++ b/code/nel/src/3d/driver/OpenGL3/driver_opengl.h @@ -1073,6 +1073,7 @@ private: void endMultiPass(); // @} + // Sets up a rendering pass from the dynamic material bool setupDynMatPass( uint pass ); /// LastVB for UV setup. diff --git a/code/nel/src/3d/material.cpp b/code/nel/src/3d/material.cpp index 76cc363f0..a6b17eeb5 100644 --- a/code/nel/src/3d/material.cpp +++ b/code/nel/src/3d/material.cpp @@ -656,54 +656,6 @@ void CMaterial::createDynMat() SRenderPass *p = dynMat->getPass( 0 ); - switch( _ShaderType ) - { - - case Normal: - p->setShaderRef( "Normal" ); - break; - - case Bump: - p->setShaderRef( "Bump" ); - break; - - case UserColor: - p->setShaderRef( "UserColor" ); - break; - - case LightMap: - p->setShaderRef( "LightMap" ); - break; - - case Specular: - p->setShaderRef( "Specular" ); - break; - - case Caustics: - p->setShaderRef( "Caustics" ); - break; - - case PerPixelLighting: - p->setShaderRef( "PerPixelLighting" ); - break; - - case PerPixelLightingNoSpec: - p->setShaderRef( "PerPixelLightingNoSpec" ); - break; - - case Cloud: - p->setShaderRef( "Cloud" ); - break; - - case Water: - p->setShaderRef( "Water" ); - break; - - default: - nlassert( false ); - break; - } - float v[ 4 ]; float m[ 16 ]; SDynMaterialProp prop; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.cpp index b57d87454..fdc1d3c8d 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.cpp @@ -21,22 +21,6 @@ namespace MaterialEditor { - const int NUM_STOCK_SHADERS = 10; - - const char *stockShaders[ NUM_STOCK_SHADERS ] = - { - "Normal", - "Bump", - "UserColor", - "LightMap", - "Specular", - "Caustics", - "PerPixelLighting", - "PerPixelLightingNoSpec", - "Cloud", - "Water" - }; - MaterialWidget::MaterialWidget( QWidget *parent ) : QWidget( parent ) { @@ -44,7 +28,6 @@ namespace MaterialEditor shaderEditorWidget = new ShaderEditorWidget(); matPropWidget = new MatPropWidget(); setNel3DIface( NULL ); - addStockShaders(); setupConnections(); } @@ -194,13 +177,6 @@ namespace MaterialEditor pass = passCB->currentText(); } - void MaterialWidget::addStockShaders() - { - for( int i = 0; i < 10; i++ ) - shaderCB->addItem( QString( stockShaders[ i ] ) ); - - } - void MaterialWidget::setupConnections() { connect( passButton, SIGNAL( clicked( bool ) ), this, SLOT( onPassEditClicked() ) ); @@ -266,16 +242,11 @@ namespace MaterialEditor pass.getShaderRef( s ); int i = shaderCB->findText( s.c_str() ); - if( i >= 0 ) + if( i > 0 ) shaderCB->setCurrentIndex( i ); else shaderCB->setCurrentIndex( 0 ); - - if( i > NUM_STOCK_SHADERS ) - shaderButton->setEnabled( true ); - else - shaderButton->setEnabled( false ); - + Q_EMIT passChanged( text ); } @@ -290,7 +261,7 @@ namespace MaterialEditor CRenderPassProxy pass = m.getPass( p.toUtf8().data() ); pass.setShaderRef( text.toUtf8().data() ); - if( shaderCB->currentIndex() > NUM_STOCK_SHADERS ) + if( !text.isEmpty() ) shaderButton->setEnabled( true ); else shaderButton->setEnabled( false ); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.h index d733f95df..e8a9ba0d7 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_widget.h @@ -57,7 +57,6 @@ namespace MaterialEditor void subMatChanged( int i ); private: - void addStockShaders(); void setupConnections(); ShaderEditorWidget *shaderEditorWidget; MatPropWidget *matPropWidget;