1 | // Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QT3DRENDER_QSHADERGRAPH_P_H |
5 | #define QT3DRENDER_QSHADERGRAPH_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 <Qt3DRender/private/qt3drender_global_p.h> |
19 | |
20 | #include <Qt3DRender/private/qshadernode_p.h> |
21 | |
22 | QT_BEGIN_NAMESPACE |
23 | |
24 | namespace Qt3DRender |
25 | { |
26 | class QShaderGraph |
27 | { |
28 | public: |
29 | class Edge |
30 | { |
31 | public: |
32 | QStringList layers; |
33 | QUuid sourceNodeUuid; |
34 | QString sourcePortName; |
35 | QUuid targetNodeUuid; |
36 | QString targetPortName; |
37 | }; |
38 | |
39 | class Statement |
40 | { |
41 | public: |
42 | Q_3DRENDERSHARED_PRIVATE_EXPORT QUuid uuid() const noexcept; |
43 | Q_3DRENDERSHARED_PRIVATE_EXPORT int portIndex(QShaderNodePort::Direction direction, const QString &portName) const noexcept; |
44 | |
45 | QShaderNode node; |
46 | QList<int> inputs; |
47 | QList<int> outputs; |
48 | }; |
49 | |
50 | Q_3DRENDERSHARED_PRIVATE_EXPORT void addNode(const QShaderNode &node); |
51 | Q_3DRENDERSHARED_PRIVATE_EXPORT void removeNode(const QShaderNode &node); |
52 | Q_3DRENDERSHARED_PRIVATE_EXPORT QList<QShaderNode> nodes() const noexcept; |
53 | |
54 | Q_3DRENDERSHARED_PRIVATE_EXPORT void addEdge(const Edge &edge); |
55 | Q_3DRENDERSHARED_PRIVATE_EXPORT void removeEdge(const Edge &edge); |
56 | Q_3DRENDERSHARED_PRIVATE_EXPORT QList<Edge> edges() const noexcept; |
57 | |
58 | Q_3DRENDERSHARED_PRIVATE_EXPORT QList<Statement> createStatements(const QStringList &enabledLayers = QStringList()) const; |
59 | |
60 | private: |
61 | QList<QShaderNode> m_nodes; |
62 | QList<Edge> m_edges; |
63 | }; |
64 | |
65 | Q_3DRENDERSHARED_PRIVATE_EXPORT bool operator==(const QShaderGraph::Edge &lhs, const QShaderGraph::Edge &rhs) noexcept; |
66 | |
67 | inline bool operator!=(const QShaderGraph::Edge &lhs, const QShaderGraph::Edge &rhs) noexcept |
68 | { |
69 | return !(lhs == rhs); |
70 | } |
71 | |
72 | Q_3DRENDERSHARED_PRIVATE_EXPORT bool operator==(const QShaderGraph::Statement &lhs, const QShaderGraph::Statement &rhs) noexcept; |
73 | |
74 | inline bool operator!=(const QShaderGraph::Statement &lhs, const QShaderGraph::Statement &rhs) noexcept |
75 | { |
76 | return !(lhs == rhs); |
77 | } |
78 | |
79 | } |
80 | |
81 | Q_DECLARE_TYPEINFO(Qt3DRender::QShaderGraph, Q_RELOCATABLE_TYPE); |
82 | Q_DECLARE_TYPEINFO(Qt3DRender::QShaderGraph::Edge, Q_RELOCATABLE_TYPE); |
83 | Q_DECLARE_TYPEINFO(Qt3DRender::QShaderGraph::Statement, Q_RELOCATABLE_TYPE); |
84 | QT_END_NAMESPACE |
85 | |
86 | Q_DECLARE_METATYPE(Qt3DRender::QShaderGraph) |
87 | Q_DECLARE_METATYPE(Qt3DRender::QShaderGraph::Edge) |
88 | Q_DECLARE_METATYPE(Qt3DRender::QShaderGraph::Statement) |
89 | |
90 | #endif // QT3DRENDER_QSHADERGRAPH_P_H |
91 |