File indexing completed on 2024-05-12 07:52:10

0001 /*
0002  * This file is part of KQuickCharts
0003  * SPDX-FileCopyrightText: 2019 Arjen Hiemstra <ahiemstra@heimr.nl>
0004  *
0005  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0006  */
0007 
0008 #ifndef LINECHARTMATERIAL_H
0009 #define LINECHARTMATERIAL_H
0010 
0011 #include <QColor>
0012 #include <QSGMaterial>
0013 #include <QSGMaterialShader>
0014 
0015 #include "SDFShader.h"
0016 
0017 class LineChartMaterial : public QSGMaterial
0018 {
0019 public:
0020     LineChartMaterial();
0021     ~LineChartMaterial();
0022 
0023     QSGMaterialType *type() const override;
0024     QSGMaterialShader *createShader(QSGRendererInterface::RenderMode) const override;
0025     int compare(const QSGMaterial *other) const override;
0026 
0027     float aspect = 1.0;
0028     float lineWidth = 0.0;
0029     float smoothing = 0.1;
0030 };
0031 
0032 class LineChartShader : public SDFShader
0033 {
0034 public:
0035     LineChartShader();
0036     ~LineChartShader();
0037 
0038     bool updateUniformData(QSGMaterialShader::RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
0039 };
0040 
0041 #endif // LINECHARTMATERIAL_H