QSGAbstractRenderer Class

QSGAbstractRenderer gives access to the scene graph nodes and rendering of a QSGEngine. 更多...

头: #include <QSGAbstractRenderer>
qmake: QT += quick
Since: Qt 5.4
继承: QObject

该类在 Qt 5.4 引入。

公共类型

flags ClearMode
enum ClearModeBit { ClearColorBuffer, ClearDepthBuffer, ClearStencilBuffer }
enum MatrixTransformFlag { MatrixTransformFlipY }
flags MatrixTransformFlags

公共函数

QColor clearColor () const
QSGAbstractRenderer::ClearMode clearMode () const
QRect deviceRect () const
QMatrix4x4 projectionMatrix () const
virtual void renderScene (uint fboId = 0) = 0
QSGRootNode * rootNode () const
void setClearColor (const QColor & color )
void setClearMode (QSGAbstractRenderer::ClearMode mode )
void setDeviceRect (const QRect & rect )
void setDeviceRect (const QSize & size )
void setProjectionMatrix (const QMatrix4x4 & matrix )
void setProjectionMatrixToRect (const QRectF & rect )
void setProjectionMatrixToRect (const QRectF & rect , QSGAbstractRenderer::MatrixTransformFlags flags )
void setRootNode (QSGRootNode * node )
void setViewportRect (const QRect & rect )
void setViewportRect (const QSize & size )
QRect viewportRect () const

信号

void sceneGraphChanged ()

详细描述

A QSGAbstractRenderer created by a QSGEngine allows you to set your QSGNode tree through setRootNode () and control the rendering viewport through setDeviceRect (), setViewportRect () 和 setProjectionMatrixToRect (). You can finally trigger the rendering to the desired framebuffer through renderScene ().

The QSGAbstractRenderer is only available when used with a QSGEngine and isn't exposed when used internally by QQuickWindow .

另请参阅 QSGEngine and QSGNode .

成员类型文档编制

enum QSGAbstractRenderer:: ClearModeBit
flags QSGAbstractRenderer:: ClearMode

Used with setClearMode () to indicate which buffer should be cleared before the scene render.

常量 描述
QSGAbstractRenderer::ClearColorBuffer 0x0001 Clear the color buffer using clearColor ().
QSGAbstractRenderer::ClearDepthBuffer 0x0002 Clear the depth buffer.
QSGAbstractRenderer::ClearStencilBuffer 0x0004 Clear the stencil buffer.

The ClearMode type is a typedef for QFlags <ClearModeBit>. It stores an OR combination of ClearModeBit values.

另请参阅 setClearMode () 和 setClearColor ().

enum QSGAbstractRenderer:: MatrixTransformFlag
flags QSGAbstractRenderer:: MatrixTransformFlags

Used with setProjectionMatrixToRect () to indicate the expectations towards the generated projection matrix.

常量 描述
QSGAbstractRenderer::MatrixTransformFlipY 0x01 The traditional assumption in Qt Quick is that Y points up in the normalized device coordinate system. There is at least one modern graphics API where this is not the case (Vulkan). This flag can then be used to get a projection that is appropriate for such an API.

该枚举在 Qt 5.14 引入或被修改。

The MatrixTransformFlags type is a typedef for QFlags <MatrixTransformFlag>. It stores an OR combination of MatrixTransformFlag values.

另请参阅 setProjectionMatrixToRect ().

成员函数文档编制

[signal] void QSGAbstractRenderer:: sceneGraphChanged ()

This signal is emitted on the first modification of a node in the tree after the last scene render.

QColor QSGAbstractRenderer:: clearColor () const

Returns the color that clears the framebuffer at the beginning of the rendering.

另请参阅 setClearColor () 和 clearMode ().

QSGAbstractRenderer::ClearMode QSGAbstractRenderer:: clearMode () const

Flags defining which attachment of the framebuffer will be cleared before each scene render.

另请参阅 setClearMode () 和 clearColor ().

QRect QSGAbstractRenderer:: deviceRect () const

Returns the device rect of the surface being rendered to.

另请参阅 setDeviceRect ().

QMatrix4x4 QSGAbstractRenderer:: projectionMatrix () const

Returns the projection matrix

另请参阅 setProjectionMatrix () 和 setProjectionMatrixToRect ().

[pure virtual] void QSGAbstractRenderer:: renderScene ( uint fboId = 0)

Render the scene to the specified fboId

fboId isn't specified, the scene graph will be rendered to the default framebuffer. You will have to call QOpenGLContext::swapBuffers () yourself afterward.

The framebuffer specified by fboId will be bound automatically.

另请参阅 QOpenGLContext::swapBuffers () 和 QOpenGLFramebufferObject::handle ().

QSGRootNode *QSGAbstractRenderer:: rootNode () const

Returns the root of the QSGNode scene.

另请参阅 setRootNode ().

void QSGAbstractRenderer:: setClearColor (const QColor & color )

使用 color to clear the framebuffer when clearMode () 被设为 QSGAbstractRenderer::ClearColorBuffer .

另请参阅 clearColor () 和 setClearMode ().

void QSGAbstractRenderer:: setClearMode ( QSGAbstractRenderer::ClearMode mode )

Defines which attachment of the framebuffer should be cleared before each scene render with the mode 标志。

另请参阅 clearMode () 和 setClearColor ().

void QSGAbstractRenderer:: setDeviceRect (const QRect & rect )

设置 rect as the geometry of the surface being rendered to.

另请参阅 deviceRect ().

void QSGAbstractRenderer:: setDeviceRect (const QSize & size )

这是重载函数。

设置 size of the surface being rendered to.

另请参阅 deviceRect ().

void QSGAbstractRenderer:: setProjectionMatrix (const QMatrix4x4 & matrix )

使用 matrix to project the QSGNode coordinates onto surface pixels.

另请参阅 projectionMatrix () 和 setProjectionMatrixToRect ().

void QSGAbstractRenderer:: setProjectionMatrixToRect (const QRectF & rect )

Convenience method that calls setProjectionMatrix () with an orthographic matrix generated from rect .

注意: This function assumes that the graphics API uses Y up in its normalized device coordinate system.

另请参阅 setProjectionMatrix () 和 projectionMatrix ().

void QSGAbstractRenderer:: setProjectionMatrixToRect (const QRectF & rect , QSGAbstractRenderer::MatrixTransformFlags flags )

Convenience method that calls setProjectionMatrix () with an orthographic matrix generated from rect .

Set MatrixTransformFlipY in flags when the graphics API uses Y down in its normalized device coordinate system (for example, Vulkan).

该函数在 Qt 5.14 引入。

另请参阅 setProjectionMatrix () 和 projectionMatrix ().

void QSGAbstractRenderer:: setRootNode ( QSGRootNode * node )

设置 node as the root of the QSGNode scene that you want to render. You need to provide a node before trying to render the scene.

注意: This doesn't take ownership of node .

另请参阅 rootNode ().

void QSGAbstractRenderer:: setViewportRect (const QRect & rect )

设置 rect as the geometry of the viewport to render on the surface.

另请参阅 viewportRect ().

void QSGAbstractRenderer:: setViewportRect (const QSize & size )

这是重载函数。

设置 size of the viewport to render on the surface.

另请参阅 viewportRect ().

QRect QSGAbstractRenderer:: viewportRect () const

Returns the rect of the viewport to render.

另请参阅 setViewportRect ().