QEffect Class

( Qt3DRender::QEffect )

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

头: #include <QEffect>
qmake: QT += 3drender
Since: Qt 5.7
实例化: Effect
继承: Qt3DCore::QNode

公共函数

QEffect (Qt3DCore::QNode * parent = nullptr)
virtual ~QEffect ()
void addParameter (Qt3DRender::QParameter * 参数 )
void addTechnique (Qt3DRender::QTechnique * t )
QVector<Qt3DRender::QParameter *> 参数 () const
void removeParameter (Qt3DRender::QParameter * 参数 )
void removeTechnique (Qt3DRender::QTechnique * t )
QVector<Qt3DRender::QTechnique *> techniques () const

静态公共成员

const QMetaObject staticMetaObject

额外继承成员

详细描述

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

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 .

另请参阅 QMaterial , QTechnique ,和 QParameter .

成员函数文档编制

QEffect:: QEffect ( Qt3DCore::QNode * parent = nullptr)

Default constructs an instance of QEffect.

[虚拟] QEffect:: ~QEffect ()

Destroys the instance of QEffect. The destructor is virtual.

void QEffect:: addParameter ( Qt3DRender::QParameter * 参数 )

添加 参数 to the effect. It sends a QPropertyNodeAddedChange to the backend. The 参数 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:: 参数 () const

Returns the list of parameters used by the effect.

void QEffect:: removeParameter ( Qt3DRender::QParameter * 参数 )

Removes a 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.