- Qt 6.11
- Qt Quick 3D
- C++ Classes
- QSSGRenderHelpers
- Qt Quick 3D | Commercial or GPLv3

# QSSGRenderHelpers Class

Class containing helper functions for setting up and render QtQuick3D renderables. More...

Header: | `#include <QSSGRenderHelpers>`
Since: | Qt 6.7

- List of all members, including inherited members

## Public Types

enum class | CreateFlag { None, Recurse, Steal }
flags | CreateFlags

## Static Public Members

QSSGPrepResultId | commit(const QSSGFrameData &frameData, QSSGPrepContextId prepId, QSSGRenderablesId renderablesId, float lodThreshold = 1.0f)
QSSGRenderablesId | createRenderables(const QSSGFrameData &frameData, QSSGPrepContextId prepId, const QSSGNodeIdList &nodes, QSSGRenderHelpers::CreateFlags flags = CreateFlag::None)
QSSGPrepContextId | prepareForRender(const QSSGFrameData &frameData, const QSSGRenderExtension &ext, QSSGCameraId cameraId, quint32 slot = 0)
void | prepareRenderables(const QSSGFrameData &frameData, QSSGPrepResultId prepId, QRhiRenderPassDescriptor *renderPassDescriptor, QSSGRhiGraphicsPipelineState &ps, QSSGRenderablesFilters filter = QSSGRenderablesFilter::All)
void | renderRenderables(const QSSGFrameData &frameData, QSSGPrepResultId prepId)

## Detailed Description

## Member Type Documentation

### enum class QSSGRenderHelpers::CreateFlag
flags QSSGRenderHelpers::CreateFlags

Constant | Value | Description
--- | --- | ---
`QSSGRenderHelpers::CreateFlag::None` | `0` | The default value. Renderables are created only for the nodes specified.
`QSSGRenderHelpers::CreateFlag::Recurse` | `0x1` | Renderables are created for each node and their children.
`QSSGRenderHelpers::CreateFlag::Steal` | `0x2` | Renderables are taken from the engine and won't be rendered by QtQuick3D.

Note: Calling QSSGRenderHelpers::createRenderables() without the {QSSGRenderHelpers::CreateFlag::Steal}{Steal} flag set means nodes are duplicated and QtQuick3D will render its copy of the nodes as normal.

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

## Member Function Documentation

### `[static]` QSSGPrepResultId QSSGRenderHelpers::commit(const QSSGFrameData &frameData, QSSGPrepContextId prepId, QSSGRenderablesId renderablesId, float lodThreshold = 1.0f)

Once the required changes have been done to the renderables, the data can marked as ready for the renderer.

Returns an id to the preparation result.

frameData, prepId, renderablesId, lodThreshold

See also prepareRenderables() and renderRenderables().

### `[static]` QSSGRenderablesId QSSGRenderHelpers::createRenderables(const QSSGFrameData &frameData, QSSGPrepContextId prepId, const QSSGNodeIdList &nodes, QSSGRenderHelpers::CreateFlags flags = CreateFlag::None)

Takes a list of node ids and create renderables that can be further processed by the renderer. If there are no nodes, or no renderable nodes in the list, the returned id will be invalid.

By default the function does not recurse down and included children of the nodes in the list. Enabling recursion can be achieved by passing in the Recurse flag in the flags argument.

Returns an id to the created renderables.

frameData, prepId

See also CreateFlags and prepareForRender().

### `[static]` QSSGPrepContextId QSSGRenderHelpers::prepareForRender(const QSSGFrameData &frameData, const QSSGRenderExtension &ext, QSSGCameraId cameraId, quint32 slot = 0)

prepareForRender() creates a context for collecting and storing information about the render-data associated with this render extension.

If the same nodes are to be rendered more then once but with different properties, for example a different material or camera, then a new context will be needed. To create several contexts for one extension the slot argument can be used. The default context is created in slot 0.

Returns an id to the prep context.

frameData, ext, cameraId

See also commit().

### `[static]` void QSSGRenderHelpers::prepareRenderables(const QSSGFrameData &frameData, QSSGPrepResultId prepId, QRhiRenderPassDescriptor *renderPassDescriptor, QSSGRhiGraphicsPipelineState &ps, QSSGRenderablesFilters filter = QSSGRenderablesFilter::All)

Prepare the draw call data needed for the renderables before calling renderRenderables.

Returns an id to the preparation result.

frameData, renderPassDescriptor, ps, prepId, filter

See also renderRenderables().

### `[static]` void QSSGRenderHelpers::renderRenderables(const QSSGFrameData &frameData, QSSGPrepResultId prepId)

Render the renderables.

frameData, prepId

See also prepareRenderables().