Class: QgsGoochMaterialSettings

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.

Added in version 3.16.

List of all members, including inherited members

Class Hierarchy

Inheritance diagram of qgis.core.QgsGoochMaterialSettings

Base classes

QgsAbstractMaterialSettings

Abstract base class for material settings.

Abstract Methods

averageColor

Returns an approximate color representing the blended material color.

setColorsFromBase

Decomposes an average color into Gooch material components, and sets the material colors accordingly.

Methods

alpha

Returns the alpha value

beta

Returns the beta value

cool

Returns cool color component

diffuse

Returns diffuse color component

setAlpha

Sets alpha value

setBeta

Sets beta value

setCool

Sets cool color component

setDiffuse

Sets diffuse color component

setShininess

Sets shininess of the surface

setSpecular

Sets specular color component

setWarm

Sets warm color component

shininess

Returns shininess of the surface

specular

Returns specular color component

warm

Returns warm color component

Static Methods

create

Returns a new instance of QgsGoochMaterialSettings.

supportsTechnique

Returns True if the specified technique is supported by the Gooch material.

class qgis.core.QgsGoochMaterialSettings[source]

Bases: QgsAbstractMaterialSettings

alpha(self) float[source]

Returns the alpha value

Return type:

float

abstract averageColor(self) QColor[source]

Returns an approximate color representing the blended material color.

This function calculates a weighted average of the cool, warm, diffuse, and specular color components to produce a single representative color.

See also

cool()

See also

diffuse()

See also

specular()

See also

warm()

Added in version 4.2.

Return type:

QColor

beta(self) float[source]

Returns the beta value

Return type:

float

cool(self) QColor[source]

Returns cool color component

Return type:

QColor

static create() QgsAbstractMaterialSettings | None[source]

Returns a new instance of QgsGoochMaterialSettings.

Return type:

Optional[QgsAbstractMaterialSettings]

diffuse(self) QColor[source]

Returns diffuse color component

Return type:

QColor

setAlpha(self, alpha: float)[source]

Sets alpha value

Parameters:

alpha (float)

setBeta(self, beta: float)[source]

Sets beta value

Parameters:

beta (float)

abstract setColorsFromBase(self, baseColor: QColor | Qt.GlobalColor | int, alpha: float, beta: float)[source]

Decomposes an average color into Gooch material components, and sets the material colors accordingly.

Sets warm, cool, diffuse and specular colors from the input color. It also sets the alpha and beta parameters

Parameters:
  • baseColor (Union[QColor, Qt.GlobalColor, int]) – The color to decompose

  • alpha (float) – The alpha value

  • beta (float) – The beta value

See also

setCool()

See also

setDiffuse()

See also

setSpecular()

See also

setWarm()

See also

setAlpha()

See also

setBeta()

Added in version 4.2.

setColorsFromBase(self, baseColor: Union[QColor, Qt.GlobalColor, int]) Decomposes an average color into Gooch material components, and sets the material colors accordingly.

Sets warm, cool, diffuse and specular colors from the input color. This is equivalent to calling setColorsFromBase with the existing alpha and beta parameters: setColorsFromBase(baseColor, alpha(), beta()).

Parameters:

baseColor – The color to decompose

See also

setCool()

See also

setDiffuse()

See also

setSpecular()

See also

setWarm()

Added in version 4.2.

setCool(self, cool: QColor | Qt.GlobalColor | int)[source]

Sets cool color component

Parameters:

cool (Union[QColor, Qt.GlobalColor, int])

setDiffuse(self, diffuse: QColor | Qt.GlobalColor | int)[source]

Sets diffuse color component

Parameters:

diffuse (Union[QColor, Qt.GlobalColor, int])

setShininess(self, shininess: float)[source]

Sets shininess of the surface

Parameters:

shininess (float)

setSpecular(self, specular: QColor | Qt.GlobalColor | int)[source]

Sets specular color component

Parameters:

specular (Union[QColor, Qt.GlobalColor, int])

setWarm(self, warm: QColor | Qt.GlobalColor | int)[source]

Sets warm color component

Parameters:

warm (Union[QColor, Qt.GlobalColor, int])

shininess(self) float[source]

Returns shininess of the surface

Return type:

float

specular(self) QColor[source]

Returns specular color component

Return type:

QColor

static supportsTechnique(technique: Qgis.MaterialRenderingTechnique) bool[source]

Returns True if the specified technique is supported by the Gooch material.

Parameters:

technique (Qgis.MaterialRenderingTechnique)

Return type:

bool

warm(self) QColor[source]

Returns warm color component

Return type:

QColor