QRenderPass Class

class Qt3DRender ::QRenderPass

Encapsulates a Render Pass. 更多...

头: #include <QRenderPass>
qmake: QT += 3drender
Since: Qt 5.7
实例化: RenderPass
继承: Qt3DCore::QNode

该类在 Qt 5.7 引入。

特性

公共函数

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

公共槽

void setShaderProgram (Qt3DRender::QShaderProgram * shaderProgram )

信号

void shaderProgramChanged (Qt3DRender::QShaderProgram * shaderProgram )
typedef ParameterList

详细描述

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 对象。

QRenderPass executes the QShaderProgram 使用给定 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);
					

另请参阅 QRenderPassFilter , QFilterKey , QParameter , QRenderState , QEffect ,和 QTechnique .

特性文档编制

shaderProgram : Qt3DRender::QShaderProgram *

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

访问函数:

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

通知程序信号:

void shaderProgramChanged (Qt3DRender::QShaderProgram * shaderProgram )

成员函数文档编制

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

Constructs a new QRenderPass with the specified parent .

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

添加 filterKey Qt3DRender::QRenderPass local filter keys.

void QRenderPass:: addParameter ( Qt3DRender::QParameter * 参数 )

添加 参数 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.

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

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

QVector < Qt3DRender::QParameter *> QRenderPass:: 参数 () const

Returns a vector of the render pass' current parameters

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

移除 filterKey Qt3DRender::QRenderPass local filter keys.

void QRenderPass:: removeParameter ( Qt3DRender::QParameter * 参数 )

移除 参数 from the render pass' parameters.

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

移除 state Qt3DRender::QRenderPass local render state.

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

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

相关非成员

typedef ParameterList

A list of Qt3DRender::QParameter 参数。