1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4//
5// W A R N I N G
6// -------------
7//
8// This file is not part of the QtGraphs API. It exists purely as an
9// implementation detail. This header file may change from version to
10// version without notice, or even be removed.
11//
12// We mean it.
13
14#ifndef SURFACESELECTIONINSTANCING_H
15#define SURFACESELECTIONINSTANCING_H
16
17#include <QtQuick3D/private/qquick3dinstancing_p.h>
18
19QT_BEGIN_NAMESPACE
20
21class SurfaceSelectionInstancing : public QQuick3DInstancing
22{
23 Q_OBJECT
24
25public:
26 SurfaceSelectionInstancing();
27 ~SurfaceSelectionInstancing();
28
29 void setRotation(const QVector3D &rotation) { m_rotation = rotation; }
30 void setScale(const QVector3D &scale) { m_scale = scale; }
31 void addPosition(const QVector3D &position);
32 void resetPositions();
33 void setColor(const QColor &color) { m_color = color; }
34
35protected:
36 QByteArray getInstanceBuffer(int *instanceCount) override;
37
38private:
39 QByteArray m_instanceData;
40 int m_instanceCount = 0;
41 QVector3D m_rotation = {.0f, .0f, .0f};
42 QVector3D m_scale = {.0f, .0f, .0f};
43 QList<QVector3D> m_positions;
44 QColor m_color = {0, 0, 0};
45 bool m_dirty = true;
46};
47
48QT_END_NAMESPACE
49
50#endif // SURFACESELECTIONINSTANCING_H
51

source code of qtgraphs/src/graphs/engine/surfaceselectioninstancing_p.h