QGIS API Documentation 4.1.0-Master (d6fb7a379fb)
Loading...
Searching...
No Matches
QgsPhongTexturedMaterialSettings Class Reference

A Phong shading model with diffuse texture map. More...

#include <qgsphongtexturedmaterialsettings.h>

Inheritance diagram for QgsPhongTexturedMaterialSettings:

Public Member Functions

 QgsPhongTexturedMaterialSettings ()=default
QColor ambient () const
 Returns ambient color component.
QColor averageColor () const override
 Returns an approximate color representing the blended material color.
QgsPhongTexturedMaterialSettingsclone () const override
 Clones the material settings.
QString diffuseTexturePath () const
 Returns the diffuse texture path.
bool equals (const QgsAbstractMaterialSettings *other) const override
 Returns true if this settings exactly matches an other settings.
double opacity () const
 Returns the opacity of the surface.
bool operator== (const QgsPhongTexturedMaterialSettings &other) const
void readXml (const QDomElement &elem, const QgsReadWriteContext &context) override
 Reads settings from a DOM element.
bool requiresTextureCoordinates () const override
 Returns true if the material requires texture coordinates to be generated during triangulation.
void setAmbient (const QColor &ambient)
 Sets ambient color component.
void setColorsFromBase (const QColor &baseColor) override
 Decomposes a base color into Phong material components.
void setColorsFromBase (const QColor &baseColor, float metallic)
 Decompose an average color into Phong material components, and sets the material's colors accordingly.
void setDiffuseTexturePath (const QString &path)
 Sets the path of the diffuse texture.
void setOpacity (double opacity)
 Sets opacity of the surface.
void setShininess (double shininess)
 Sets shininess of the surface.
void setSpecular (const QColor &specular)
 Sets specular color component.
void setTextureRotation (double rotation)
 Sets the texture rotation in degrees.
void setTextureScale (double scale)
 Sets the texture scale The texture scale changes the size of the displayed texture in the 3D scene If the texture scale is less than 1 the texture will be stretched.
double shininess () const
 Returns shininess of the surface.
QColor specular () const
 Returns specular color component.
double textureRotation () const
 Returns the texture rotation, in degrees.
double textureScale () const
 Returns the texture scale The texture scale changes the size of the displayed texture in the 3D scene If the texture scale is less than 1 the texture will be stretched.
QString type () const override
 Returns the unique type name for the material.
void writeXml (QDomElement &elem, const QgsReadWriteContext &context) const override
 Writes settings to a DOM element.
Public Member Functions inherited from QgsAbstractMaterialSettings
virtual ~QgsAbstractMaterialSettings ()=default
QgsPropertyCollection dataDefinedProperties () const
 Returns the symbol material property collection, used for data defined overrides.
const QgsPropertiesDefinitionpropertyDefinitions () const
 Returns a reference to the material properties definition, used for data defined overrides.
virtual bool requiresTangents () const
 Returns true if the material requires tangents generated during triangulation.
void setDataDefinedProperties (const QgsPropertyCollection &collection)
 Sets the material property collection, used for data defined overrides.

Static Public Member Functions

static QgsAbstractMaterialSettingscreate ()
 Returns a new instance of QgsPhongTexturedMaterialSettings.
static bool supportsTechnique (Qgis::MaterialRenderingTechnique technique)
 Returns true if the specified technique is supported by the Phong material.

Additional Inherited Members

Public Types inherited from QgsAbstractMaterialSettings
enum class  Property : int {
  Diffuse , Ambient , Warm , Cool ,
  Specular , BaseColor , EmissionColor
}
 Data definable properties. More...

Detailed Description

A Phong shading model with diffuse texture map.

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.
Since
QGIS 3.16

Definition at line 38 of file qgsphongtexturedmaterialsettings.h.

Constructor & Destructor Documentation

◆ QgsPhongTexturedMaterialSettings()

QgsPhongTexturedMaterialSettings::QgsPhongTexturedMaterialSettings ( )
default

