| 1 | /* |
| 2 | * This file is part of KQuickCharts |
| 3 | * SPDX-FileCopyrightText: 2019 Arjen Hiemstra <ahiemstra@heimr.nl> |
| 4 | * |
| 5 | * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
| 6 | */ |
| 7 | |
| 8 | #ifndef LINECHARTMATERIAL_H |
| 9 | #define LINECHARTMATERIAL_H |
| 10 | |
| 11 | #include <QColor> |
| 12 | #include <QSGMaterial> |
| 13 | #include <QSGMaterialShader> |
| 14 | |
| 15 | #include "SDFShader.h" |
| 16 | |
| 17 | class LineChartMaterial : public QSGMaterial |
| 18 | { |
| 19 | public: |
| 20 | LineChartMaterial(); |
| 21 | ~LineChartMaterial(); |
| 22 | |
| 23 | QSGMaterialType *type() const override; |
| 24 | QSGMaterialShader *createShader(QSGRendererInterface::RenderMode) const override; |
| 25 | int compare(const QSGMaterial *other) const override; |
| 26 | |
| 27 | float aspect = 1.0; |
| 28 | float lineWidth = 0.0; |
| 29 | float smoothing = 0.1; |
| 30 | }; |
| 31 | |
| 32 | class LineChartShader : public SDFShader |
| 33 | { |
| 34 | public: |
| 35 | LineChartShader(); |
| 36 | ~LineChartShader(); |
| 37 | |
| 38 | bool updateUniformData(QSGMaterialShader::RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override; |
| 39 | }; |
| 40 | |
| 41 | #endif // LINECHARTMATERIAL_H |
| 42 | |