1 | // Copyright (C) 2023 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef QSSGRENDEREXTENSIIONS_P_H |
5 | #define QSSGRENDEREXTENSIIONS_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <QtQuick3DRuntimeRender/private/qtquick3druntimerenderglobal_p.h> |
19 | #include <QtQuick3DRuntimeRender/private/qssgrenderableobjects_p.h> |
20 | #include <QtCore/qobject.h> |
21 | |
22 | QT_BEGIN_NAMESPACE |
23 | |
24 | class QSSGRenderer; |
25 | class QSSGLayerRenderData; |
26 | |
27 | // NOTE: We might want to move this to the base types header |
28 | using QSSGNodeId = quintptr; |
29 | using QSSGResourceId = quintptr; |
30 | |
31 | struct QSSGRhiRenderableTexture; |
32 | |
33 | struct QSSGRenderNode; |
34 | struct QSSGRenderMesh; |
35 | |
36 | class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGFrameData |
37 | { |
38 | public: |
39 | enum class RenderResult : quint32 |
40 | { |
41 | AoTexture, |
42 | DepthTexture, |
43 | ScreenTexture |
44 | }; |
45 | |
46 | using RenderResultT = std::underlying_type_t<RenderResult>; |
47 | |
48 | const QSSGRhiRenderableTexture *getRenderResult(RenderResult id) const; |
49 | |
50 | [[nodiscard]] QSSGRhiGraphicsPipelineState getPipelineState() const; |
51 | |
52 | [[nodiscard]] QSSGRenderableNodeEntry getNode(QSSGNodeId id) const; |
53 | [[nodiscard]] QSSGRenderableNodeEntry takeNode(QSSGNodeId id); |
54 | |
55 | [[nodiscard]] QSSGRenderGraphObject *getResource(QSSGResourceId id) const; |
56 | |
57 | [[nodiscard]] QSSGRenderCamera *camera() const; |
58 | |
59 | [[nodiscard]] QSSGRenderer *renderer() const { return m_renderer; } |
60 | |
61 | private: |
62 | friend class QSSGLayerRenderData; |
63 | friend class QSSGRenderHelpers; |
64 | |
65 | void clear(); |
66 | |
67 | [[nodiscard]] QSSGLayerRenderData *getCurrent() const; |
68 | |
69 | QSSGFrameData() = default; |
70 | explicit QSSGFrameData(QSSGRenderer *renderer); |
71 | QSSGRenderer *m_renderer = nullptr; |
72 | }; |
73 | |
74 | class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderExtension : public QSSGRenderGraphObject |
75 | { |
76 | public: |
77 | enum class Type |
78 | { |
79 | Standalone, |
80 | Main |
81 | }; |
82 | |
83 | enum class RenderMode |
84 | { |
85 | Underlay, |
86 | Overlay |
87 | }; |
88 | |
89 | QSSGRenderExtension(); |
90 | virtual ~QSSGRenderExtension(); |
91 | |
92 | virtual bool prepareData(QSSGFrameData &data) = 0; |
93 | virtual void prepareRender(const QSSGRenderer &renderer, QSSGFrameData &data) = 0; |
94 | virtual void render(const QSSGRenderer &renderer) = 0; |
95 | |
96 | virtual void release() = 0; |
97 | |
98 | virtual Type type() const = 0; |
99 | virtual RenderMode mode() const = 0; |
100 | }; |
101 | |
102 | QT_END_NAMESPACE |
103 | |
104 | #endif // QSSGRENDEREXTENSIIONS_P_H |
105 |