Skip to content
Permalink
Browse files

Export polygons phong material

  • Loading branch information
NEDJIMAbelgacem committed Jul 12, 2020
1 parent 9db1e3f commit b0132fc654c92b387eb7408cba7323d2d950a172
Showing with 9 additions and 0 deletions.
  1. +9 −0 src/3d/qgs3dsceneexporter.cpp
@@ -376,6 +376,15 @@ void Qgs3DSceneExporter::processPolygonGeometry( QgsTessellatedPolygonGeometry *
QVector<float> normalsData = getAttributeData<float>( normalsAttribute, normalsBytes );
object->setupNormalCoordinates( normalsData );
}
QgsPhongMaterialSettings material = polygonSymbol->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 ) );
// TODO: handle textures
}

0 comments on commit b0132fc

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