QRenderPass Class

(Qt3DRender::QRenderPass)

Encapsulates a Render Pass. More...

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

Properties

Public Functions

QRenderPass(Qt3DCore::QNode *parent = nullptr)
void addFilterKey(QFilterKey *filterKey)
void addParameter(QParameter *parameter)
void addRenderState(QRenderState *state)
QVector<QFilterKey *> filterKeys() const
QVector<QParameter *> parameters() const
void removeFilterKey(QFilterKey *filterKey)
void removeParameter(QParameter *parameter)
void removeRenderState(QRenderState *state)
QVector<QRenderState *> renderStates() const
QShaderProgram *shaderProgram() const

Public Slots

void setShaderProgram(QShaderProgram *shaderProgram)

Signals

void shaderProgramChanged(QShaderProgram *shaderProgram)

Protected Functions

QRenderPass(QRenderPassPrivate &dd, Qt3DCore::QNode *parent = nullptr)
typedef ParameterList

Additional Inherited Members

  • 11 static public members inherited from QObject

Detailed Description

Encapsulates a Render Pass.

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.

// 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 QRenderPassFilter, QFilterKey, QParameter, QRenderState, QEffect, and QTechnique.

Property Documentation

shaderProgram : Qt3DRender::QShaderProgram *

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

Access functions:

QShaderProgram *shaderProgram() const
void setShaderProgram(QShaderProgram *shaderProgram)

Notifier signal:

void shaderProgramChanged(QShaderProgram *shaderProgram)

Member Function Documentation

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

Constructs a new QRenderPass with the specified parent.

[protected] QRenderPass::QRenderPass(QRenderPassPrivate &dd, Qt3DCore::QNode *parent = nullptr)

Copy constructor.

void QRenderPass::addFilterKey(QFilterKey *filterKey)

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

void QRenderPass::addParameter(QParameter *parameter)

Add parameter to the render pass' parameters.

void QRenderPass::addRenderState(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.

Note: 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.

QVector<QFilterKey *> QRenderPass::filterKeys() const

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

QVector<QParameter *> QRenderPass::parameters() const

Returns a vector of the render pass' current parameters

void QRenderPass::removeFilterKey(QFilterKey *filterKey)

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

void QRenderPass::removeParameter(QParameter *parameter)

Remove parameter from the render pass' parameters.

void QRenderPass::removeRenderState(QRenderState *state)

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

QVector<QRenderState *> QRenderPass::renderStates() const

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

Related Non-Members

typedef Qt3DRender::ParameterList

A list of Qt3DRender::QParameter parameters.

© 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.