22using namespace Qt::StringLiterals;
26 return u
"metalrough"_s;
69 return *
this == *otherMetal;
74 return mAnisotropy > 0;
80 if ( elem.hasAttribute( u
"emission_color"_s ) )
83 mEmissiveColor = QColor();
84 mEmissionFactor = elem.attribute( u
"emission_factor"_s, u
"1.0"_s ).toDouble();
86 mClearCoatFactor = elem.attribute( u
"clear_coat_factor"_s, u
"0.0"_s ).toDouble();
87 mClearCoatRoughness = elem.attribute( u
"clear_coat_roughness"_s, u
"0.0"_s ).toDouble();
89 mMetalness = elem.attribute( u
"metalness"_s, u
"0.0"_s ).toDouble();
90 mRoughness = elem.attribute( u
"roughness"_s, u
"0.5"_s ).toDouble();
91 mOpacity = elem.attribute( u
"opacity"_s, u
"1.0"_s ).toDouble();
92 mReflectance = elem.attribute( u
"reflectance"_s, u
"0.5"_s ).toDouble();
93 mAnisotropy = elem.attribute( u
"anisotropy"_s, u
"0.0"_s ).toDouble();
94 mAnisotropyRotation = elem.attribute( u
"anisotropy_rotation"_s, u
"0.0"_s ).toDouble();
102 elem.setAttribute( u
"metalness"_s, mMetalness );
103 elem.setAttribute( u
"roughness"_s, mRoughness );
106 elem.setAttribute( u
"reflectance"_s, mReflectance );
110 elem.setAttribute( u
"anisotropy"_s, mAnisotropy );
114 elem.setAttribute( u
"anisotropy_rotation"_s, mAnisotropyRotation );
116 if ( mEmissiveColor.isValid() )
120 elem.setAttribute( u
"emission_factor"_s, mEmissionFactor );
125 elem.setAttribute( u
"clear_coat_factor"_s, mClearCoatFactor );
129 elem.setAttribute( u
"clear_coat_roughness"_s, mClearCoatRoughness );
134 elem.setAttribute( u
"opacity"_s, mOpacity );
MaterialRenderingTechnique
Material rendering techniques.
@ Points
Point based rendering, requires point data.
@ Triangles
Triangle based rendering (default).
@ TrianglesFromModel
Triangle based rendering, using a model object source.
@ Lines
Line based rendering, requires line data.
@ Billboards
Flat billboard rendering.
@ TrianglesDataDefined
Triangle based rendering with possibility of datadefined color.
@ InstancedPoints
Instanced based rendering, requiring triangles and point data.
@ TrianglesWithFixedTexture
Triangle based rendering, using a fixed, non-user-configurable texture (e.g. for terrain rendering).
Abstract base class for material settings.
virtual void writeXml(QDomElement &element, const QgsReadWriteContext &) const
Writes settings to a DOM element.
virtual void readXml(const QDomElement &element, const QgsReadWriteContext &)
Reads settings from a DOM element.
@ BaseColor
Base color (metal-rough material).
@ EmissionColor
Emission color (metal-rough material).
A container for the context for various read/write operations on objects.
static QColor decodeColor(const QString &str)
static QString encodeColor(const QColor &color)
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference).