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
4#ifndef QSSGRENDERHELPERS_H
5#define QSSGRENDERHELPERS_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is part of the QtQuick3D API, with limited compatibility guarantees.
12// Usage of this API may make your code source and binary incompatible with
13// future versions of Qt.
14//
15
16#include <QtQuick3DRuntimeRender/qtquick3druntimerenderglobal.h>
17
18#include <ssg/qssgrenderbasetypes.h>
19
20#include <QtCore/qsize.h>
21
22#include <QtGui/qmatrix4x4.h>
23
25
26class QSSGFrameData;
27class QRhiRenderPassDescriptor;
28class QRhiTexture;
31class QSSGRenderExtension;
32
33#ifdef Q_QDOC
34typedef quint64 QSSGPrepContextId;
35typedef quint64 QSSGPrepResultId;
36typedef quint64 QSSGRenderablesId;
37#else
41#endif
42
49
50Q_DECLARE_FLAGS(QSSGRenderablesFilters, QSSGRenderablesFilter)
51
52class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGModelHelpers
53{
54public:
55 using MaterialList = QList<QSSGResourceId>;
56
57 static void setModelMaterials(const QSSGFrameData &frameData,
58 QSSGRenderablesId renderablesId,
59 QSSGNodeId model,
60 MaterialList materials);
61
62 static void setModelMaterials(const QSSGFrameData &frameData,
63 QSSGRenderablesId renderablesId,
64 MaterialList materials);
65
66 [[nodiscard]] static QMatrix4x4 getGlobalTransform(const QSSGFrameData &frameData,
67 QSSGNodeId model,
68 QSSGPrepContextId prepId = {});
69
70 [[nodiscard]] static QMatrix4x4 getLocalTransform(const QSSGFrameData &frameData,
71 QSSGNodeId model);
72 [[nodiscard]] static float getGlobalOpacity(const QSSGFrameData &frameData,
73 QSSGNodeId model);
74 [[nodiscard]] static float getGlobalOpacity(const QSSGFrameData &frameData,
75 QSSGNodeId model,
76 QSSGPrepContextId prepId);
77 [[nodiscard]] static float getLocalOpacity(const QSSGFrameData &frameData,
78 QSSGNodeId model);
79
80 static void setGlobalTransform(const QSSGFrameData &frameData,
81 QSSGRenderablesId prepId,
82 QSSGNodeId model,
83 const QMatrix4x4 &transform);
84
85 static void setGlobalOpacity(const QSSGFrameData &frameData,
86 QSSGRenderablesId renderablesId,
87 QSSGNodeId model,
88 float opacity);
89private:
90 QSSGModelHelpers();
91};
92
93class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGCameraHelpers
94{
95public:
96 static QMatrix4x4 getViewProjectionMatrix(const QSSGCameraId cameraId,
97 const QMatrix4x4 *globalTransform = nullptr);
98
99private:
100 QSSGCameraHelpers();
101};
102
103class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderHelpers
104{
105public:
106 enum class CreateFlag : quint32
107 {
108 None,
109 Recurse = 0x1,
110 Steal = 0x2
111 };
112
113 Q_DECLARE_FLAGS(CreateFlags, CreateFlag)
114
115 [[nodiscard]] static QSSGRenderablesId createRenderables(const QSSGFrameData &frameData,
116 QSSGPrepContextId prepId,
117 const QSSGNodeIdList &nodes,
118 CreateFlags flags = CreateFlag::None);
119
120 [[nodiscard]] static QSSGPrepContextId prepareForRender(const QSSGFrameData &frameData,
121 const QSSGRenderExtension &ext,
122 QSSGCameraId cameraId,
123 quint32 slot = 0);
124
125 [[nodiscard]] static QSSGPrepResultId commit(const QSSGFrameData &frameData,
126 QSSGPrepContextId prepId,
127 QSSGRenderablesId renderablesId,
128 float lodThreshold = 1.0f);
129
130 static void prepareRenderables(const QSSGFrameData &frameData,
131 QSSGPrepResultId prepId,
132 QRhiRenderPassDescriptor *renderPassDescriptor,
133 QSSGRhiGraphicsPipelineState &ps,
134 QSSGRenderablesFilters filter = QSSGRenderablesFilter::All);
135
136 static void renderRenderables(const QSSGFrameData &frameData,
137 QSSGPrepResultId prepId);
138
139
140private:
141 QSSGRenderHelpers();
142};
143
144class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderExtensionHelpers
145{
146public:
147 static void registerRenderResult(const QSSGFrameData &frameData,
148 QSSGExtensionId extension,
149 QRhiTexture *texture);
150
151private:
152 QSSGRenderExtensionHelpers();
153};
154
155QT_END_NAMESPACE
156
157#endif // QSSGRENDERHELPERS_H
\inmodule QtQuick3D
\inmodule QtQuick3D
\inmodule QtQuick3D
friend class QSSGRenderContextInterface
QSSGRenderablesFilter
QSSGPrepResultId
QSSGRenderablesId
QSSGPrepContextId