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;
33class QSSGRenderExtension;
34
35#ifdef Q_QDOC
36typedef quint64 QSSGPrepContextId;
37typedef quint64 QSSGPrepResultId;
38typedef quint64 QSSGRenderablesId;
39#else
43#endif
44
51
52Q_DECLARE_FLAGS(QSSGRenderablesFilters, QSSGRenderablesFilter)
53
54class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGModelHelpers
55{
56public:
57 using MaterialList = QList<QSSGResourceId>;
58
59 static void setModelMaterials(const QSSGFrameData &frameData,
60 QSSGRenderablesId renderablesId,
61 QSSGNodeId model,
62 MaterialList materials);
63
64 static void setModelMaterials(const QSSGFrameData &frameData,
65 QSSGRenderablesId renderablesId,
66 MaterialList materials);
67
68 [[nodiscard]] static QMatrix4x4 getGlobalTransform(const QSSGFrameData &frameData,
69 QSSGNodeId model,
70 QSSGPrepContextId prepId = {});
71
72 [[nodiscard]] static QMatrix4x4 getLocalTransform(const QSSGFrameData &frameData,
73 QSSGNodeId model);
74 [[nodiscard]] static float getGlobalOpacity(const QSSGFrameData &frameData,
75 QSSGNodeId model);
76 [[nodiscard]] static float getGlobalOpacity(const QSSGFrameData &frameData,
77 QSSGNodeId model,
78 QSSGPrepContextId prepId);
79 [[nodiscard]] static float getLocalOpacity(const QSSGFrameData &frameData,
80 QSSGNodeId model);
81
82 static void setGlobalTransform(const QSSGFrameData &frameData,
83 QSSGRenderablesId prepId,
84 QSSGNodeId model,
85 const QMatrix4x4 &transform);
86
87 static void setGlobalOpacity(const QSSGFrameData &frameData,
88 QSSGRenderablesId renderablesId,
89 QSSGNodeId model,
90 float opacity);
91private:
92 QSSGModelHelpers();
93};
94
95class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGCameraHelpers
96{
97public:
98 static QMatrix4x4 getViewProjectionMatrix(const QSSGCameraId cameraId,
99 const QMatrix4x4 *globalTransform = nullptr);
100
101private:
102 QSSGCameraHelpers();
103};
104
105class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderHelpers
106{
107public:
108 enum class CreateFlag : quint32
109 {
110 None,
111 Recurse = 0x1,
112 Steal = 0x2
113 };
114
115 Q_DECLARE_FLAGS(CreateFlags, CreateFlag)
116
117 [[nodiscard]] static QSSGRenderablesId createRenderables(const QSSGFrameData &frameData,
118 QSSGPrepContextId prepId,
119 const QSSGNodeIdList &nodes,
120 CreateFlags flags = CreateFlag::None);
121
122 [[nodiscard]] static QSSGPrepContextId prepareForRender(const QSSGFrameData &frameData,
123 const QSSGRenderExtension &ext,
124 QSSGCameraId cameraId,
125 quint32 slot = 0);
126
127 [[nodiscard]] static QSSGPrepResultId commit(const QSSGFrameData &frameData,
128 QSSGPrepContextId prepId,
129 QSSGRenderablesId renderablesId,
130 float lodThreshold = 1.0f);
131
132 static void prepareRenderables(const QSSGFrameData &frameData,
133 QSSGPrepResultId prepId,
134 QRhiRenderPassDescriptor *renderPassDescriptor,
135 QSSGRhiGraphicsPipelineState &ps,
136 QSSGRenderablesFilters filter = QSSGRenderablesFilter::All);
137
138 static void renderRenderables(const QSSGFrameData &frameData,
139 QSSGPrepResultId prepId);
140
141
142private:
143 QSSGRenderHelpers();
144};
145
146class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderExtensionHelpers
147{
148public:
149 static void registerRenderResult(const QSSGFrameData &frameData,
150 QSSGExtensionId extension,
151 QRhiTexture *texture);
152
153private:
154 QSSGRenderExtensionHelpers();
155};
156
157QT_END_NAMESPACE
158
159#endif // QSSGRENDERHELPERS_H
\inmodule QtQuick3D
\inmodule QtQuick3D
\inmodule QtQuick3D
friend class QSSGRenderContextInterface
Combined button and popup list for selecting options.
QSSGRenderablesFilter
QSSGPrepResultId
QSSGRenderablesId
QSSGPrepContextId