Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qssgrenderhelpers.h
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5
6#ifndef QSSGRENDERHELPERS_H
7#define QSSGRENDERHELPERS_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is part of the QtQuick3D API, with limited compatibility guarantees.
14// Usage of this API may make your code source and binary incompatible with
15// future versions of Qt.
16//
17
18#include <QtQuick3DRuntimeRender/qtquick3druntimerenderglobal.h>
19
20#include <ssg/qssgrenderbasetypes.h>
21
22#include <QtCore/qsize.h>
23
24#include <QtGui/qmatrix4x4.h>
25
27
28class QSSGFrameData;
29class QRhiRenderPassDescriptor;
30class QRhiTexture;
31class QRhiBuffer;
34class QSSGRenderExtension;
35
36#ifdef Q_QDOC
37typedef quint64 QSSGPrepContextId;
38typedef quint64 QSSGPrepResultId;
39typedef quint64 QSSGRenderablesId;
40#else
44#endif
45
52
53Q_DECLARE_FLAGS(QSSGRenderablesFilters, QSSGRenderablesFilter)
54
55class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGModelHelpers
56{
57public:
58 using MaterialList = QList<QSSGResourceId>;
59
60 static void setModelMaterials(const QSSGFrameData &frameData,
61 QSSGRenderablesId renderablesId,
62 QSSGNodeId model,
63 MaterialList materials);
64
65 static void setModelMaterials(const QSSGFrameData &frameData,
66 QSSGRenderablesId renderablesId,
67 MaterialList materials);
68
69 [[nodiscard]] static QMatrix4x4 getGlobalTransform(const QSSGFrameData &frameData,
70 QSSGNodeId model,
71 QSSGPrepContextId prepId = {});
72
73 [[nodiscard]] static QMatrix4x4 getLocalTransform(const QSSGFrameData &frameData,
74 QSSGNodeId model);
75 [[nodiscard]] static float getGlobalOpacity(const QSSGFrameData &frameData,
76 QSSGNodeId model);
77 [[nodiscard]] static float getGlobalOpacity(const QSSGFrameData &frameData,
78 QSSGNodeId model,
79 QSSGPrepContextId prepId);
80 [[nodiscard]] static float getLocalOpacity(const QSSGFrameData &frameData,
81 QSSGNodeId model);
82
83 static void setGlobalTransform(const QSSGFrameData &frameData,
84 QSSGRenderablesId prepId,
85 QSSGNodeId model,
86 const QMatrix4x4 &transform);
87
88 static void setGlobalOpacity(const QSSGFrameData &frameData,
89 QSSGRenderablesId renderablesId,
90 QSSGNodeId model,
91 float opacity);
92private:
93 QSSGModelHelpers();
94};
95
96class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGCameraHelpers
97{
98public:
99 static QMatrix4x4 getViewProjectionMatrix(const QSSGCameraId cameraId,
100 const QMatrix4x4 *globalTransform = nullptr);
101
102private:
103 QSSGCameraHelpers();
104};
105
106class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderHelpers
107{
108public:
109 enum class CreateFlag : quint32
110 {
111 None,
112 Recurse = 0x1,
113 Steal = 0x2
114 };
115
116 Q_DECLARE_FLAGS(CreateFlags, CreateFlag)
117
118 [[nodiscard]] static QSSGRenderablesId createRenderables(const QSSGFrameData &frameData,
119 QSSGPrepContextId prepId,
120 const QSSGNodeIdList &nodes,
121 CreateFlags flags = CreateFlag::None);
122
123 [[nodiscard]] static QSSGPrepContextId prepareForRender(const QSSGFrameData &frameData,
124 const QSSGRenderExtension &ext,
125 QSSGCameraId cameraId,
126 quint32 slot = 0);
127
128 [[nodiscard]] static QSSGPrepResultId commit(const QSSGFrameData &frameData,
129 QSSGPrepContextId prepId,
130 QSSGRenderablesId renderablesId,
131 float lodThreshold = 1.0f);
132
133 static void prepareRenderables(const QSSGFrameData &frameData,
134 QSSGPrepResultId prepId,
135 QRhiRenderPassDescriptor *renderPassDescriptor,
136 QSSGRhiGraphicsPipelineState &ps,
137 QSSGRenderablesFilters filter = QSSGRenderablesFilter::All);
138
139 static void renderRenderables(const QSSGFrameData &frameData,
140 QSSGPrepResultId prepId);
141
142
143private:
144 QSSGRenderHelpers();
145};
146
147class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderExtensionHelpers
148{
149public:
150 enum class ResultOwnership : quint8
151 {
152 Extension,
153 Renderer,
154 };
155
156 static void registerRenderResult(const QSSGFrameData &frameData,
157 QSSGExtensionId extension,
158 QRhiTexture *texture);
159 static void registerRenderResult(const QSSGFrameData &frameData,
160 QSSGExtensionId extension,
161 QRhiTexture *texture,
162 ResultOwnership ownership);
163 static void registerRenderResultBuffer(const QSSGFrameData &frameData,
164 QSSGExtensionId extension,
165 QRhiBuffer *buffer);
166 static void registerRenderResultBuffer(const QSSGFrameData &frameData,
167 QSSGExtensionId extension,
168 QRhiBuffer *buffer,
169 ResultOwnership ownership);
170
171private:
172 QSSGRenderExtensionHelpers();
173};
174
175QT_END_NAMESPACE
176
177#endif // QSSGRENDERHELPERS_H
\inmodule QtQuick3D
\inmodule QtQuick3D
\inmodule QtQuick3D
friend class QSSGRenderContextInterface
Combined button and popup list for selecting options.
QSSGRenderablesFilter
QSSGPrepResultId
QSSGRenderablesId
QSSGPrepContextId