Class: QgsPhongMaterialSettings¶
Basic shading material used for rendering based on the Phong shading model with three color components: ambient, diffuse and specular.
Warning
This is not considered stable API, and may change in future QGIS releases. It is exposed to the Python bindings as a tech preview only.
List of all members, including inherited members
Class Hierarchy¶
Base classes¶
Abstract base class for material settings. |
Abstract Methods
Returns an approximate color representing the blended material color. |
|
Decomposes a base color into Phong material components, and sets the material's colors accordingly. |
Methods
Returns ambient color component |
|
Returns the coefficient for the ambient color contribution (ie strength factor of the ambient color). |
|
Returns diffuse color component |
|
Returns the coefficient for the diffuse color contribution (ie strength factor of the diffuse color). |
|
Returns the opacity of the surface |
|
Sets ambient color component |
|
Sets the coefficient for the ambient color contribution (ie strength factor of the ambient color). |
|
Sets diffuse color component |
|
Sets the coefficient for the diffuse color contribution (ie strength factor of the diffuse color). |
|
Sets opacity of the surface |
|
Sets shininess of the surface |
|
Sets specular color component |
|
Sets the coefficient for the specular color contribution (ie strength factor of the specular color). |
|
Returns shininess of the surface |
|
Returns specular color component |
|
Returns the coefficient for the specular color contribution (ie strength factor of the specular color). |
Static Methods
Returns a new instance of QgsPhongMaterialSettings. |
|
Returns |
- class qgis._3d.QgsPhongMaterialSettings¶
Bases:
QgsAbstractMaterialSettings- ambient(self) QColor¶
Returns ambient color component
- Return type:
QColor
- ambientCoefficient(self) float¶
Returns the coefficient for the ambient color contribution (ie strength factor of the ambient color).
See also
See also
See also
Added in version 3.36.
- Return type:
float
- abstract averageColor(self) QColor¶
Returns an approximate color representing the blended material color.
This function calculates a weighted average of the ambient, diffuse, and specular color components to produce a single representative color.
See also
See also
See also
Added in version 4.2.
- Return type:
QColor
- static create() QgsAbstractMaterialSettings | None¶
Returns a new instance of QgsPhongMaterialSettings.
- Return type:
- diffuse(self) QColor¶
Returns diffuse color component
- Return type:
QColor
- diffuseCoefficient(self) float¶
Returns the coefficient for the diffuse color contribution (ie strength factor of the diffuse color).
See also
See also
See also
Added in version 3.36.
- Return type:
float
- opacity(self) float¶
Returns the opacity of the surface
Added in version 3.26.
- Return type:
float
- setAmbient(self, ambient: QColor | Qt.GlobalColor | int)¶
Sets ambient color component
- Parameters:
ambient (Union[QColor, Qt.GlobalColor, int])
- setAmbientCoefficient(self, coefficient: float)¶
Sets the
coefficientfor the ambient color contribution (ie strength factor of the ambient color).See also
See also
See also
Added in version 3.36.
- Parameters:
coefficient (float)
- abstract setColorsFromBase(self, baseColor: QColor | Qt.GlobalColor | int, metallic: float)¶
Decomposes a base color into Phong material components, and sets the material’s colors accordingly.
Sets ambient, diffuse, and specular colors from the input color. This also sets the shininess parameter based on the metallic value.
- Parameters:
baseColor (Union[QColor, Qt.GlobalColor, int]) – The color to decompose
metallic (float) – Controls how “metal-like” a material appears. Value between 0 and 1
See also
See also
See also
See also
Added in version 4.2.
setColorsFromBase(self, baseColor: Union[QColor, Qt.GlobalColor, int]) Decomposes a base color into Phong material components.
Sets ambient, diffuse, and specular colors from the input color. This is equivalent to calling setColorsFromBase with the metallic parameter equal to 0: setColorsFromBase(baseColor, 0).
- Parameters:
baseColor – The color to decompose
See also
See also
See also
Added in version 4.2.
- setDiffuse(self, diffuse: QColor | Qt.GlobalColor | int)¶
Sets diffuse color component
- Parameters:
diffuse (Union[QColor, Qt.GlobalColor, int])
- setDiffuseCoefficient(self, coefficient: float)¶
Sets the
coefficientfor the diffuse color contribution (ie strength factor of the diffuse color).See also
See also
See also
Added in version 3.36.
- Parameters:
coefficient (float)
- setOpacity(self, opacity: float)¶
Sets opacity of the surface
Added in version 3.26.
- Parameters:
opacity (float)
- setShininess(self, shininess: float)¶
Sets shininess of the surface
- Parameters:
shininess (float)
- setSpecular(self, specular: QColor | Qt.GlobalColor | int)¶
Sets specular color component
- Parameters:
specular (Union[QColor, Qt.GlobalColor, int])
- setSpecularCoefficient(self, coefficient: float)¶
Sets the
coefficientfor the specular color contribution (ie strength factor of the specular color).See also
See also
See also
Added in version 3.36.
- Parameters:
coefficient (float)
- shininess(self) float¶
Returns shininess of the surface
- Return type:
float
- specular(self) QColor¶
Returns specular color component
- Return type:
QColor
- specularCoefficient(self) float¶
Returns the coefficient for the specular color contribution (ie strength factor of the specular color).
See also
See also
See also
Added in version 3.36.
- Return type:
float
- static supportsTechnique(technique: Qgis.MaterialRenderingTechnique) bool¶
Returns
Trueif the specifiedtechniqueis supported by the Phong material.- Parameters:
technique (Qgis.MaterialRenderingTechnique)
- Return type:
bool