Member Function Documentation

◆ ambient()

QColor QgsPhongTexturedMaterialSettings::ambient ( ) const
inline

Returns ambient color component.

Definition at line 59 of file qgsphongtexturedmaterialsettings.h.

◆ averageColor()

QColor QgsPhongTexturedMaterialSettings::averageColor ( ) const
overridevirtual

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
ambient()
specular()
diffuseTexturePath()
Since
QGIS 4.2

Implements QgsAbstractMaterialSettings.

Definition at line 82 of file qgsphongtexturedmaterialsettings.cpp.

◆ clone()

QgsPhongTexturedMaterialSettings * QgsPhongTexturedMaterialSettings::clone ( ) const
overridevirtual

Clones the material settings.

Caller takes ownership of the returned object.

Implements QgsAbstractMaterialSettings.

Definition at line 58 of file qgsphongtexturedmaterialsettings.cpp.

◆ create()

QgsAbstractMaterialSettings * QgsPhongTexturedMaterialSettings::create ( )
static

Returns a new instance of QgsPhongTexturedMaterialSettings.

Definition at line 53 of file qgsphongtexturedmaterialsettings.cpp.

◆ diffuseTexturePath()

QString QgsPhongTexturedMaterialSettings::diffuseTexturePath ( ) const
inline

Returns the diffuse texture path.

See also
setDiffuseTexturePath()

Definition at line 70 of file qgsphongtexturedmaterialsettings.h.

◆ equals()

bool QgsPhongTexturedMaterialSettings::equals ( const QgsAbstractMaterialSettings * other) const
overridevirtual

Returns true if this settings exactly matches an other settings.

Since
QGIS 3.42

Implements QgsAbstractMaterialSettings.

Definition at line 63 of file qgsphongtexturedmaterialsettings.cpp.

◆ opacity()

double QgsPhongTexturedMaterialSettings::opacity ( ) const
inline

Returns the opacity of the surface.

Since
QGIS 3.28

Definition at line 90 of file qgsphongtexturedmaterialsettings.h.

◆ operator==()

bool QgsPhongTexturedMaterialSettings::operator== ( const QgsPhongTexturedMaterialSettings & other) const
inline

Definition at line 177 of file qgsphongtexturedmaterialsettings.h.

◆ readXml()

void QgsPhongTexturedMaterialSettings::readXml ( const QDomElement & element,
const QgsReadWriteContext &  )
overridevirtual

Reads settings from a DOM element.

Reimplemented from QgsAbstractMaterialSettings.

Definition at line 185 of file qgsphongtexturedmaterialsettings.cpp.

◆ requiresTextureCoordinates()

bool QgsPhongTexturedMaterialSettings::requiresTextureCoordinates ( ) const
overridevirtual

Returns true if the material requires texture coordinates to be generated during triangulation.

Since
QGIS 4.2

Reimplemented from QgsAbstractMaterialSettings.

Definition at line 72 of file qgsphongtexturedmaterialsettings.cpp.

◆ setAmbient()

void QgsPhongTexturedMaterialSettings::setAmbient ( const QColor & ambient)
inline

Sets ambient color component.

Definition at line 93 of file qgsphongtexturedmaterialsettings.h.

◆ setColorsFromBase() [1/2]

void QgsPhongTexturedMaterialSettings::setColorsFromBase ( const QColor & baseColor)
overridevirtual

Decomposes a base color into Phong material components.

Sets ambient and specular colors from the input color. This is equivalent to calling setColorsFromBase with the metallic parameter equal to 0: setColorsFromBase(baseColor, 0).

Parameters
baseColorThe color to decompose
See also
setAmbient()
setSpecular()
Since
QGIS 4.2

Implements QgsAbstractMaterialSettings.

Definition at line 180 of file qgsphongtexturedmaterialsettings.cpp.

◆ setColorsFromBase() [2/2]

