Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

QEffect Class

class Qt3DRender::QEffect

The base class for effects in a Qt 3D scene. More...

Header: #include <QEffect>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3drender)
target_link_libraries(mytarget PRIVATE Qt6::3drender)
qmake: QT += 3drender
Since: Qt 5.7
Instantiated By: Effect
Inherits: Qt3DCore::QNode

Public Functions

void addParameter(Qt3DRender::QParameter *parameter)
void addTechnique(Qt3DRender::QTechnique *t)
QList<Qt3DRender::QParameter *> parameters() const
void removeParameter(Qt3DRender::QParameter *parameter)
void removeTechnique(Qt3DRender::QTechnique *t)
QList<Qt3DRender::QTechnique *> techniques() const

Detailed Description

The QEffect class combines a set of techniques and parameters used by those techniques to produce a rendering effect for a material.

An QEffect instance should be shared among several QMaterial instances when possible.

Note: QEffect node can not be disabled.

QEffect *effect = new QEffect();

// Create technique, render pass and shader
QTechnique *gl3Technique = new QTechnique();
QRenderPass *gl3Pass = new QRenderPass();
QShaderProgram *glShader = new QShaderProgram();

// Set the shader on the render pass

// Add the pass to the technique

// Set the targeted GL version for the technique

// Add the technique to the effect

A QParameter defined on a QEffect overrides parameter (of the same name) defined in QTechnique and QRenderPass, but are overridden by parameter in QRenderPassFilter, QTechniqueFilter and QMaterial.

See also QMaterial, QTechnique, and QParameter.

Member Function Documentation

void QEffect::addParameter(Qt3DRender::QParameter *parameter)

Adds parameter to the effect. It sends an update to the backend. The parameter will be used to set a corresponding uniform value in the shader used by this effect.

void QEffect::addTechnique(Qt3DRender::QTechnique *t)

Adds a new technique t to the effect. It sends an update to the backend.

QList<Qt3DRender::QParameter *> QEffect::parameters() const

Returns the list of parameters used by the effect.

void QEffect::removeParameter(Qt3DRender::QParameter *parameter)

Removes a parameter parameter from the effect.

void QEffect::removeTechnique(Qt3DRender::QTechnique *t)

Removes a technique t from the effect.

QList<Qt3DRender::QTechnique *> QEffect::techniques() const

Returns the list of techniques used by the effect.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded