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
26QT_BEGIN_NAMESPACE
27
28namespace Qt3DRender {
29
30class QTechnique;
31class QParameter;
32class QGraphicsApiFilter;
33class QFilterKey;
34class QRenderPass;
35
36namespace Render {
37
38class TechniqueManager;
39
40class Q_3DRENDERSHARED_PRIVATE_EXPORT Technique : public BackendNode
41{
42public:
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
69private:
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
79class TechniqueFunctor : public Qt3DCore::QBackendNodeMapper
80{
81public:
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;
86private:
87 NodeManagers *m_manager;
88 AbstractRenderer *m_renderer;
89};
90
91} // namespace Render
92} // namespace Qt3DRender
93
94QT_END_NAMESPACE
95
96#endif // QT3DRENDER_RENDER_TECHNIQUE_H
97

source code of qt3d/src/render/materialsystem/technique_p.h