1 | // Copyright (C) 2023 The Qt Company Ltd. |
---|---|
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 QQUICKSHAPESTROKENODE_P_P_H |
5 | #define QQUICKSHAPESTROKENODE_P_P_H |
6 | |
7 | #include <QtQuick/qsgmaterial.h> |
8 | |
9 | // |
10 | // W A R N I N G |
11 | // ------------- |
12 | // |
13 | // This file is not part of the Qt API. It exists for the convenience |
14 | // of a number of Qt sources files. This header file may change from |
15 | // version to version without notice, or even be removed. |
16 | // |
17 | // We mean it. |
18 | // |
19 | |
20 | QT_BEGIN_NAMESPACE |
21 | |
22 | class QQuickShapeStrokeNode; |
23 | class QQuickShapeStrokeMaterial; |
24 | |
25 | class QQuickShapeStrokeMaterialShader : public QSGMaterialShader |
26 | { |
27 | public: |
28 | QQuickShapeStrokeMaterialShader() |
29 | { |
30 | setShaderFileName(stage: VertexStage, |
31 | QStringLiteral(":/qt-project.org/shapes/shaders_ng/shapestroke.vert.qsb")); |
32 | setShaderFileName(stage: FragmentStage, |
33 | QStringLiteral(":/qt-project.org/shapes/shaders_ng/shapestroke.frag.qsb")); |
34 | } |
35 | |
36 | bool updateUniformData(RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override; |
37 | }; |
38 | |
39 | |
40 | class QQuickShapeStrokeMaterial : public QSGMaterial |
41 | { |
42 | public: |
43 | QQuickShapeStrokeMaterial(QQuickShapeStrokeNode *node) |
44 | : m_node(node) |
45 | { |
46 | setFlag(flags: Blending, on: true); |
47 | } |
48 | |
49 | int compare(const QSGMaterial *other) const override; |
50 | |
51 | QQuickShapeStrokeNode *node() const |
52 | { |
53 | return m_node; |
54 | } |
55 | |
56 | protected: |
57 | QSGMaterialType *type() const override |
58 | { |
59 | static QSGMaterialType t; |
60 | return &t; |
61 | } |
62 | QSGMaterialShader *createShader(QSGRendererInterface::RenderMode) const override |
63 | { |
64 | return new QQuickShapeStrokeMaterialShader; |
65 | } |
66 | |
67 | QQuickShapeStrokeNode *m_node; |
68 | }; |
69 | |
70 | QT_END_NAMESPACE |
71 | |
72 | #endif // QQUICKSHAPESTROKENODE_P_P_H |
73 |