IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

QRenderPass Class

Encapsulates a Render Pass.

This class was introduced in Qt 5.7.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

QRenderPass Class

  • Header: QRenderPass

  • Since: Qt 5.7

  • CMake:

    find_package(Qt6 REQUIRED COMPONENTS 3drender)

    target_link_libraries(mytarget PRIVATE Qt6::3drender)

  • qmake: QT += 3drender

  • Inherited By:

  • Instantiated By: qml-qt3d-render-renderpass.xml

  • Inherits: Qt3DCore::QNode

Detailed Description

A Qt3DRender::QRenderPass specifies a single rendering pass - an instance of shader program execution - used by Qt3DRender::QTechnique. Render pass consists of a Qt3DRender::QShaderProgram and a list of Qt3DRender::QFilterKey objects, a list of Qt3DRender::QRenderState objects and a list of Qt3DRender::QParameter objects.

QRenderPass executes the QShaderProgram using the given QRenderState and QParameter nodes when at least one of QFilterKey nodes being referenced matches any of the QFilterKey nodes in QRenderPassFilter or when no QFilterKey nodes are specified and no QRenderPassFilter is present in the FrameGraph.

If the QRenderPass defines a QParameter, it will be overridden by a QParameter with the same name if it exists in any of the QTechnique, QEffect, QMaterial, QTechniqueFilter, QRenderPassFilter associated with the pass at runtime. This still can be useful to define sane default values.

At render time, for each leaf node of the FrameGraph a base render state is recorded by accumulating states defined by all QRenderStateSet nodes in the FrameGraph branch. Each QRenderPass can overload this base render state by specifying its own QRenderState nodes.

 
Sélectionnez
// Create the render passes
QRenderPass *pass = new QRenderPass();

// Create shader program
QShaderProgram *glShader = new QShaderProgram();

// Set the shader on the render pass
pass->setShaderProgram(glShader);

// Create a FilterKey
QFilterKey *filterKey = new QFilterKey();
filterKey->setName(QStringLiteral("name"));
fitlerKey->setValue(QStringLiteral("zFillPass"));

// Add the FilterKey to the pass
pass->addFilterKey(filterKey);

// Create a QParameter
QParameter *colorParameter = new QParameter(QStringLiteral("color"), QColor::fromRgbF(0.0f, 0.0f, 1.0f, 1.0f));

// Add parameter to pass
pass->addParameter(colorParameter);

// Create a QRenderState
QDepthTest *depthTest = new QDepthTest();

// Add the render state to the pass
pass->addRenderState(depthTest);

See Also

Property Documentation

 

shaderProgram : Qt3DRender::QShaderProgram*

Specifies the shader program to be used for this render pass.

Access functions:

  • *shaderProgram() const

  • void setShaderProgram( *shaderProgram)

Notifier signal:

  • void shaderProgramChanged( *shaderProgram)

Member Function Documentation

 

[explicit] QRenderPass::QRenderPass(Qt3DCore::QNode *parent = nullptr)

Constructs a new QRenderPass with the specified parent.

void QRenderPass::addFilterKey(Qt3DRender::QFilterKey *filterKey)

Adds filterKey to the Qt3DRender::QRenderPass local filter keys.

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

Add parameter to the render pass' parameters.

void QRenderPass::addRenderState(Qt3DRender::QRenderState *state)

Adds a render state to the rendering pass. That implies that when the pass is executed at render time, the globally set render state will be modified by the states defined locally by the Qt3DRender::QRenderPass.

not defining any Qt3DRender::QRenderState in a pass will result in the pass using the globally set render state for a given FrameGraph branch execution path.

QList<Qt3DRender::QFilterKey *> QRenderPass::filterKeys() const

Returns the list of Qt3DRender::QFilterKey key objects making up the filter keys of the Qt3DRender::QRenderPass.

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

Returns a vector of the render pass' current parameters

void QRenderPass::removeFilterKey(Qt3DRender::QFilterKey *filterKey)

Removes filterKey from the Qt3DRender::QRenderPass local filter keys.

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

Remove parameter from the render pass' parameters.

void QRenderPass::removeRenderState(Qt3DRender::QRenderState *state)

Removes state from the Qt3DRender::QRenderPass local render state.

QList<Qt3DRender::QRenderState *> QRenderPass::renderStates() const

Returns the list of Qt3DRender::QRenderState state objects making up the render state of the Qt3DRender::QRenderPass.

Related Non-Members

 

[alias] ParameterList

A list of Qt3DRender::QParameter parameters.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+