QGIS/python/3d/auto_generated/materials/qgsphongtexturedmaterialsettings.sip.in
Jean Felder b69feb0817 qgsphongtexturedmaterialsettings: Add support for opacity
Qt3DRender::QTexture2D does not handle opacity. Therefore, it is not
possible to use the default Qt3DExtras::QDiffuseSpecularMaterial
implementation. This problem is solved by using
Qt3DRender::QMaterial and copying the
Qt3DExtras::QDiffuseSpecularMaterial shaders from Qt3D source
code. Then, the texture color needs to be changed to set the correct
opacity. This is achieved in the fragement shader:

```
vec4 diffuseTextureColor = vec4(texture(diffuseTexture, texCoord).rgb,
opacity);
```

instead of the default:

```
vec4 diffuseTextureColor = vec4(texture(diffuseTexture, texCoord));
```

As far as the FrameGraph is concerned, this is already handled in
Qgs3DMapScene::finalizeNewEntity which checks for all material which
have an effect with an opacity parameter.
2022-07-25 07:38:12 -07:00

157 lines
4.1 KiB
Plaintext

/************************************************************************
* This file has been generated automatically from *
* *
* src/3d/materials/qgsphongtexturedmaterialsettings.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsPhongTexturedMaterialSettings : QgsAbstractMaterialSettings
{
%Docstring(signature="appended")
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.
.. versionadded:: 3.16
%End
%TypeHeaderCode
#include "qgsphongtexturedmaterialsettings.h"
%End
public:
QgsPhongTexturedMaterialSettings();
%Docstring
Constructor for QgsPhongTexturedMaterialSettings.
%End
virtual QString type() const;
static bool supportsTechnique( QgsMaterialSettingsRenderingTechnique technique );
%Docstring
Returns ``True`` if the specified ``technique`` is supported by the Phong material.
%End
static QgsAbstractMaterialSettings *create() /Factory/;
%Docstring
Returns a new instance of QgsPhongTexturedMaterialSettings.
%End
virtual QgsPhongTexturedMaterialSettings *clone() const /Factory/;
QColor ambient() const;
%Docstring
Returns ambient color component
%End
QColor specular() const;
%Docstring
Returns specular color component
%End
float shininess() const;
%Docstring
Returns shininess of the surface
%End
virtual QMap<QString, QString> toExportParameters() const;
QString diffuseTexturePath() const;
%Docstring
Returns the diffuse texture path.
.. seealso:: :py:func:`setDiffuseTexturePath`
%End
float textureScale() const;
%Docstring
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
%End
bool requiresTextureCoordinates() const;
%Docstring
Returns ``True`` if the material requires texture coordinates to be generated
during triangulation.quiresTextureCoordinates
%End
float textureRotation() const;
%Docstring
Returns the texture rotation, in degrees.
%End
float opacity() const;
%Docstring
Returns the opacity of the surface
.. versionadded:: 3.28
%End
void setAmbient( const QColor &ambient );
%Docstring
Sets ambient color component
%End
void setSpecular( const QColor &specular );
%Docstring
Sets specular color component
%End
void setShininess( float shininess );
%Docstring
Sets shininess of the surface
%End
void setDiffuseTexturePath( const QString &path );
%Docstring
Sets the ``path`` of the diffuse texture.
.. seealso:: :py:func:`diffuseTexturePath`
%End
void setTextureScale( float scale );
%Docstring
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
%End
void setTextureRotation( float rotation );
%Docstring
Sets the texture rotation in degrees
%End
void setOpacity( float opacity );
%Docstring
Sets opacity of the surface.
.. versionadded:: 3.28
%End
virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context );
virtual void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const;
bool operator==( const QgsPhongTexturedMaterialSettings &other ) const;
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/3d/materials/qgsphongtexturedmaterialsettings.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/