|
QGIS API Documentation 4.1.0-Master (31622b25bb0)
|
Abstract base class for material 3D handlers. More...
#include <qgsmaterial3dhandler.h>

Classes | |
| struct | PreviewMeshType |
| Encapsulates information about available preview meshes. More... | |
Public Member Functions | |
| virtual | ~QgsAbstractMaterial3DHandler ()=default |
| virtual void | applyDataDefinedToGeometry (const QgsAbstractMaterialSettings *settings, Qt3DCore::QGeometry *geometry, int vertexCount, const QByteArray &dataDefinedBytes) const |
| Applies the data defined bytes, dataDefinedBytes, on the geometry by filling a specific vertex buffer that will be used by the shader. | |
| virtual Qt3DCore::QEntity * | createPreviewMesh (const QString &type, Qt3DCore::QEntity *parent) const |
| Creates a new entity representing a suitable preview mesh for this material type. | |
| virtual Qt3DCore::QEntity * | createPreviewScene (const QgsAbstractMaterialSettings *settings, const QString &type, const QgsMaterialContext &context, QWindow *window, Qt3DCore::QEntity *parent) const |
| Builds a complete self-contained scene for previewing the material, using the specified mesh type. | |
| virtual QByteArray | dataDefinedVertexColorsAsByte (const QgsAbstractMaterialSettings *settings, const QgsExpressionContext &expressionContext) const |
| Returns byte array corresponding to the data defined colors depending of the expressionContext, used to fill the specific vertex buffer used for rendering the geometry. | |
| virtual QList< PreviewMeshType > | previewMeshTypes () const |
| Returns a list of available preview mesh types for the material. | |
| virtual QMap< QString, QString > | toExportParameters (const QgsAbstractMaterialSettings *settings) const =0 |
| Returns the parameters to be exported to .mtl file. | |
| virtual QgsMaterial * | toInstancedMaterial (const QgsAbstractMaterialSettings *settings, const QgsMaterialContext &context, Qgis::InstancedMaterialFlags flags) const |
| Creates a QgsMaterial for instanced point rendering. | |
| virtual QgsMaterial * | toMaterial (const QgsAbstractMaterialSettings *settings, Qgis::MaterialRenderingTechnique technique, const QgsMaterialContext &context) const =0 |
| Creates a new QgsMaterial object representing the material settings. | |
| virtual bool | updatePreviewScene (Qt3DCore::QEntity *sceneRoot, const QgsAbstractMaterialSettings *settings, const QgsMaterialContext &context) const =0 |
| Updates an existing material preview scene with new material settings. | |
Static Protected Member Functions | |
| static Qt3DRender::QParameter * | findParameter (Qt3DRender::QEffect *effect, const QString &name) |
| Finds an existing parameter in an effect by name. | |
Abstract base class for material 3D handlers.
Definition at line 140 of file qgsmaterial3dhandler.h.
|
virtualdefault |
|
virtual |
Applies the data defined bytes, dataDefinedBytes, on the geometry by filling a specific vertex buffer that will be used by the shader.
Reimplemented in QgsGoochMaterial3DHandler, QgsMetalRoughMaterial3DHandler, QgsPhongMaterial3DHandler, and QgsSimpleLineMaterial3DHandler.
Definition at line 58 of file qgsmaterial3dhandler.cpp.
|
virtual |
Creates a new entity representing a suitable preview mesh for this material type.
The default implementation returns a sphere. This method can be overridden to provide more appropriate meshes when applicable for a particular material implementation.
Ownership of the returned entity resides with the parent entity.
Reimplemented in QgsSimpleLineMaterial3DHandler.
Definition at line 110 of file qgsmaterial3dhandler.cpp.
|
virtual |
Builds a complete self-contained scene for previewing the material, using the specified mesh type.
The scene contains a mesh with the associated material applied, and appropriate lighting.
The returned entity is the scene root, parented to parent.
This method can be overridden to customize the lighting or mesh for a specific material.
Reimplemented in QgsSimpleLineMaterial3DHandler.
Definition at line 151 of file qgsmaterial3dhandler.cpp.
|
virtual |
Returns byte array corresponding to the data defined colors depending of the expressionContext, used to fill the specific vertex buffer used for rendering the geometry.
Reimplemented in QgsGoochMaterial3DHandler, QgsMetalRoughMaterial3DHandler, QgsPhongMaterial3DHandler, and QgsSimpleLineMaterial3DHandler.
Definition at line 51 of file qgsmaterial3dhandler.cpp.
|
staticprotected |
Finds an existing parameter in an effect by name.
This method searches both parameters which are directly applied effect and also parameters applied to all techniques present in the effect.
Definition at line 83 of file qgsmaterial3dhandler.cpp.
|
virtual |
Returns a list of available preview mesh types for the material.
Reimplemented in QgsSimpleLineMaterial3DHandler.
Definition at line 66 of file qgsmaterial3dhandler.cpp.
|
pure virtual |
Returns the parameters to be exported to .mtl file.
Implemented in QgsGoochMaterial3DHandler, QgsMetalRoughMaterial3DHandler, QgsMetalRoughTexturedMaterial3DHandler, QgsNullMaterial3DHandler, QgsPhongMaterial3DHandler, QgsPhongTexturedMaterial3DHandler, and QgsSimpleLineMaterial3DHandler.
|
virtual |
Creates a QgsMaterial for instanced point rendering.
The flags argument controls which per-instance attributes are active.
The default implementation returns nullptr.
Subclasses that support instancing must override this method to construct the material with the correct shader from the start.
Reimplemented in QgsGoochMaterial3DHandler, QgsMetalRoughMaterial3DHandler, QgsMetalRoughTexturedMaterial3DHandler, and QgsPhongMaterial3DHandler.
Definition at line 43 of file qgsmaterial3dhandler.cpp.
|
pure virtual |
Creates a new QgsMaterial object representing the material settings.
The technique argument specifies the rendering technique which will be used with the returned material.
Implemented in QgsGoochMaterial3DHandler, QgsMetalRoughMaterial3DHandler, QgsMetalRoughTexturedMaterial3DHandler, QgsNullMaterial3DHandler, QgsPhongMaterial3DHandler, QgsPhongTexturedMaterial3DHandler, and QgsSimpleLineMaterial3DHandler.
|
pure virtual |
Updates an existing material preview scene with new material settings.
This method is called on every material setting parameter change while configuring materials, so the implementation must be cheap (e.g. involve no entity creation, just direct manipulation of existing attributes).
Returns false if the scene could not be updated in place and needs to be regenered via createPreviewScene().
Implemented in QgsGoochMaterial3DHandler, QgsMetalRoughMaterial3DHandler, QgsMetalRoughTexturedMaterial3DHandler, QgsNullMaterial3DHandler, QgsPhongMaterial3DHandler, QgsPhongTexturedMaterial3DHandler, and QgsSimpleLineMaterial3DHandler.