1 | // Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). |
2 | // Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies). |
3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
4 | |
5 | #ifndef QT3DRENDER_RENDER_TECHNIQUE_H |
6 | #define QT3DRENDER_RENDER_TECHNIQUE_H |
7 | |
8 | // |
9 | // W A R N I N G |
10 | // ------------- |
11 | // |
12 | // This file is not part of the Qt API. It exists for the convenience |
13 | // of other Qt classes. This header file may change from version to |
14 | // version without notice, or even be removed. |
15 | // |
16 | // We mean it. |
17 | // |
18 | |
19 | #include <Qt3DRender/private/backendnode_p.h> |
20 | #include <Qt3DRender/private/parameterpack_p.h> |
21 | #include <Qt3DRender/private/qgraphicsapifilter_p.h> |
22 | #include <Qt3DRender/qfilterkey.h> |
23 | #include <QList> |
24 | #include <QStringList> |
25 | |
26 | QT_BEGIN_NAMESPACE |
27 | |
28 | namespace Qt3DRender { |
29 | |
30 | class QTechnique; |
31 | class QParameter; |
32 | class QGraphicsApiFilter; |
33 | class QFilterKey; |
34 | class QRenderPass; |
35 | |
36 | namespace Render { |
37 | |
38 | class TechniqueManager; |
39 | |
40 | class Q_3DRENDERSHARED_PRIVATE_EXPORT Technique : public BackendNode |
41 | { |
42 | public: |
43 | Technique(); |
44 | ~Technique(); |
45 | void cleanup(); |
46 | |
47 | void syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime) override; |
48 | |
49 | QList<Qt3DCore::QNodeId> parameters() const; |
50 | |
51 | void appendRenderPass(Qt3DCore::QNodeId renderPassId); |
52 | void removeRenderPass(Qt3DCore::QNodeId renderPassId); |
53 | |
54 | void appendFilterKey(Qt3DCore::QNodeId criterionId); |
55 | void removeFilterKey(Qt3DCore::QNodeId criterionId); |
56 | |
57 | QList<Qt3DCore::QNodeId> filterKeys() const; |
58 | QList<Qt3DCore::QNodeId> renderPasses() const; |
59 | const GraphicsApiFilterData *graphicsApiFilter() const; |
60 | |
61 | bool isCompatibleWithRenderer() const; |
62 | void setCompatibleWithRenderer(bool compatible); |
63 | |
64 | bool isCompatibleWithFilters(const Qt3DCore::QNodeIdVector &filterKeyIds); |
65 | |
66 | void setNodeManager(NodeManagers *nodeManager); |
67 | NodeManagers *nodeManager() const; |
68 | |
69 | private: |
70 | |
71 | GraphicsApiFilterData m_graphicsApiFilterData; |
72 | ParameterPack m_parameterPack; |
73 | QList<Qt3DCore::QNodeId> m_filterKeyList; |
74 | QList<Qt3DCore::QNodeId> m_renderPasses; |
75 | bool m_isCompatibleWithRenderer; |
76 | NodeManagers *m_nodeManager; |
77 | }; |
78 | |
79 | class TechniqueFunctor : public Qt3DCore::QBackendNodeMapper |
80 | { |
81 | public: |
82 | explicit TechniqueFunctor(AbstractRenderer *renderer, NodeManagers *manager); |
83 | Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const override; |
84 | Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const override; |
85 | void destroy(Qt3DCore::QNodeId id) const override; |
86 | private: |
87 | NodeManagers *m_manager; |
88 | AbstractRenderer *m_renderer; |
89 | }; |
90 | |
91 | } // namespace Render |
92 | } // namespace Qt3DRender |
93 | |
94 | QT_END_NAMESPACE |
95 | |
96 | #endif // QT3DRENDER_RENDER_TECHNIQUE_H |
97 | |