Skip to content

Commit 5d14d84

Browse files
authoredNov 30, 2022
symbols: rename material to material settings (#50977)
* qgspoint3dsymbol: Rename mMaterial attribute to mMaterialSettings mMaterial is not a material but an attribute to handle material settings. Renaming it makes it easier to understand its usage. * qgspoint3dsymbol: Rename materialSettings getter and setter See previous commit. * qgsline3dsymbol: Rename mMaterial attribute to mMaterialSettings mMaterial is not a material but an attribute to handle material settings. Renaming it makes it easier to understand its usage. * qgsline3dsymbol: Rename materialSettings getter and setter See previous commit. * qgspolygon3dsymbol: Rename mMaterial attribute to mMaterialSettings mMaterial is not a material but an attribute to handle material settings. Renaming it makes it easier to understand its usage. * qgspolygon3dsymbol: Rename materialSettings getter and setter See previous commit. * qgsmesh3dsymbol: Rename mMaterial attribute to mMaterialSettings mMaterial is not a material but an attribute to handle material settings. Renaming it makes it easier to understand its usage. * qgsmesh3dsymbol: Rename materialSettings getter and setter See previous commit. * qgsgoochmaterialsettings: fix indentation
1 parent 205865f commit 5d14d84

20 files changed

+142
-144
lines changed
 

‎python/3d/auto_generated/symbols/qgsline3dsymbol.sip.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ Returns whether the renderer will render data with simple lines (otherwise it us
107107
Sets whether the renderer will render data with simple lines (otherwise it uses buffer)
108108
%End
109109

110-
QgsAbstractMaterialSettings *material() const;
110+
QgsAbstractMaterialSettings *materialSettings() const;
111111
%Docstring
112-
Returns material used for shading of the symbol
112+
Returns material settings used for shading of the symbol
113113
%End
114114

115-
void setMaterial( QgsAbstractMaterialSettings *material /Transfer/ );
115+
void setMaterialSettings( QgsAbstractMaterialSettings *materialSettings /Transfer/ );
116116
%Docstring
117117
Sets the ``material`` settings used for shading of the symbol.
118118

‎python/3d/auto_generated/symbols/qgspoint3dsymbol.sip.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ Returns method that determines altitude (whether to clamp to feature to terrain)
6969
Sets method that determines altitude (whether to clamp to feature to terrain)
7070
%End
7171

72-
QgsAbstractMaterialSettings *material() const;
72+
QgsAbstractMaterialSettings *materialSettings() const;
7373
%Docstring
74-
Returns material used for shading of the symbol
74+
Returns material settings used for shading of the symbol
7575
%End
7676

77-
void setMaterial( QgsAbstractMaterialSettings *material /Transfer/ );
77+
void setMaterialSettings( QgsAbstractMaterialSettings *materialSettings /Transfer/ );
7878
%Docstring
7979
Sets the ``material`` settings used for shading of the symbol.
8080

‎python/3d/auto_generated/symbols/qgspolygon3dsymbol.sip.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ Returns extrusion height (in map units)
9090
Sets extrusion height (in map units)
9191
%End
9292

93-
QgsAbstractMaterialSettings *material() const;
93+
QgsAbstractMaterialSettings *materialSettings() const;
9494
%Docstring
95-
Returns material used for shading of the symbol
95+
Returns material settings used for shading of the symbol
9696
%End
9797

98-
void setMaterial( QgsAbstractMaterialSettings *material /Transfer/ );
98+
void setMaterialSettings( QgsAbstractMaterialSettings *materialSettings /Transfer/ );
9999
%Docstring
100100
Sets the ``material`` settings used for shading of the symbol.
101101

‎src/3d/materials/qgsgoochmaterialsettings.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,7 @@ void QgsGoochMaterialSettings::applyDataDefinedToGeometry( Qt3DQGeometry *geomet
206206
warmAttribute->setByteStride( 12 * sizeof( unsigned char ) );
207207
warmAttribute->setByteOffset( 3 * sizeof( unsigned char ) );
208208
warmAttribute->setCount( vertexCount );
209-
geometry->addAttribute( warmAttribute
210-
);
209+
geometry->addAttribute( warmAttribute );
211210

212211
Qt3DQAttribute *coolAttribute = new Qt3DQAttribute( geometry );
213212
coolAttribute->setName( QStringLiteral( "dataDefinedCoolColor" ) );

‎src/3d/symbols/qgsline3dsymbol.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "qgsvectorlayerelevationproperties.h"
2424

2525
QgsLine3DSymbol::QgsLine3DSymbol()
26-
: mMaterial( std::make_unique< QgsPhongMaterialSettings >() )
26+
: mMaterialSettings( std::make_unique< QgsPhongMaterialSettings >() )
2727
{
2828

2929
}
@@ -39,7 +39,7 @@ QgsAbstract3DSymbol *QgsLine3DSymbol::clone() const
3939
result->mHeight = mHeight;
4040
result->mExtrusionHeight = mExtrusionHeight;
4141
result->mRenderAsSimpleLines = mRenderAsSimpleLines;
42-
result->mMaterial.reset( mMaterial->clone() );
42+
result->mMaterialSettings.reset( mMaterialSettings->clone() );
4343
copyBaseSettings( result.get() );
4444
return result.release();
4545
}
@@ -59,9 +59,9 @@ void QgsLine3DSymbol::writeXml( QDomElement &elem, const QgsReadWriteContext &co
5959
elemDataProperties.setAttribute( QStringLiteral( "width" ), mWidth );
6060
elem.appendChild( elemDataProperties );
6161

62-
elem.setAttribute( QStringLiteral( "material_type" ), mMaterial->type() );
62+
elem.setAttribute( QStringLiteral( "material_type" ), mMaterialSettings->type() );
6363
QDomElement elemMaterial = doc.createElement( QStringLiteral( "material" ) );
64-
mMaterial->writeXml( elemMaterial, context );
64+
mMaterialSettings->writeXml( elemMaterial, context );
6565
elem.appendChild( elemMaterial );
6666
}
6767

@@ -79,23 +79,23 @@ void QgsLine3DSymbol::readXml( const QDomElement &elem, const QgsReadWriteContex
7979

8080
const QDomElement elemMaterial = elem.firstChildElement( QStringLiteral( "material" ) );
8181
const QString materialType = elem.attribute( QStringLiteral( "material_type" ), QStringLiteral( "phong" ) );
82-
mMaterial.reset( Qgs3D::materialRegistry()->createMaterialSettings( materialType ) );
83-
if ( !mMaterial )
84-
mMaterial.reset( Qgs3D::materialRegistry()->createMaterialSettings( QStringLiteral( "phong" ) ) );
85-
mMaterial->readXml( elemMaterial, context );
82+
mMaterialSettings.reset( Qgs3D::materialRegistry()->createMaterialSettings( materialType ) );
83+
if ( !mMaterialSettings )
84+
mMaterialSettings.reset( Qgs3D::materialRegistry()->createMaterialSettings( QStringLiteral( "phong" ) ) );
85+
mMaterialSettings->readXml( elemMaterial, context );
8686
}
8787

88-
QgsAbstractMaterialSettings *QgsLine3DSymbol::material() const
88+
QgsAbstractMaterialSettings *QgsLine3DSymbol::materialSettings() const
8989
{
90-
return mMaterial.get();
90+
return mMaterialSettings.get();
9191
}
9292

93-
void QgsLine3DSymbol::setMaterial( QgsAbstractMaterialSettings *material )
93+
void QgsLine3DSymbol::setMaterialSettings( QgsAbstractMaterialSettings *materialSettings )
9494
{
95-
if ( material == mMaterial.get() )
95+
if ( materialSettings == mMaterialSettings.get() )
9696
return;
9797

98-
mMaterial.reset( material );
98+
mMaterialSettings.reset( materialSettings );
9999
}
100100

101101
QList<QgsWkbTypes::GeometryType> QgsLine3DSymbol::compatibleGeometryTypes() const
@@ -133,7 +133,7 @@ bool QgsLine3DSymbol::exportGeometries( Qgs3DSceneExporter *exporter, Qt3DCore::
133133
{
134134
Qgs3DExportObject *object = exporter->processGeometryRenderer( r, objectNamePrefix );
135135
if ( object == nullptr ) continue;
136-
object->setupMaterial( material() );
136+
object->setupMaterial( materialSettings() );
137137
exporter->mObjects.push_back( object );
138138
}
139139
return renderers.size() != 0;

‎src/3d/symbols/qgsline3dsymbol.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,15 @@ class _3D_EXPORT QgsLine3DSymbol : public QgsAbstract3DSymbol SIP_NODEFAULTCTORS
8484
//! Sets whether the renderer will render data with simple lines (otherwise it uses buffer)
8585
void setRenderAsSimpleLines( bool enabled ) { mRenderAsSimpleLines = enabled; }
8686

87-
//! Returns material used for shading of the symbol
88-
QgsAbstractMaterialSettings *material() const;
87+
//! Returns material settings used for shading of the symbol
88+
QgsAbstractMaterialSettings *materialSettings() const;
8989

9090
/**
9191
* Sets the \a material settings used for shading of the symbol.
9292
*
9393
* Ownership of \a material is transferred to the symbol.
9494
*/
95-
void setMaterial( QgsAbstractMaterialSettings *material SIP_TRANSFER );
95+
void setMaterialSettings( QgsAbstractMaterialSettings *materialSettings SIP_TRANSFER );
9696

9797
/**
9898
* Exports the geometries contained within the hierarchy of entity.
@@ -110,7 +110,7 @@ class _3D_EXPORT QgsLine3DSymbol : public QgsAbstract3DSymbol SIP_NODEFAULTCTORS
110110
float mHeight = 0.0f; //!< Base height of polygons
111111
float mExtrusionHeight = 0.0f; //!< How much to extrude (0 means no walls)
112112
bool mRenderAsSimpleLines = false; //!< Whether to render data with simple lines (otherwise it uses buffer)
113-
std::unique_ptr< QgsAbstractMaterialSettings > mMaterial; //!< Defines appearance of objects
113+
std::unique_ptr< QgsAbstractMaterialSettings > mMaterialSettings; //!< Defines appearance of objects
114114
};
115115

116116

‎src/3d/symbols/qgsline3dsymbol_p.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ bool QgsBufferedLine3DSymbolHandler::prepare( const Qgs3DRenderContext &context,
9696
{
9797
Q_UNUSED( attributeNames )
9898

99-
const QgsPhongTexturedMaterialSettings *texturedMaterialSettings = dynamic_cast< const QgsPhongTexturedMaterialSettings * >( mSymbol->material() );
99+
const QgsPhongTexturedMaterialSettings *texturedMaterialSettings = dynamic_cast< const QgsPhongTexturedMaterialSettings * >( mSymbol->materialSettings() );
100100

101101
outNormal.tessellator.reset( new QgsTessellator( context.map().origin().x(), context.map().origin().y(), true,
102102
false, false, false, texturedMaterialSettings ? texturedMaterialSettings->requiresTextureCoordinates() : false,
@@ -196,13 +196,13 @@ void QgsBufferedLine3DSymbolHandler::makeEntity( Qt3DCore::QEntity *parent, cons
196196
QgsMaterialContext materialContext;
197197
materialContext.setIsSelected( selected );
198198
materialContext.setSelectionColor( context.map().selectionColor() );
199-
Qt3DRender::QMaterial *mat = mSymbol->material()->toMaterial( QgsMaterialSettingsRenderingTechnique::Triangles, materialContext );
199+
Qt3DRender::QMaterial *mat = mSymbol->materialSettings()->toMaterial( QgsMaterialSettingsRenderingTechnique::Triangles, materialContext );
200200

201201
// extract vertex buffer data from tessellator
202202
const QByteArray data( ( const char * )out.tessellator->data().constData(), out.tessellator->data().count() * sizeof( float ) );
203203
const int nVerts = data.count() / out.tessellator->stride();
204204

205-
const QgsPhongTexturedMaterialSettings *texturedMaterialSettings = dynamic_cast< const QgsPhongTexturedMaterialSettings * >( mSymbol->material() );
205+
const QgsPhongTexturedMaterialSettings *texturedMaterialSettings = dynamic_cast< const QgsPhongTexturedMaterialSettings * >( mSymbol->materialSettings() );
206206

207207
QgsTessellatedPolygonGeometry *geometry = new QgsTessellatedPolygonGeometry( true, false, false,
208208
texturedMaterialSettings ? texturedMaterialSettings->requiresTextureCoordinates() : false );
@@ -314,7 +314,7 @@ void QgsSimpleLine3DSymbolHandler::makeEntity( Qt3DCore::QEntity *parent, const
314314
QgsMaterialContext materialContext;
315315
materialContext.setIsSelected( selected );
316316
materialContext.setSelectionColor( context.map().selectionColor() );
317-
Qt3DRender::QMaterial *mat = mSymbol->material()->toMaterial( QgsMaterialSettingsRenderingTechnique::Lines, materialContext );
317+
Qt3DRender::QMaterial *mat = mSymbol->materialSettings()->toMaterial( QgsMaterialSettingsRenderingTechnique::Lines, materialContext );
318318

319319
// geometry renderer
320320

@@ -436,7 +436,7 @@ void QgsThickLine3DSymbolHandler::makeEntity( Qt3DCore::QEntity *parent, const Q
436436
QgsMaterialContext materialContext;
437437
materialContext.setIsSelected( selected );
438438
materialContext.setSelectionColor( context.map().selectionColor() );
439-
Qt3DRender::QMaterial *mat = mSymbol->material()->toMaterial( QgsMaterialSettingsRenderingTechnique::Lines, materialContext );
439+
Qt3DRender::QMaterial *mat = mSymbol->materialSettings()->toMaterial( QgsMaterialSettingsRenderingTechnique::Lines, materialContext );
440440
if ( !mat )
441441
{
442442
const QgsSimpleLineMaterialSettings defaultMaterial;

‎src/3d/symbols/qgsmesh3dsymbol.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "qgsphongmaterialsettings.h"
2020

2121
QgsMesh3DSymbol::QgsMesh3DSymbol()
22-
: mMaterial( std::make_unique< QgsPhongMaterialSettings >() )
22+
: mMaterialSettings( std::make_unique< QgsPhongMaterialSettings >() )
2323
{
2424

2525
}
@@ -32,7 +32,7 @@ QgsMesh3DSymbol *QgsMesh3DSymbol::clone() const
3232

3333
result->mAltClamping = mAltClamping;
3434
result->mHeight = mHeight;
35-
result->mMaterial.reset( mMaterial->clone() );
35+
result->mMaterialSettings.reset( mMaterialSettings->clone() );
3636
result->mAddBackFaces = mAddBackFaces;
3737
result->mEnabled = mEnabled;
3838
result->mSmoothedTriangles = mSmoothedTriangles;
@@ -67,7 +67,7 @@ void QgsMesh3DSymbol::writeXml( QDomElement &elem, const QgsReadWriteContext &co
6767
elem.appendChild( elemDataProperties );
6868

6969
QDomElement elemMaterial = doc.createElement( QStringLiteral( "material" ) );
70-
mMaterial->writeXml( elemMaterial, context );
70+
mMaterialSettings->writeXml( elemMaterial, context );
7171
elem.appendChild( elemMaterial );
7272

7373
//Advanced symbol
@@ -105,7 +105,7 @@ void QgsMesh3DSymbol::readXml( const QDomElement &elem, const QgsReadWriteContex
105105
mAddBackFaces = elemDataProperties.attribute( QStringLiteral( "add-back-faces" ) ).toInt();
106106

107107
const QDomElement elemMaterial = elem.firstChildElement( QStringLiteral( "material" ) );
108-
mMaterial->readXml( elemMaterial, context );
108+
mMaterialSettings->readXml( elemMaterial, context );
109109

110110
//Advanced symbol
111111
const QDomElement elemAdvancedSettings = elem.firstChildElement( QStringLiteral( "advanced-settings" ) );
@@ -293,15 +293,15 @@ void QgsMesh3DSymbol::setEnabled( bool enabled )
293293
}
294294

295295

296-
QgsAbstractMaterialSettings *QgsMesh3DSymbol::material() const
296+
QgsAbstractMaterialSettings *QgsMesh3DSymbol::materialSettings() const
297297
{
298-
return mMaterial.get();
298+
return mMaterialSettings.get();
299299
}
300300

301-
void QgsMesh3DSymbol::setMaterial( QgsAbstractMaterialSettings *material )
301+
void QgsMesh3DSymbol::setMaterialSettings( QgsAbstractMaterialSettings *materialSettings )
302302
{
303-
if ( material == mMaterial.get() )
303+
if ( materialSettings == mMaterialSettings.get() )
304304
return;
305305

306-
mMaterial.reset( material );
306+
mMaterialSettings.reset( materialSettings );
307307
}

‎src/3d/symbols/qgsmesh3dsymbol.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,15 @@ class _3D_EXPORT QgsMesh3DSymbol : public QgsAbstract3DSymbol
106106
//! Sets height (altitude) of the symbol (in map units)
107107
void setHeight( float height ) { mHeight = height; }
108108

109-
//! Returns material used for shading of the symbol
110-
QgsAbstractMaterialSettings *material() const;
109+
//! Returns material settings used for shading of the symbol
110+
QgsAbstractMaterialSettings *materialSettings() const;
111111

112112
/**
113113
* Sets the \a material settings used for shading of the symbol.
114114
*
115115
* Ownership of \a material is transferred to the symbol.
116116
*/
117-
void setMaterial( QgsAbstractMaterialSettings *material SIP_TRANSFER );
117+
void setMaterialSettings( QgsAbstractMaterialSettings *materialSettings SIP_TRANSFER );
118118

119119
/**
120120
* Returns whether also triangles facing the other side will be created. Useful if input data have inconsistent order of vertices
@@ -347,7 +347,7 @@ class _3D_EXPORT QgsMesh3DSymbol : public QgsAbstract3DSymbol
347347
//! how to handle altitude of vector features
348348
Qgis::AltitudeClamping mAltClamping = Qgis::AltitudeClamping::Relative;
349349
float mHeight = 0.0f; //!< Base height of triangles
350-
std::unique_ptr< QgsAbstractMaterialSettings > mMaterial; //!< Defines appearance of objects
350+
std::unique_ptr< QgsAbstractMaterialSettings > mMaterialSettings; //!< Defines appearance of objects
351351
bool mAddBackFaces = false;
352352

353353
bool mEnabled = true;

‎src/3d/symbols/qgsmesh3dsymbol_p.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ QgsMesh3DSymbolEntity::QgsMesh3DSymbolEntity( const Qgs3DMapSettings &map,
6666
Qt3DRender::QMaterial *QgsMesh3DSymbolEntity::material( const QgsMesh3DSymbol &symbol ) const
6767
{
6868
const QgsMaterialContext context;
69-
Qt3DRender::QMaterial *material = symbol.material()->toMaterial( QgsMaterialSettingsRenderingTechnique::Triangles, context );
69+
Qt3DRender::QMaterial *material = symbol.materialSettings()->toMaterial( QgsMaterialSettingsRenderingTechnique::Triangles, context );
7070

7171
// front/back side culling
7272
const auto techniques = material->effect()->techniques();
@@ -136,7 +136,7 @@ Qt3DRender::QGeometryRenderer *QgsMesh3DSymbolEntityNode::renderer( const Qgs3DM
136136
// call QgsTessellatedPolygonGeometry to
137137
// use symbol settings for back faces, normals, etc
138138

139-
const QgsPhongTexturedMaterialSettings *texturedMaterialSettings = dynamic_cast< const QgsPhongTexturedMaterialSettings * >( symbol.material() );
139+
const QgsPhongTexturedMaterialSettings *texturedMaterialSettings = dynamic_cast< const QgsPhongTexturedMaterialSettings * >( symbol.materialSettings() );
140140

141141
mGeometry = new QgsTessellatedPolygonGeometry( true, false, symbol.addBackFaces(), texturedMaterialSettings ? texturedMaterialSettings->requiresTextureCoordinates() : false );
142142
const QList<float> extrusionHeightPerPolygon;

‎src/3d/symbols/qgspoint3dsymbol.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ QgsAbstract3DSymbol *QgsPoint3DSymbol::create()
3838
}
3939

4040
QgsPoint3DSymbol::QgsPoint3DSymbol()
41-
: mMaterial( std::make_unique< QgsPhongMaterialSettings >() )
41+
: mMaterialSettings( std::make_unique< QgsPhongMaterialSettings >() )
4242
{
4343
setBillboardSymbol( static_cast<QgsMarkerSymbol *>( QgsSymbol::defaultSymbol( QgsWkbTypes::PointGeometry ) ) );
4444
}
4545

4646
QgsPoint3DSymbol::QgsPoint3DSymbol( const QgsPoint3DSymbol &other )
4747
: mAltClamping( other.altitudeClamping() )
48-
, mMaterial( other.material() ? other.material()->clone() : nullptr )
48+
, mMaterialSettings( other.materialSettings() ? other.materialSettings()->clone() : nullptr )
4949
, mShape( other.shape() )
5050
, mShapeProperties( other.shapeProperties() )
5151
, mTransform( other.transform() )
@@ -64,9 +64,9 @@ void QgsPoint3DSymbol::writeXml( QDomElement &elem, const QgsReadWriteContext &c
6464
elemDataProperties.setAttribute( QStringLiteral( "alt-clamping" ), Qgs3DUtils::altClampingToString( mAltClamping ) );
6565
elem.appendChild( elemDataProperties );
6666

67-
elem.setAttribute( QStringLiteral( "material_type" ), mMaterial->type() );
67+
elem.setAttribute( QStringLiteral( "material_type" ), mMaterialSettings->type() );
6868
QDomElement elemMaterial = doc.createElement( QStringLiteral( "material" ) );
69-
mMaterial->writeXml( elemMaterial, context );
69+
mMaterialSettings->writeXml( elemMaterial, context );
7070
elem.appendChild( elemMaterial );
7171

7272
elem.setAttribute( QStringLiteral( "shape" ), shapeToString( mShape ) );
@@ -97,10 +97,10 @@ void QgsPoint3DSymbol::readXml( const QDomElement &elem, const QgsReadWriteConte
9797

9898
const QDomElement elemMaterial = elem.firstChildElement( QStringLiteral( "material" ) );
9999
const QString materialType = elem.attribute( QStringLiteral( "material_type" ), QStringLiteral( "phong" ) );
100-
mMaterial.reset( Qgs3D::materialRegistry()->createMaterialSettings( materialType ) );
101-
if ( !mMaterial )
102-
mMaterial.reset( Qgs3D::materialRegistry()->createMaterialSettings( QStringLiteral( "phong" ) ) );
103-
mMaterial->readXml( elemMaterial, context );
100+
mMaterialSettings.reset( Qgs3D::materialRegistry()->createMaterialSettings( materialType ) );
101+
if ( !mMaterialSettings )
102+
mMaterialSettings.reset( Qgs3D::materialRegistry()->createMaterialSettings( QStringLiteral( "phong" ) ) );
103+
mMaterialSettings->readXml( elemMaterial, context );
104104

105105
mShape = shapeFromString( elem.attribute( QStringLiteral( "shape" ) ) );
106106

@@ -177,17 +177,17 @@ QMatrix4x4 QgsPoint3DSymbol::billboardTransform() const
177177
return billboardTransformMatrix;
178178
}
179179

180-
QgsAbstractMaterialSettings *QgsPoint3DSymbol::material() const
180+
QgsAbstractMaterialSettings *QgsPoint3DSymbol::materialSettings() const
181181
{
182-
return mMaterial.get();
182+
return mMaterialSettings.get();
183183
}
184184

185-
void QgsPoint3DSymbol::setMaterial( QgsAbstractMaterialSettings *material )
185+
void QgsPoint3DSymbol::setMaterialSettings( QgsAbstractMaterialSettings *materialSettings )
186186
{
187-
if ( material == mMaterial.get() )
187+
if ( materialSettings == mMaterialSettings.get() )
188188
return;
189189

190-
mMaterial.reset( material );
190+
mMaterialSettings.reset( materialSettings );
191191
}
192192

193193
bool QgsPoint3DSymbol::exportGeometries( Qgs3DSceneExporter *exporter, Qt3DCore::QEntity *entity, const QString &objectNamePrefix ) const
@@ -201,7 +201,7 @@ bool QgsPoint3DSymbol::exportGeometries( Qgs3DSceneExporter *exporter, Qt3DCore:
201201
for ( Qgs3DExportObject *obj : objects )
202202
{
203203
obj->setSmoothEdges( exporter->smoothEdges() );
204-
obj->setupMaterial( material() );
204+
obj->setupMaterial( materialSettings() );
205205
}
206206
exporter->mObjects << objects;
207207
}
@@ -213,7 +213,7 @@ bool QgsPoint3DSymbol::exportGeometries( Qgs3DSceneExporter *exporter, Qt3DCore:
213213
Qgs3DExportObject *object = exporter->processGeometryRenderer( mesh, objectNamePrefix );
214214
if ( object == nullptr ) continue;
215215
object->setSmoothEdges( exporter->smoothEdges() );
216-
object->setupMaterial( material() );
216+
object->setupMaterial( materialSettings() );
217217
exporter->mObjects << object;
218218
}
219219
}
@@ -233,7 +233,7 @@ bool QgsPoint3DSymbol::exportGeometries( Qgs3DSceneExporter *exporter, Qt3DCore:
233233
const QVector<Qgs3DExportObject *> objects = exporter->processInstancedPointGeometry( entity, objectNamePrefix );
234234
for ( Qgs3DExportObject *obj : objects )
235235
{
236-
obj->setupMaterial( material() );
236+
obj->setupMaterial( materialSettings() );
237237
exporter->mObjects << obj;
238238
}
239239
return true;

‎src/3d/symbols/qgspoint3dsymbol.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ class _3D_EXPORT QgsPoint3DSymbol : public QgsAbstract3DSymbol SIP_NODEFAULTCTOR
6666
//! Sets method that determines altitude (whether to clamp to feature to terrain)
6767
void setAltitudeClamping( Qgis::AltitudeClamping altClamping ) { mAltClamping = altClamping; }
6868

69-
//! Returns material used for shading of the symbol
70-
QgsAbstractMaterialSettings *material() const;
69+
//! Returns material settings used for shading of the symbol
70+
QgsAbstractMaterialSettings *materialSettings() const;
7171

7272
/**
7373
* Sets the \a material settings used for shading of the symbol.
7474
*
7575
* Ownership of \a material is transferred to the symbol.
7676
*/
77-
void setMaterial( QgsAbstractMaterialSettings *material SIP_TRANSFER );
77+
void setMaterialSettings( QgsAbstractMaterialSettings *materialSettings SIP_TRANSFER );
7878

7979
//! 3D shape types supported by the symbol
8080
enum Shape
@@ -127,7 +127,7 @@ class _3D_EXPORT QgsPoint3DSymbol : public QgsAbstract3DSymbol SIP_NODEFAULTCTOR
127127
//! how to handle altitude of vector features
128128
Qgis::AltitudeClamping mAltClamping = Qgis::AltitudeClamping::Relative;
129129

130-
std::unique_ptr< QgsAbstractMaterialSettings> mMaterial; //!< Defines appearance of objects
130+
std::unique_ptr< QgsAbstractMaterialSettings> mMaterialSettings; //!< Defines appearance of objects
131131
Shape mShape = Cylinder; //!< What kind of shape to use
132132
QVariantMap mShapeProperties; //!< Key-value dictionary of shape's properties (different keys for each shape)
133133
QMatrix4x4 mTransform; //!< Transform of individual instanced models

‎src/3d/symbols/qgspoint3dsymbol_p.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ Qt3DRender::QMaterial *QgsInstancedPoint3DSymbolHandler::material( const QgsPoin
217217
effect->addParameter( paramInst );
218218
effect->addParameter( paramInstNormal );
219219

220-
symbol->material()->addParametersToEffect( effect );
220+
symbol->materialSettings()->addParametersToEffect( effect );
221221

222222
Qt3DRender::QMaterial *material = new Qt3DRender::QMaterial;
223223
material->setEffect( effect );
@@ -421,7 +421,7 @@ void QgsModelPoint3DSymbolHandler::makeEntity( Qt3DCore::QEntity *parent, const
421421
{
422422
// "overwriteMaterial" is a legacy setting indicating that non-embedded material should be used
423423
if ( mSymbol->shapeProperties()[QStringLiteral( "overwriteMaterial" )].toBool()
424-
|| ( mSymbol->material() && mSymbol->material()->type() != QLatin1String( "null" ) ) )
424+
|| ( mSymbol->materialSettings() && mSymbol->materialSettings()->type() != QLatin1String( "null" ) ) )
425425
{
426426
addMeshEntities( context.map(), out.positions, mSymbol.get(), parent, false );
427427
}
@@ -469,7 +469,7 @@ void QgsModelPoint3DSymbolHandler::addMeshEntities( const Qgs3DMapSettings &map,
469469
QgsMaterialContext materialContext;
470470
materialContext.setIsSelected( are_selected );
471471
materialContext.setSelectionColor( map.selectionColor() );
472-
Qt3DRender::QMaterial *mat = symbol->material()->toMaterial( QgsMaterialSettingsRenderingTechnique::Triangles, materialContext );
472+
Qt3DRender::QMaterial *mat = symbol->materialSettings()->toMaterial( QgsMaterialSettingsRenderingTechnique::Triangles, materialContext );
473473

474474
// get nodes
475475
for ( const QVector3D &position : positions )

‎src/3d/symbols/qgspolygon3dsymbol.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "qgsvectorlayer.h"
2727

2828
QgsPolygon3DSymbol::QgsPolygon3DSymbol()
29-
: mMaterial( std::make_unique< QgsPhongMaterialSettings >() )
29+
: mMaterialSettings( std::make_unique< QgsPhongMaterialSettings >() )
3030
{
3131

3232
}
@@ -40,7 +40,7 @@ QgsAbstract3DSymbol *QgsPolygon3DSymbol::clone() const
4040
result->mAltBinding = mAltBinding;
4141
result->mHeight = mHeight;
4242
result->mExtrusionHeight = mExtrusionHeight;
43-
result->mMaterial.reset( mMaterial->clone() );
43+
result->mMaterialSettings.reset( mMaterialSettings->clone() );
4444
result->mCullingMode = mCullingMode;
4545
result->mInvertNormals = mInvertNormals;
4646
result->mAddBackFaces = mAddBackFaces;
@@ -69,9 +69,9 @@ void QgsPolygon3DSymbol::writeXml( QDomElement &elem, const QgsReadWriteContext
6969
elemDataProperties.setAttribute( QStringLiteral( "rendered-facade" ), mRenderedFacade );
7070
elem.appendChild( elemDataProperties );
7171

72-
elem.setAttribute( QStringLiteral( "material_type" ), mMaterial->type() );
72+
elem.setAttribute( QStringLiteral( "material_type" ), mMaterialSettings->type() );
7373
QDomElement elemMaterial = doc.createElement( QStringLiteral( "material" ) );
74-
mMaterial->writeXml( elemMaterial, context );
74+
mMaterialSettings->writeXml( elemMaterial, context );
7575
elem.appendChild( elemMaterial );
7676

7777
QDomElement elemDDP = doc.createElement( QStringLiteral( "data-defined-properties" ) );
@@ -101,10 +101,10 @@ void QgsPolygon3DSymbol::readXml( const QDomElement &elem, const QgsReadWriteCon
101101

102102
const QDomElement elemMaterial = elem.firstChildElement( QStringLiteral( "material" ) );
103103
const QString materialType = elem.attribute( QStringLiteral( "material_type" ), QStringLiteral( "phong" ) );
104-
mMaterial.reset( Qgs3D::materialRegistry()->createMaterialSettings( materialType ) );
105-
if ( !mMaterial )
106-
mMaterial.reset( Qgs3D::materialRegistry()->createMaterialSettings( QStringLiteral( "phong" ) ) );
107-
mMaterial->readXml( elemMaterial, context );
104+
mMaterialSettings.reset( Qgs3D::materialRegistry()->createMaterialSettings( materialType ) );
105+
if ( !mMaterialSettings )
106+
mMaterialSettings.reset( Qgs3D::materialRegistry()->createMaterialSettings( QStringLiteral( "phong" ) ) );
107+
mMaterialSettings->readXml( elemMaterial, context );
108108

109109
const QDomElement elemDDP = elem.firstChildElement( QStringLiteral( "data-defined-properties" ) );
110110
if ( !elemDDP.isNull() )
@@ -155,17 +155,17 @@ QgsAbstract3DSymbol *QgsPolygon3DSymbol::create()
155155
return new QgsPolygon3DSymbol();
156156
}
157157

158-
QgsAbstractMaterialSettings *QgsPolygon3DSymbol::material() const
158+
QgsAbstractMaterialSettings *QgsPolygon3DSymbol::materialSettings() const
159159
{
160-
return mMaterial.get();
160+
return mMaterialSettings.get();
161161
}
162162

163-
void QgsPolygon3DSymbol::setMaterial( QgsAbstractMaterialSettings *material )
163+
void QgsPolygon3DSymbol::setMaterialSettings( QgsAbstractMaterialSettings *materialSettings )
164164
{
165-
if ( material == mMaterial.get() )
165+
if ( materialSettings == mMaterialSettings.get() )
166166
return;
167167

168-
mMaterial.reset( material );
168+
mMaterialSettings.reset( materialSettings );
169169
}
170170

171171
bool QgsPolygon3DSymbol::exportGeometries( Qgs3DSceneExporter *exporter, Qt3DCore::QEntity *entity, const QString &objectNamePrefix ) const

‎src/3d/symbols/qgspolygon3dsymbol.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ class _3D_EXPORT QgsPolygon3DSymbol : public QgsAbstract3DSymbol SIP_NODEFAULTCT
7676
//! Sets extrusion height (in map units)
7777
void setExtrusionHeight( float extrusionHeight ) { mExtrusionHeight = extrusionHeight; }
7878

79-
//! Returns material used for shading of the symbol
80-
QgsAbstractMaterialSettings *material() const;
79+
//! Returns material settings used for shading of the symbol
80+
QgsAbstractMaterialSettings *materialSettings() const;
8181

8282
/**
8383
* Sets the \a material settings used for shading of the symbol.
8484
*
8585
* Ownership of \a material is transferred to the symbol.
8686
*/
87-
void setMaterial( QgsAbstractMaterialSettings *material SIP_TRANSFER );
87+
void setMaterialSettings( QgsAbstractMaterialSettings *materialSettings SIP_TRANSFER );
8888

8989
//! Returns front/back culling mode
9090
Qgs3DTypes::CullingMode cullingMode() const { return mCullingMode; }
@@ -171,7 +171,7 @@ class _3D_EXPORT QgsPolygon3DSymbol : public QgsAbstract3DSymbol SIP_NODEFAULTCT
171171

172172
float mHeight = 0.0f; //!< Base height of polygons
173173
float mExtrusionHeight = 0.0f; //!< How much to extrude (0 means no walls)
174-
std::unique_ptr< QgsAbstractMaterialSettings > mMaterial; //!< Defines appearance of objects
174+
std::unique_ptr< QgsAbstractMaterialSettings > mMaterialSettings; //!< Defines appearance of objects
175175
Qgs3DTypes::CullingMode mCullingMode = Qgs3DTypes::NoCulling; //!< Front/back culling mode
176176
bool mInvertNormals = false;
177177
bool mAddBackFaces = false;

‎src/3d/symbols/qgspolygon3dsymbol_p.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ bool QgsPolygon3DSymbolHandler::prepare( const Qgs3DRenderContext &context, QSet
9191
outEdges.withAdjacency = true;
9292
outEdges.init( mSymbol->altitudeClamping(), mSymbol->altitudeBinding(), 0, &context.map() );
9393

94-
const QgsPhongTexturedMaterialSettings *texturedMaterialSettings = dynamic_cast< const QgsPhongTexturedMaterialSettings * >( mSymbol->material() );
94+
const QgsPhongTexturedMaterialSettings *texturedMaterialSettings = dynamic_cast< const QgsPhongTexturedMaterialSettings * >( mSymbol->materialSettings() );
9595

9696
outNormal.tessellator.reset( new QgsTessellator( context.map().origin().x(), context.map().origin().y(), true, mSymbol->invertNormals(), mSymbol->addBackFaces(), false,
9797
texturedMaterialSettings && texturedMaterialSettings->requiresTextureCoordinates(),
@@ -105,7 +105,7 @@ bool QgsPolygon3DSymbolHandler::prepare( const Qgs3DRenderContext &context, QSet
105105

106106
QSet<QString> attrs = mSymbol->dataDefinedProperties().referencedFields( context.expressionContext() );
107107
attributeNames.unite( attrs );
108-
attrs = mSymbol->material()->dataDefinedProperties().referencedFields( context.expressionContext() );
108+
attrs = mSymbol->materialSettings()->dataDefinedProperties().referencedFields( context.expressionContext() );
109109
attributeNames.unite( attrs );
110110
return true;
111111
}
@@ -144,13 +144,13 @@ void QgsPolygon3DSymbolHandler::processPolygon( QgsPolygon *polyClone, QgsFeatur
144144
out.tessellator->addPolygon( *polyClone, extrusionHeight );
145145
delete polyClone;
146146

147-
if ( mSymbol->material()->dataDefinedProperties().hasActiveProperties() )
147+
if ( mSymbol->materialSettings()->dataDefinedProperties().hasActiveProperties() )
148148
processMaterialDatadefined( out.tessellator->dataVerticesCount() - oldVerticesCount, context.expressionContext(), out );
149149
}
150150

151151
void QgsPolygon3DSymbolHandler::processMaterialDatadefined( uint verticesCount, const QgsExpressionContext &context, QgsPolygon3DSymbolHandler::PolygonData &out )
152152
{
153-
const QByteArray bytes = mSymbol->material()->dataDefinedVertexColorsAsByte( context );
153+
const QByteArray bytes = mSymbol->materialSettings()->dataDefinedVertexColorsAsByte( context );
154154
out.materialDataDefined.append( bytes.repeated( verticesCount ) );
155155
}
156156

@@ -258,13 +258,13 @@ void QgsPolygon3DSymbolHandler::makeEntity( Qt3DCore::QEntity *parent, const Qgs
258258
const QByteArray data( ( const char * )out.tessellator->data().constData(), out.tessellator->data().count() * sizeof( float ) );
259259
const int nVerts = data.count() / out.tessellator->stride();
260260

261-
const QgsPhongTexturedMaterialSettings *texturedMaterialSettings = dynamic_cast< const QgsPhongTexturedMaterialSettings * >( mSymbol->material() );
261+
const QgsPhongTexturedMaterialSettings *texturedMaterialSettings = dynamic_cast< const QgsPhongTexturedMaterialSettings * >( mSymbol->materialSettings() );
262262

263263
QgsTessellatedPolygonGeometry *geometry = new QgsTessellatedPolygonGeometry( true, mSymbol->invertNormals(), mSymbol->addBackFaces(),
264264
texturedMaterialSettings && texturedMaterialSettings->requiresTextureCoordinates() );
265265
geometry->setData( data, nVerts, out.triangleIndexFids, out.triangleIndexStartingIndices );
266-
if ( mSymbol->material()->dataDefinedProperties().hasActiveProperties() )
267-
mSymbol->material()->applyDataDefinedToGeometry( geometry, nVerts, out.materialDataDefined );
266+
if ( mSymbol->materialSettings()->dataDefinedProperties().hasActiveProperties() )
267+
mSymbol->materialSettings()->applyDataDefinedToGeometry( geometry, nVerts, out.materialDataDefined );
268268

269269
Qt3DRender::QGeometryRenderer *renderer = new Qt3DRender::QGeometryRenderer;
270270
renderer->setGeometry( geometry );
@@ -316,8 +316,8 @@ Qt3DRender::QMaterial *QgsPolygon3DSymbolHandler::material( const QgsPolygon3DSy
316316
materialContext.setIsSelected( isSelected );
317317
materialContext.setSelectionColor( context.map().selectionColor() );
318318

319-
const bool dataDefined = mSymbol->material()->dataDefinedProperties().hasActiveProperties();
320-
Qt3DRender::QMaterial *material = symbol->material()->toMaterial( dataDefined ?
319+
const bool dataDefined = mSymbol->materialSettings()->dataDefinedProperties().hasActiveProperties();
320+
Qt3DRender::QMaterial *material = symbol->materialSettings()->toMaterial( dataDefined ?
321321
QgsMaterialSettingsRenderingTechnique::TrianglesDataDefined : QgsMaterialSettingsRenderingTechnique::Triangles,
322322
materialContext );
323323
applyCullingMode( symbol->cullingMode(), material );

‎src/app/3d/qgsline3dsymbolwidget.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void QgsLine3DSymbolWidget::setSymbol( const QgsAbstract3DSymbol *symbol, QgsVec
6464
cboAltClamping->setCurrentIndex( cboAltClamping->findData( static_cast< int >( lineSymbol->altitudeClamping() ) ) );
6565
cboAltBinding->setCurrentIndex( static_cast<int>( lineSymbol->altitudeBinding() ) );
6666
chkSimpleLines->setChecked( lineSymbol->renderAsSimpleLines() );
67-
widgetMaterial->setSettings( lineSymbol->material(), layer );
67+
widgetMaterial->setSettings( lineSymbol->materialSettings(), layer );
6868
widgetMaterial->setTechnique( chkSimpleLines->isChecked() ? QgsMaterialSettingsRenderingTechnique::Lines
6969
: QgsMaterialSettingsRenderingTechnique::Triangles );
7070
updateGuiState();
@@ -79,7 +79,7 @@ QgsAbstract3DSymbol *QgsLine3DSymbolWidget::symbol()
7979
sym->setAltitudeClamping( static_cast<Qgis::AltitudeClamping>( cboAltClamping->currentData().toInt() ) );
8080
sym->setAltitudeBinding( static_cast<Qgis::AltitudeBinding>( cboAltBinding->currentIndex() ) );
8181
sym->setRenderAsSimpleLines( chkSimpleLines->isChecked() );
82-
sym->setMaterial( widgetMaterial->settings() );
82+
sym->setMaterialSettings( widgetMaterial->settings() );
8383
return sym.release();
8484
}
8585

@@ -121,4 +121,3 @@ void QgsLine3DSymbolWidget::simple3DLinesToggled( bool active )
121121
}
122122
}
123123
}
124-

‎src/app/3d/qgspoint3dsymbolwidget.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ void QgsPoint3DSymbolWidget::setSymbol( const QgsAbstract3DSymbol *symbol, QgsVe
130130
lineEditModel->setSource( vm[QStringLiteral( "model" )].toString() );
131131
// "overwriteMaterial" is a legacy setting indicating that non-null material should be used
132132
forceNullMaterial = ( vm.contains( QStringLiteral( "overwriteMaterial" ) ) && !vm[QStringLiteral( "overwriteMaterial" )].toBool() )
133-
|| !pointSymbol->material()
134-
|| pointSymbol->material()->type() == QLatin1String( "null" );
133+
|| !pointSymbol->materialSettings()
134+
|| pointSymbol->materialSettings()->type() == QLatin1String( "null" );
135135
technique = QgsMaterialSettingsRenderingTechnique::TrianglesFromModel;
136136
break;
137137
}
@@ -144,7 +144,7 @@ void QgsPoint3DSymbolWidget::setSymbol( const QgsAbstract3DSymbol *symbol, QgsVe
144144
break;
145145
}
146146

147-
widgetMaterial->setSettings( pointSymbol->material(), layer );
147+
widgetMaterial->setSettings( pointSymbol->materialSettings(), layer );
148148
widgetMaterial->setTechnique( technique );
149149

150150
if ( forceNullMaterial )
@@ -230,7 +230,7 @@ QgsAbstract3DSymbol *QgsPoint3DSymbolWidget::symbol()
230230
sym->setAltitudeClamping( static_cast<Qgis::AltitudeClamping>( cboAltClamping->currentIndex() ) );
231231
sym->setShape( static_cast<QgsPoint3DSymbol::Shape>( cboShape->itemData( cboShape->currentIndex() ).toInt() ) );
232232
sym->setShapeProperties( vm );
233-
sym->setMaterial( widgetMaterial->settings() );
233+
sym->setMaterialSettings( widgetMaterial->settings() );
234234
sym->setTransform( tr );
235235
return sym.release();
236236
}

‎src/app/3d/qgspolygon3dsymbolwidget.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void QgsPolygon3DSymbolWidget::setSymbol( const QgsAbstract3DSymbol *symbol, Qgs
6868
chkAddBackFaces->setChecked( polygonSymbol->addBackFaces() );
6969
chkInvertNormals->setChecked( polygonSymbol->invertNormals() );
7070

71-
widgetMaterial->setSettings( polygonSymbol->material(), layer );
71+
widgetMaterial->setSettings( polygonSymbol->materialSettings(), layer );
7272

7373
btnHeightDD->init( QgsAbstract3DSymbol::PropertyHeight, polygonSymbol->dataDefinedProperties(), QgsAbstract3DSymbol::propertyDefinitions(), layer, true );
7474
btnExtrusionDD->init( QgsAbstract3DSymbol::PropertyExtrusionHeight, polygonSymbol->dataDefinedProperties(), QgsAbstract3DSymbol::propertyDefinitions(), layer, true );
@@ -89,7 +89,7 @@ QgsAbstract3DSymbol *QgsPolygon3DSymbolWidget::symbol()
8989
sym->setRenderedFacade( cboRenderedFacade->currentIndex() );
9090
sym->setAddBackFaces( chkAddBackFaces->isChecked() );
9191
sym->setInvertNormals( chkInvertNormals->isChecked() );
92-
sym->setMaterial( widgetMaterial->settings() );
92+
sym->setMaterialSettings( widgetMaterial->settings() );
9393

9494
QgsPropertyCollection ddp;
9595
ddp.setProperty( QgsAbstract3DSymbol::PropertyHeight, btnHeightDD->toProperty() );

‎tests/src/3d/testqgs3drendering.cpp

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ void TestQgs3DRendering::initTestCase()
132132
// so we do not get some possible artifacts
133133
mLayerBuildings->setRenderer( nullptr );
134134

135-
QgsPhongMaterialSettings material;
136-
material.setAmbient( Qt::lightGray );
135+
QgsPhongMaterialSettings materialSettings;
136+
materialSettings.setAmbient( Qt::lightGray );
137137
QgsPolygon3DSymbol *symbol3d = new QgsPolygon3DSymbol;
138-
symbol3d->setMaterial( material.clone() );
138+
symbol3d->setMaterialSettings( materialSettings.clone() );
139139
symbol3d->setExtrusionHeight( 10.f );
140140
QgsVectorLayer3DRenderer *renderer3d = new QgsVectorLayer3DRenderer( symbol3d );
141141
mLayerBuildings->setRenderer3D( renderer3d );
@@ -416,7 +416,7 @@ void TestQgs3DRendering::testExtrudedPolygons()
416416
materialSettings.setAmbient( Qt::lightGray );
417417
materialSettings.setOpacity( 0.5f );
418418
QgsPolygon3DSymbol *symbol3dOpacity = new QgsPolygon3DSymbol;
419-
symbol3dOpacity->setMaterial( materialSettings.clone() );
419+
symbol3dOpacity->setMaterialSettings( materialSettings.clone() );
420420
symbol3dOpacity->setExtrusionHeight( 10.f );
421421
QgsVectorLayer3DRenderer *renderer3dOpacity = new QgsVectorLayer3DRenderer( symbol3dOpacity );
422422
mLayerBuildings->setRenderer3D( renderer3dOpacity );
@@ -440,11 +440,11 @@ void TestQgs3DRendering::testExtrudedPolygonsDataDefined()
440440
propertyColection.setProperty( QgsAbstractMaterialSettings::Diffuse, diffuseColor );
441441
propertyColection.setProperty( QgsAbstractMaterialSettings::Ambient, ambientColor );
442442
propertyColection.setProperty( QgsAbstractMaterialSettings::Specular, specularColor );
443-
QgsPhongMaterialSettings material;
444-
material.setDataDefinedProperties( propertyColection );
445-
material.setAmbient( Qt::red );
443+
QgsPhongMaterialSettings materialSettings;
444+
materialSettings.setDataDefinedProperties( propertyColection );
445+
materialSettings.setAmbient( Qt::red );
446446
QgsPolygon3DSymbol *symbol3d = new QgsPolygon3DSymbol;
447-
symbol3d->setMaterial( material.clone() );
447+
symbol3d->setMaterialSettings( materialSettings.clone() );
448448
symbol3d->setExtrusionHeight( 10.f );
449449
QgsVectorLayer3DRenderer *renderer3d = new QgsVectorLayer3DRenderer( symbol3d );
450450
mLayerBuildings->setRenderer3D( renderer3d );
@@ -510,7 +510,7 @@ void TestQgs3DRendering::testExtrudedPolygonsGoochShading()
510510
materialSettings.setAlpha( 0.2f );
511511
materialSettings.setBeta( 0.6f );
512512
QgsPolygon3DSymbol *symbol3d = new QgsPolygon3DSymbol;
513-
symbol3d->setMaterial( materialSettings.clone() );
513+
symbol3d->setMaterialSettings( materialSettings.clone() );
514514
symbol3d->setExtrusionHeight( 10.f );
515515
QgsVectorLayer3DRenderer *renderer3dOpacity = new QgsVectorLayer3DRenderer( symbol3d );
516516
mLayerBuildings->setRenderer3D( renderer3dOpacity );
@@ -537,10 +537,10 @@ void TestQgs3DRendering::testPolygonsEdges()
537537
map->setCrs( mProject->crs() );
538538
map->setOrigin( QgsVector3D( fullExtent.center().x(), fullExtent.center().y(), 0 ) );
539539

540-
QgsPhongMaterialSettings material;
541-
material.setAmbient( Qt::lightGray );
540+
QgsPhongMaterialSettings materialSettings;
541+
materialSettings.setAmbient( Qt::lightGray );
542542
QgsPolygon3DSymbol *symbol3d = new QgsPolygon3DSymbol;
543-
symbol3d->setMaterial( material.clone() );
543+
symbol3d->setMaterialSettings( materialSettings.clone() );
544544
symbol3d->setExtrusionHeight( 10.f );
545545
symbol3d->setHeight( 20.f );
546546
symbol3d->setEdgesEnabled( true );
@@ -594,9 +594,9 @@ void TestQgs3DRendering::testLineRendering()
594594
QgsLine3DSymbol *lineSymbol = new QgsLine3DSymbol;
595595
lineSymbol->setRenderAsSimpleLines( true );
596596
lineSymbol->setWidth( 10 );
597-
QgsSimpleLineMaterialSettings mat;
598-
mat.setAmbient( Qt::red );
599-
lineSymbol->setMaterial( mat.clone() );
597+
QgsSimpleLineMaterialSettings matSettings;
598+
matSettings.setAmbient( Qt::red );
599+
lineSymbol->setMaterialSettings( matSettings.clone() );
600600
layerLines->setRenderer3D( new QgsVectorLayer3DRenderer( lineSymbol ) );
601601

602602
QVector<QgsPoint> pts;
@@ -653,9 +653,9 @@ void TestQgs3DRendering::testLineRenderingCurved()
653653
QgsLine3DSymbol *lineSymbol = new QgsLine3DSymbol;
654654
lineSymbol->setRenderAsSimpleLines( true );
655655
lineSymbol->setWidth( 10 );
656-
QgsSimpleLineMaterialSettings mat;
657-
mat.setAmbient( Qt::red );
658-
lineSymbol->setMaterial( mat.clone() );
656+
QgsSimpleLineMaterialSettings matSettings;
657+
matSettings.setAmbient( Qt::red );
658+
lineSymbol->setMaterialSettings( matSettings.clone() );
659659
layerLines->setRenderer3D( new QgsVectorLayer3DRenderer( lineSymbol ) );
660660

661661
QVector<QgsPoint> pts;
@@ -711,9 +711,9 @@ void TestQgs3DRendering::testBufferedLineRendering()
711711
QgsLine3DSymbol *lineSymbol = new QgsLine3DSymbol;
712712
lineSymbol->setWidth( 10 );
713713
lineSymbol->setExtrusionHeight( 30 );
714-
QgsPhongMaterialSettings mat;
715-
mat.setAmbient( Qt::red );
716-
lineSymbol->setMaterial( mat.clone() );
714+
QgsPhongMaterialSettings matSettings;
715+
matSettings.setAmbient( Qt::red );
716+
lineSymbol->setMaterialSettings( matSettings.clone() );
717717
layerLines->setRenderer3D( new QgsVectorLayer3DRenderer( lineSymbol ) );
718718

719719
Qgs3DMapSettings *map = new Qgs3DMapSettings;
@@ -760,9 +760,9 @@ void TestQgs3DRendering::testBufferedLineRenderingWidth()
760760
lineSymbol->setWidth( 20 );
761761
lineSymbol->setExtrusionHeight( 30 );
762762
lineSymbol->setHeight( 10 );
763-
QgsPhongMaterialSettings mat;
764-
mat.setAmbient( Qt::red );
765-
lineSymbol->setMaterial( mat.clone() );
763+
QgsPhongMaterialSettings matSettings;
764+
matSettings.setAmbient( Qt::red );
765+
lineSymbol->setMaterialSettings( matSettings.clone() );
766766
layerLines->setRenderer3D( new QgsVectorLayer3DRenderer( lineSymbol ) );
767767

768768
Qgs3DMapSettings *map = new Qgs3DMapSettings;
@@ -981,16 +981,16 @@ void TestQgs3DRendering::testMeshSimplified()
981981

982982
void TestQgs3DRendering::testRuleBasedRenderer()
983983
{
984-
QgsPhongMaterialSettings material;
985-
material.setAmbient( Qt::lightGray );
984+
QgsPhongMaterialSettings materialSettings;
985+
materialSettings.setAmbient( Qt::lightGray );
986986
QgsPolygon3DSymbol *symbol3d = new QgsPolygon3DSymbol;
987-
symbol3d->setMaterial( material.clone() );
987+
symbol3d->setMaterialSettings( materialSettings.clone() );
988988
symbol3d->setExtrusionHeight( 10.f );
989989

990-
QgsPhongMaterialSettings material2;
991-
material2.setAmbient( Qt::red );
990+
QgsPhongMaterialSettings materialSettings2;
991+
materialSettings2.setAmbient( Qt::red );
992992
QgsPolygon3DSymbol *symbol3d2 = new QgsPolygon3DSymbol;
993-
symbol3d2->setMaterial( material2.clone() );
993+
symbol3d2->setMaterialSettings( materialSettings2.clone() );
994994
symbol3d2->setExtrusionHeight( 10.f );
995995

996996
QgsRuleBased3DRenderer::Rule *root = new QgsRuleBased3DRenderer::Rule( nullptr );
@@ -1121,9 +1121,9 @@ void TestQgs3DRendering::testInstancedRendering()
11211121
QVariantMap vmSphere;
11221122
vmSphere[QStringLiteral( "radius" )] = 80.0f;
11231123
sphere3DSymbol->setShapeProperties( vmSphere );
1124-
QgsPhongMaterialSettings material;
1125-
material.setAmbient( Qt::gray );
1126-
sphere3DSymbol->setMaterial( material.clone() );
1124+
QgsPhongMaterialSettings materialSettings;
1125+
materialSettings.setAmbient( Qt::gray );
1126+
sphere3DSymbol->setMaterialSettings( materialSettings.clone() );
11271127

11281128
layerPointsZ->setRenderer3D( new QgsVectorLayer3DRenderer( sphere3DSymbol ) );
11291129

@@ -1157,7 +1157,7 @@ void TestQgs3DRendering::testInstancedRendering()
11571157
vmCylinder[QStringLiteral( "radius" )] = 20.0f;
11581158
vmCylinder[QStringLiteral( "length" )] = 200.0f;
11591159
cylinder3DSymbol->setShapeProperties( vmCylinder );
1160-
cylinder3DSymbol->setMaterial( material.clone() );
1160+
cylinder3DSymbol->setMaterialSettings( materialSettings.clone() );
11611161

11621162
layerPointsZ->setRenderer3D( new QgsVectorLayer3DRenderer( cylinder3DSymbol ) );
11631163

@@ -1252,9 +1252,9 @@ void TestQgs3DRendering::testEpsg4978LineRendering()
12521252
QgsLine3DSymbol *lineSymbol = new QgsLine3DSymbol;
12531253
lineSymbol->setRenderAsSimpleLines( true );
12541254
lineSymbol->setWidth( 2 );
1255-
QgsSimpleLineMaterialSettings mat;
1256-
mat.setAmbient( Qt::red );
1257-
lineSymbol->setMaterial( mat.clone() );
1255+
QgsSimpleLineMaterialSettings matSettings;
1256+
matSettings.setAmbient( Qt::red );
1257+
lineSymbol->setMaterialSettings( matSettings.clone() );
12581258
layerLines->setRenderer3D( new QgsVectorLayer3DRenderer( lineSymbol ) );
12591259

12601260
Qgs3DMapSettings *map = new Qgs3DMapSettings;

0 commit comments

Comments
 (0)
Please sign in to comment.