blob: b6dc2e3417d7c3ec7da1dc1962906f35a1b327d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
//
// W A R N I N G
// -------------
//
// This file is not part of the QtGraphs API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
#ifndef SCATTERINSTANCING_H
#define SCATTERINSTANCING_H
#include <QtGraphs/qgraphsglobal.h>
#include <private/qquick3dinstancing_p.h>
struct DataItemHolder
{
QVector3D position;
QQuaternion rotation;
QVector3D scale;
bool hide = false;
};
class Q_GRAPHS_EXPORT ScatterInstancing : public QQuick3DInstancing
{
Q_OBJECT
public:
ScatterInstancing();
const QList<DataItemHolder> &dataArray() const;
void setDataArray(const QList<DataItemHolder> &newDataArray);
void hideDataItem(qsizetype index);
void unhidePreviousDataItem();
void resetVisibilty();
const QList<float> &customData() const;
void setCustomData(const QList<float> &newCustomData);
void markDataDirty();
bool rangeGradient() const;
void setRangeGradient(bool newRangeGradient);
void setTransparency(bool transparency);
bool isDirty() const { return m_dirty; }
// QQuick3DInstancing interface
protected:
QByteArray getInstanceBuffer(int *instanceCount) override;
private:
QByteArray m_instanceData;
QList<DataItemHolder> m_dataArray;
QList<float> m_customData;
int m_instanceCount = 0;
bool m_dirty = true;
bool m_rangeGradient = false;
qsizetype m_previousHideIndex = -1;
};
#endif // SCATTERINSTANCING_H
|