diff --git a/code/nel/include/nel/misc/rgba.h b/code/nel/include/nel/misc/rgba.h index 7b8539ea1..c73bb9fcb 100644 --- a/code/nel/include/nel/misc/rgba.h +++ b/code/nel/include/nel/misc/rgba.h @@ -339,7 +339,7 @@ public: } /// Write the RGBA values to a float vector - void toFloatVector( float *v ) + void toFloatVector( float *v ) const { v[ 0 ] = R; v[ 1 ] = G; diff --git a/code/nel/src/3d/material.cpp b/code/nel/src/3d/material.cpp index a1dee7c4a..deb447d2c 100644 --- a/code/nel/src/3d/material.cpp +++ b/code/nel/src/3d/material.cpp @@ -21,6 +21,7 @@ #include "nel/3d/shader.h" #include "nel/3d/driver.h" #include "nel/3d/dynamic_material.h" +#include "nel/3d/texture_file.h" #include "nel/misc/stream.h" using namespace std; @@ -726,6 +727,124 @@ void CMaterial::createDynMat() _Specular.toFloatVector( v ); prop.value.setVector4( v ); p->addProperty( prop ); + + prop.type = SDynMaterialProp::Float; + prop.prop = "shininess"; + prop.label = "Shininess"; + prop.value.setFloat( _Shininess ); + p->addProperty( prop ); + + prop.prop = "alpha_test_threshold"; + prop.label = "Alpha test threshold"; + prop.value.setFloat( _AlphaTestThreshold ); + p->addProperty( prop ); + + prop.type = SDynMaterialProp::Uint; + prop.prop = "flags"; + prop.label = "Flags"; + prop.value.setUInt( _Flags ); + p->addProperty( prop ); + + prop.prop = "srcblend"; + prop.label = "Source blend"; + prop.value.setUInt( _SrcBlend ); + p->addProperty( prop ); + + prop.prop = "dstblend"; + prop.label = "Destination blend"; + prop.value.setUInt( _DstBlend ); + p->addProperty( prop ); + + prop.prop = "zfunc"; + prop.label = "Z function"; + prop.value.setUInt( _ZFunction ); + p->addProperty( prop ); + + prop.type = SDynMaterialProp::Float; + prop.prop = "zbias"; + prop.label = "Z bias"; + prop.value.setFloat( _ZBias ); + p->addProperty( prop ); + + for( int i = 0; i < IDRV_MAT_MAXTEXTURES; i++ ) + { + if( _Textures[ i ] == NULL ) + continue; + CTextureFile *tf = dynamic_cast< CTextureFile* >( _Textures[ i ].getPtr() ); + if( tf == NULL ) + continue; + + prop.type = SDynMaterialProp::Texture; + prop.prop = "texture"; + prop.prop.push_back( char( '0' + i ) ); + + prop.label = "Texture"; + prop.label.push_back( char( '0' + i ) ); + + prop.value.setString( tf->getFileName() ); + p->addProperty( prop ); + } + + if( _TexUserMat.get() != NULL ) + { + prop.type = SDynMaterialProp::Matrix4; + for( int i = 0; i < IDRV_MAT_MAXTEXTURES; i++ ) + { + prop.prop = "texmat"; + prop.prop.push_back( char( '0' + i ) ); + + prop.label = "Texture matrix"; + prop.label.push_back( char( '0' + i ) ); + + prop.value.setMatrix4( _TexUserMat->TexMat[ i ].get() ); + p->addProperty( prop ); + } + } + + for( int i = 0; i < _LightMaps.size(); i++ ) + { + const CLightMap &lm = _LightMaps[ i ]; + ITexture *t = lm.Texture.getPtr(); + CTextureFile *cf = dynamic_cast< CTextureFile* >( t ); + if( cf != NULL ) + { + prop.type = SDynMaterialProp::Texture; + prop.prop = "lightmap"; + prop.prop.push_back( char( '0' + i ) ); + + prop.label = "Lightmap"; + prop.prop.push_back( char( '0' + i ) ); + + prop.value.setString( cf->getFileName() ); + p->addProperty( prop ); + } + + prop.type = SDynMaterialProp::Color; + prop.prop = "lmfactor"; + prop.prop.push_back( char( '0' + i ) ); + prop.label = "LMFactor"; + prop.label.push_back( char( '0' + i ) ); + lm.Factor.toFloatVector( v ); + prop.value.setVector4( v ); + p->addProperty( prop ); + + prop.prop = "lmcambient"; + prop.prop.push_back( char( '0' + i ) ); + prop.label = "LMCAmbient"; + prop.label.push_back( char( '0' + i ) ); + lm.LMCAmbient.toFloatVector( v ); + prop.value.setVector4( v ); + p->addProperty( prop ); + + prop.prop = "lmcdiffuse"; + prop.prop.push_back( char( '0' + i ) ); + prop.label = "LMCDiffuse"; + prop.label.push_back( char( '0' + i ) ); + lm.LMCDiffuse.toFloatVector( v ); + prop.value.setVector4( v ); + p->addProperty( prop ); + + } } } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/prop_browser_ctrl.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/prop_browser_ctrl.cpp index 0fa2c13dd..5f08ae604 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/prop_browser_ctrl.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/prop_browser_ctrl.cpp @@ -91,7 +91,7 @@ namespace MaterialEditor break; case SMatProp::Uint: - type = QVariant::UInt; + type = QVariant::Int; break; case SMatProp::Vector4: