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