void QgsPhongTexturedMaterialSettings::setColorsFromBase ( const QColor & baseColor,
float metallic )

Decompose an average color into Phong material components, and sets the material's colors accordingly.

Sets ambient and specular colors from the input color. This also sets the shininess parameter based on the metallic value.

Parameters
baseColorThe color to decompose
metallicControls how "metal-like" a material appears. Value between 0 and 1
See also
setAmbient()
setSpecular()
setShininess()
Since
QGIS 4.2

Definition at line 153 of file qgsphongtexturedmaterialsettings.cpp.

◆ setDiffuseTexturePath()

void QgsPhongTexturedMaterialSettings::setDiffuseTexturePath ( const QString & path)
inline

Sets the path of the diffuse texture.

See also
diffuseTexturePath()

Definition at line 104 of file qgsphongtexturedmaterialsettings.h.

◆ setOpacity()

void QgsPhongTexturedMaterialSettings::setOpacity ( double opacity)
inline

Sets opacity of the surface.

Since
QGIS 3.28

Definition at line 124 of file qgsphongtexturedmaterialsettings.h.

◆ setShininess()

void QgsPhongTexturedMaterialSettings::setShininess ( double shininess)
inline

Sets shininess of the surface.

Definition at line 98 of file qgsphongtexturedmaterialsettings.h.

◆ setSpecular()

void QgsPhongTexturedMaterialSettings::setSpecular ( const QColor & specular)
inline

Sets specular color component.

Definition at line 96 of file qgsphongtexturedmaterialsettings.h.

◆ setTextureRotation()

void QgsPhongTexturedMaterialSettings::setTextureRotation ( double rotation)
inline

Sets the texture rotation in degrees.

Definition at line 118 of file qgsphongtexturedmaterialsettings.h.

◆ setTextureScale()

void QgsPhongTexturedMaterialSettings::setTextureScale ( double scale)
inline

Sets the texture scale The texture scale changes the size of the displayed texture in the 3D scene If the texture scale is less than 1 the texture will be stretched.

Definition at line 115 of file qgsphongtexturedmaterialsettings.h.

◆ shininess()

double QgsPhongTexturedMaterialSettings::shininess ( ) const
inline

Returns shininess of the surface.

Definition at line 63 of file qgsphongtexturedmaterialsettings.h.

◆ specular()

QColor QgsPhongTexturedMaterialSettings::specular ( ) const
inline

Returns specular color component.

Definition at line 61 of file qgsphongtexturedmaterialsettings.h.

◆ supportsTechnique()

bool QgsPhongTexturedMaterialSettings::supportsTechnique ( Qgis::MaterialRenderingTechnique technique)
static

Returns true if the specified technique is supported by the Phong material.

Definition at line 34 of file qgsphongtexturedmaterialsettings.cpp.

◆ textureRotation()

double QgsPhongTexturedMaterialSettings::textureRotation ( ) const

Returns the texture rotation, in degrees.

Definition at line 77 of file qgsphongtexturedmaterialsettings.cpp.

◆ textureScale()

double QgsPhongTexturedMaterialSettings::textureScale ( ) const
inline

Returns the texture scale The texture scale changes the size of the displayed texture in the 3D scene If the texture scale is less than 1 the texture will be stretched.

Definition at line 77 of file qgsphongtexturedmaterialsettings.h.

◆ type()

QString QgsPhongTexturedMaterialSettings::type ( ) const
overridevirtual

Returns the unique type name for the material.

Implements QgsAbstractMaterialSettings.

Definition at line 29 of file qgsphongtexturedmaterialsettings.cpp.

◆ writeXml()

void QgsPhongTexturedMaterialSettings::writeXml ( QDomElement & element,
const QgsReadWriteContext &  ) const
overridevirtual

Writes settings to a DOM element.

Reimplemented from QgsAbstractMaterialSettings.

Definition at line 198 of file qgsphongtexturedmaterialsettings.cpp.


The documentation for this class was generated from the following files: