Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

QRenderPass Class

class Qt3DRender::QRenderPass

Encapsulates a Render Pass. More...

Header: #include <QRenderPass>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3drender)
target_link_libraries(mytarget PRIVATE Qt6::3drender)
qmake: QT += 3drender
Since: Qt 5.7
Instantiated By: RenderPass
Inherits: Qt3DCore::QNode

Properties

Public Functions

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

Public Slots

void setShaderProgram(Qt3DRender::QShaderProgram *shaderProgram)

Signals

void shaderProgramChanged(Qt3DRender::QShaderProgram *shaderProgram)

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.

// 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:

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

Notifier signal:

void shaderProgramChanged(Qt3DRender::QShaderProgram *shaderProgram)

Member Function Documentation

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.

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.

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.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded