QEffect Class
(Qt3DRender::QEffect)The base class for effects in a Qt 3D scene. 更多...
头文件: | #include <QEffect> |
qmake: | QT += 3drender |
开始支持版本: | Qt 5.7 |
Instantiated By: | Effect |
基类: | Qt3DCore::QNode |
公有函数
QEffect(Qt3DCore::QNode *parent = nullptr) | |
~QEffect() | |
void | addParameter(QParameter *parameter) |
void | addTechnique(QTechnique *t) |
QVector<QParameter *> | parameters() const |
void | removeParameter(QParameter *parameter) |
void | removeTechnique(QTechnique *t) |
QVector<QTechnique *> | techniques() const |
- 11 个公有函数继承自 Qt3DCore::QNode
- 32 个公有函数继承自 QObject
受保护的函数
QEffect(QEffectPrivate &dd, Qt3DCore::QNode *parent = nullptr) |
- 2 个受保护的函数继承自 Qt3DCore::QNode
- 9 个受保护的函数继承自 QObject
其他继承的成员
- 3 个属性继承自 Qt3DCore::QNode
- 1 个属性继承自 QObject
- 3 个公有槽函数继承自 Qt3DCore::QNode
- 1 个公有槽函数继承自 QObject
- 4 个信号继承自 Qt3DCore::QNode
- 2 个信号继承自 QObject
- 1 个公有变量继承自 QObject
- 10 个静态公有成员继承自 QObject
- 2 个受保护的变量继承自 QObject
详细描述
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, and QParameter.
成员函数
QEffect::QEffect(Qt3DCore::QNode *parent = nullptr)
Default constructs an instance of QEffect.
[protected]
QEffect::QEffect(QEffectPrivate &dd, Qt3DCore::QNode *parent = nullptr)
Copy constructor.
QEffect::~QEffect()
Destroys the instance of QEffect.
void QEffect::addParameter(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(QTechnique *t)
Adds a new technique t to the effect. It sends a QPropertyNodeAddedChange to the backend.
QVector<QParameter *> QEffect::parameters() const
Returns the list of parameters used by the effect.
void QEffect::removeParameter(QParameter *parameter)
Removes a parameter parameter from the effect.
void QEffect::removeTechnique(QTechnique *t)
Removes a technique t from the effect.
QVector<QTechnique *> QEffect::techniques() const
Returns the list of techniques used by the effect.