QEffect Class | Qt 3D 5.13.0

Qt 5.13 | Qt 3D | C++ Classes | QEffect

Qt 5.13.0 Reference Documentation

# QEffect Class

(Qt3DRender::QEffect)

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

Header: | #include <QEffect>
qmake: | QT += 3drender
Since: | Qt 5.7
Instantiated By: | Effect
Inherits: | Qt3DCore::QNode

This class was introduced in Qt 5.7.

- List of all members, including inherited members
- Obsolete members

## Public Functions

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

- 13 public functions inherited from Qt3DCore::QNode
- 30 public functions inherited from QObject

## Related Non-Members

typedef | QNodePtr
typedef | QNodeVector
typedef | QObjectList
QList<T> | qFindChildren(const QObject *obj, const QRegExp &regExp)
Qt3DCore::QNodeId | qIdForNode(Qt3DCore::QNode *node)
Qt3DCore::QNodeIdVector | qIdsForNodes(const T &nodes)
T | qobject_cast(QObject *object)
T | qobject_cast(const QObject *object)

## Macros

| QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
| Q_CLASSINFO(Name, Value)
| Q_DISABLE_COPY(Class)
| Q_DISABLE_COPY_MOVE(Class)
| Q_DISABLE_MOVE(Class)
| Q_EMIT
| Q_ENUM(...)
| Q_ENUM_NS(...)
| Q_FLAG(...)
| Q_FLAG_NS(...)
| Q_GADGET
| Q_INTERFACES(...)
| Q_INVOKABLE
| Q_NAMESPACE
| Q_OBJECT
| Q_PROPERTY(...)
| Q_REVISION
| Q_SET_OBJECT_NAME(Object)
| Q_SIGNAL
| Q_SIGNALS
| Q_SLOT
| Q_SLOTS

### Additional Inherited Members

- 3 properties inherited from Qt3DCore::QNode
- 1 property inherited from QObject
- 3 public slots inherited from Qt3DCore::QNode
- 1 public slot inherited from QObject
- 4 signals inherited from Qt3DCore::QNode
- 2 signals inherited from QObject
- 9 static public members inherited from QObject
- 2 protected functions inherited from Qt3DCore::QNode
- 9 protected functions inherited from QObject

## 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.

      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
      gl3Pass->setShaderProgram(glShader);

      // Add the pass to the technique
      gl3Technique->addRenderPass(gl3Pass);

      // Set the targeted GL version for the technique
      gl3Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
      gl3Technique->graphicsApiFilter()->setMajorVersion(3);
      gl3Technique->graphicsApiFilter()->setMinorVersion(1);
      gl3Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile);

      // Add the technique to the effect
      effect->addTechnique(gl3Technique);

A QParameter defined on an Effect is overridden by a QParameter (of the same name) defined in a QMaterial, QTechniqueFilter, QRenderPassFilter.

See also QMaterial, QTechnique, and QParameter.

## Member Function Documentation

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

Adds parameter to the effect. It sends a QPropertyNodeAddedChange 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 a QPropertyNodeAddedChange to the backend.

### QVector<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.

### QVector<Qt3DRender::QTechnique *> QEffect::techniques() const

Returns the list of techniques used by the effect.