Skip to content
Permalink
Browse files

add SIP_FACTO to QgsAbstractMaterialSettings::toExportParameters

  • Loading branch information
NEDJIMAbelgacem committed Jul 25, 2020
1 parent 4488739 commit 860be14c325e8de78c26dc8f4614e6f53673860e
@@ -54,6 +54,9 @@ Returns specular color component
Returns shininess of the surface
%End

virtual QMap<QString, QString> toExportParameters() const;


bool diffuseTextureEnabled() const;
%Docstring
Returns whether the diffuse texture is used.
@@ -85,7 +85,7 @@ void Qgs3DExportObject::setupTextureCoordinates( const QVector<float> &texturesB
void Qgs3DExportObject::setupMaterial( QgsAbstractMaterialSettings *material )
{
QMap<QString, QString> parameters = material->toExportParameters();
for (QString& key : parameters.keys()) setMaterialParameter(key, parameters[key]);
for ( QString &key : parameters.keys() ) setMaterialParameter( key, parameters[key] );
}

void Qgs3DExportObject::objectBounds( float &minX, float &minY, float &minZ, float &maxX, float &maxY, float &maxZ )
@@ -83,7 +83,7 @@ class Qgs3DExportObject : public QObject
//! Sets texture coordinates for each vertex
void setupTextureCoordinates( const QVector<float> &texturesBuffer );
//! Sets the material parameters (diffuse color, shininess...) from phong material
void setupMaterial( QgsAbstractMaterialSettings* material );
void setupMaterial( QgsAbstractMaterialSettings *material );

//! Sets the texture image used by the object
void setTextureImage( const QImage &image ) { this->mTextureImage = image; };
@@ -118,7 +118,8 @@ class _3D_EXPORT QgsAbstractMaterialSettings SIP_ABSTRACT
/*
* Returns the parameters to be exported to .mtl file
*/
virtual QMap<QString, QString> toExportParameters() const = 0;
virtual QMap<QString, QString> toExportParameters() const = 0 SIP_FACTORY;

/**
* Adds parameters from the material to a destination \a effect.
*/
@@ -143,7 +143,8 @@ QgsLineMaterial *QgsPhongMaterialSettings::toLineMaterial( const QgsMaterialCont
return mat;
}

QMap<QString, QString> QgsPhongMaterialSettings::toExportParameters() const {
QMap<QString, QString> QgsPhongMaterialSettings::toExportParameters() const
{
QMap<QString, QString> parameters;
parameters[ QString( "Kd" ) ] = QStringLiteral( "%1 %2 %3" ).arg( mDiffuse.redF() ).arg( mDiffuse.greenF() ).arg( mDiffuse.blueF() );
parameters[ QString( "Ka" ) ] = QStringLiteral( "%1 %2 %3" ).arg( mAmbient.redF() ).arg( mAmbient.greenF() ).arg( mAmbient.blueF() );

0 comments on commit 860be14

Please sign in to comment.
You can’t perform that action at this time.