QGIS API Documentation 4.1.0-Master (3b8ef1f72a3)
Loading...
Searching...
No Matches
QgsSimpleLineMaterial3DHandler Class Reference

3D handler for the material used for rendering simple lines as solid line components. More...

#include <qgssimplelinematerial3dhandler.h>

Inheritance diagram for QgsSimpleLineMaterial3DHandler:

Public Member Functions

 QgsSimpleLineMaterial3DHandler ()=default
void addParametersToEffect (Qt3DRender::QEffect *effect, const QgsAbstractMaterialSettings *settings, const QgsMaterialContext &materialContext) const override
 Adds parameters from the material settings to a destination effect.
void applyDataDefinedToGeometry (const QgsAbstractMaterialSettings *settings, Qt3DCore::QGeometry *geometry, int vertexCount, const QByteArray &data) const override
 Applies the data defined bytes, dataDefinedBytes, on the geometry by filling a specific vertex buffer that will be used by the shader.
Qt3DCore::QEntity * createPreviewMesh (const QString &type, Qt3DCore::QEntity *parent) const override
 Creates a new entity representing a suitable preview mesh for this material type.
Qt3DCore::QEntity * createPreviewScene (const QgsAbstractMaterialSettings *settings, const QString &type, const QgsMaterialContext &context, Qt3DExtras::Qt3DWindow *window, Qt3DCore::QEntity *parent) const override
 Builds a complete self-contained scene for previewing the material, using the specified mesh type.
QByteArray dataDefinedVertexColorsAsByte (const QgsAbstractMaterialSettings *settings, const QgsExpressionContext &expressionContext) const override
 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.
QList< PreviewMeshTypepreviewMeshTypes () const override
 Returns a list of available preview mesh types for the material.
QMap< QString, QString > toExportParameters (const QgsAbstractMaterialSettings *settings) const override
 Returns the parameters to be exported to .mtl file.
QgsMaterialtoMaterial (const QgsAbstractMaterialSettings *settings, Qgis::MaterialRenderingTechnique technique, const QgsMaterialContext &context) const override
 Creates a new QgsMaterial object representing the material settings.
bool updatePreviewScene (Qt3DCore::QEntity *sceneRoot, const QgsAbstractMaterialSettings *settings, const QgsMaterialContext &context) const override
 Updates an existing material preview scene with new material settings.
Public Member Functions inherited from QgsAbstractMaterial3DHandler
virtual ~QgsAbstractMaterial3DHandler ()=default
virtual int dataDefinedByteStride (const QgsAbstractMaterialSettings *settings) const
 Returns byte stride of the data defined colors,used to fill the vertex colors data defined buffer for rendering.

Additional Inherited Members

Static Protected Member Functions inherited from QgsAbstractMaterial3DHandler
static Qt3DRender::QParameter * findParameter (Qt3DRender::QEffect *effect, const QString &name)
 Finds an existing parameter in an effect by name.

Detailed Description

3D handler for the material used for rendering simple lines as solid line components.

Warning
Not available in Python bindings
Since
QGIS 4.2

Definition at line 35 of file qgssimplelinematerial3dhandler.h.

Constructor & Destructor Documentation

◆ QgsSimpleLineMaterial3DHandler()

QgsSimpleLineMaterial3DHandler::QgsSimpleLineMaterial3DHandler ( )
default

Member Function Documentation

◆ addParametersToEffect()

void QgsSimpleLineMaterial3DHandler::addParametersToEffect ( Qt3DRender::QEffect * effect,
const QgsAbstractMaterialSettings * settings,
const QgsMaterialContext & materialContext ) const
overridevirtual

Adds parameters from the material settings to a destination effect.

Implements QgsAbstractMaterial3DHandler.

Definition at line 89 of file qgssimplelinematerial3dhandler.cpp.

◆ applyDataDefinedToGeometry()

void QgsSimpleLineMaterial3DHandler::applyDataDefinedToGeometry ( const QgsAbstractMaterialSettings * settings,
Qt3DCore::QGeometry * geometry,
int vertexCount,
const QByteArray & dataDefinedBytes ) const
overridevirtual

Applies the data defined bytes, dataDefinedBytes, on the geometry by filling a specific vertex buffer that will be used by the shader.

Reimplemented from QgsAbstractMaterial3DHandler.

Definition at line 116 of file qgssimplelinematerial3dhandler.cpp.

◆ createPreviewMesh()

Qt3DCore::QEntity * QgsSimpleLineMaterial3DHandler::createPreviewMesh ( const QString & type,
Qt3DCore::QEntity * parent ) const
overridevirtual

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 from QgsAbstractMaterial3DHandler.

Definition at line 142 of file qgssimplelinematerial3dhandler.cpp.

◆ createPreviewScene()

Qt3DCore::QEntity * QgsSimpleLineMaterial3DHandler::createPreviewScene ( const QgsAbstractMaterialSettings * settings,
const QString & type,
const QgsMaterialContext & context,
Qt3DExtras::Qt3DWindow * window,
Qt3DCore::QEntity * parent ) const
overridevirtual

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 from QgsAbstractMaterial3DHandler.

Definition at line 163 of file qgssimplelinematerial3dhandler.cpp.

◆ dataDefinedVertexColorsAsByte()

QByteArray QgsSimpleLineMaterial3DHandler::dataDefinedVertexColorsAsByte ( const QgsAbstractMaterialSettings * settings,
const QgsExpressionContext & expressionContext ) const
overridevirtual

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.

See also
applyDataDefinedToGeometry()
Since
QGIS 3.18

Reimplemented from QgsAbstractMaterial3DHandler.

Definition at line 99 of file qgssimplelinematerial3dhandler.cpp.

◆ previewMeshTypes()

QList< QgsAbstractMaterial3DHandler::PreviewMeshType > QgsSimpleLineMaterial3DHandler::previewMeshTypes ( ) const
overridevirtual

Returns a list of available preview mesh types for the material.

Reimplemented from QgsAbstractMaterial3DHandler.

Definition at line 134 of file qgssimplelinematerial3dhandler.cpp.

◆ toExportParameters()

QMap< QString, QString > QgsSimpleLineMaterial3DHandler::toExportParameters ( const QgsAbstractMaterialSettings * settings) const
overridevirtual

Returns the parameters to be exported to .mtl file.

Implements QgsAbstractMaterial3DHandler.

Definition at line 79 of file qgssimplelinematerial3dhandler.cpp.

◆ toMaterial()

QgsMaterial * QgsSimpleLineMaterial3DHandler::toMaterial ( const QgsAbstractMaterialSettings * settings,
Qgis::MaterialRenderingTechnique technique,
const QgsMaterialContext & context ) const
overridevirtual

Creates a new QgsMaterial object representing the material settings.

The technique argument specifies the rendering technique which will be used with the returned material.

Implements QgsAbstractMaterial3DHandler.

Definition at line 37 of file qgssimplelinematerial3dhandler.cpp.

◆ updatePreviewScene()

bool QgsSimpleLineMaterial3DHandler::updatePreviewScene ( Qt3DCore::QEntity * sceneRoot,
const QgsAbstractMaterialSettings * settings,
const QgsMaterialContext & context ) const
overridevirtual

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().

Implements QgsAbstractMaterial3DHandler.

Definition at line 188 of file qgssimplelinematerial3dhandler.cpp.


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