Skip to content
Permalink
Browse files

export the material of instanced regular geometries

  • Loading branch information
NEDJIMAbelgacem committed Jul 13, 2020
1 parent 2383eae commit a78e4e9e58e7991dbfbf99d3f27780d9740079ef
Showing with 10 additions and 0 deletions.
  1. +10 −0 src/3d/qgs3dsceneexporter.cpp
@@ -223,7 +223,17 @@ bool Qgs3DSceneExporter::parseVectorLayerEntity( Qt3DCore::QEntity *entity, QgsV
Qgs3DExportObject *object = new Qgs3DExportObject( getObjectName( "shape_geometry" ), "", this );
mObjects.push_back( object );
object->setupPositionCoordinates( positionData, indexData, 1.0f, QVector3D( instancePosition[i], instancePosition[i + 1], instancePosition[i + 2] ) );
QgsPhongMaterialSettings material = pointSymbol->material();
QColor diffuse = material.diffuse();
QColor specular = material.specular();
QColor ambient = material.ambient();
float shininess = material.shininess();
object->setMaterialParameter( QString( "Kd" ), QString( "%1 %2 %3" ).arg( diffuse.redF() ).arg( diffuse.greenF() ).arg( diffuse.blueF() ) );
object->setMaterialParameter( QString( "Ka" ), QString( "%1 %2 %3" ).arg( ambient.redF() ).arg( ambient.greenF() ).arg( ambient.blueF() ) );
object->setMaterialParameter( QString( "Ks" ), QString( "%1 %2 %3" ).arg( specular.redF() ).arg( specular.greenF() ).arg( specular.blueF() ) );
object->setMaterialParameter( QString( "Ns" ), QString( "%1" ).arg( shininess ) );
}

return true;
}
}

0 comments on commit a78e4e9

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