The base class for effects in a Qt 3D scene. 更多...
头: | #include <QEffect> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS 3drender)
target_link_libraries(mytarget PRIVATE Qt6::3drender) |
qmake: | QT += 3drender |
实例化: | Effect |
继承: | Qt3DCore::QNode |
void | addParameter (Qt3DRender::QParameter * 参数 ) |
void | addTechnique (Qt3DRender::QTechnique * t ) |
QList<Qt3DRender::QParameter *> | 参数 () const |
void | removeParameter (Qt3DRender::QParameter * 参数 ) |
void | removeTechnique (Qt3DRender::QTechnique * t ) |
QList<Qt3DRender::QTechnique *> | techniques () const |
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 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 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 a QEffect overrides parameter (of the same name) defined in QTechnique and QRenderPass , but are overridden by parameter in QRenderPassFilter , QTechniqueFilter and QMaterial .
另请参阅 QMaterial , QTechnique ,和 QParameter .
添加 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.
Adds a new technique t to the effect. It sends an update to the backend.
Returns the list of parameters used by the effect.
Removes a parameter parameter from the effect.
Removes a technique t from the effect.
Returns the list of techniques used by the effect.