1 | // Copyright (C) 2023 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause |
3 | |
4 | #ifndef QSSGRENDERHELPERS_P_H |
5 | #define QSSGRENDERHELPERS_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/qssgrhicontext_p.h> |
20 | |
21 | #include <QtCore/qsize.h> |
22 | |
23 | #include <QtGui/qmatrix4x4.h> |
24 | |
25 | QT_BEGIN_NAMESPACE |
26 | |
27 | class QSSGRhiContext; |
28 | class QSSGFrameData; |
29 | struct QSSGRenderableObject; |
30 | class QRhiRenderPassDescriptor; |
31 | struct QSSGRhiGraphicsPipelineState; |
32 | struct QSSGRenderCamera; |
33 | struct QSSGRenderableNodeEntry; |
34 | |
35 | class QSSGRenderContextInterface; |
36 | struct QSSGModelContext; |
37 | |
38 | |
39 | using QSSGRenderableNodes = QVector<QSSGRenderableNodeEntry>; |
40 | |
41 | class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGModelHelpers |
42 | { |
43 | public: |
44 | using RenderableFilter = std::function<bool(QSSGModelContext *)>; |
45 | |
46 | static void ensureMeshes(const QSSGRenderContextInterface &contextInterface, |
47 | QSSGRenderableNodes &renderableModels); |
48 | |
49 | static bool createRenderables(QSSGRenderContextInterface &contextInterface, |
50 | const QSSGRenderableNodes &renderableModels, |
51 | const QSSGRenderCamera &camera, |
52 | RenderableFilter filter, |
53 | float lodThreshold = 0.0f); |
54 | |
55 | |
56 | |
57 | private: |
58 | QSSGModelHelpers(); |
59 | }; |
60 | |
61 | class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderHelpers |
62 | { |
63 | public: |
64 | static void rhiPrepareRenderable(QSSGRhiContext &rhiCtx, |
65 | QSSGPassKey passKey, |
66 | const QSSGFrameData &frameData, |
67 | QSSGRenderableObject &inObject, |
68 | QRhiRenderPassDescriptor *renderPassDescriptor, |
69 | QSSGRhiGraphicsPipelineState *ps, |
70 | int samples); |
71 | |
72 | static void rhiRenderRenderable(QSSGRhiContext &rhiCtx, |
73 | const QSSGRhiGraphicsPipelineState &state, |
74 | QSSGRenderableObject &object, |
75 | bool *needsSetViewport); |
76 | |
77 | |
78 | private: |
79 | QSSGRenderHelpers(); |
80 | }; |
81 | |
82 | QT_END_NAMESPACE |
83 | |
84 | #endif // QSSGRENDERHELPERS_P_H |
85 | |