1// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
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 QT3DEXTRAS_QSPHEREMESH_H
5#define QT3DEXTRAS_QSPHEREMESH_H
6
7#include <Qt3DExtras/qt3dextras_global.h>
8#include <Qt3DRender/qgeometryrenderer.h>
9
10QT_BEGIN_NAMESPACE
11
12namespace Qt3DExtras {
13
14class QSphereMeshPrivate;
15
16class Q_3DEXTRASSHARED_EXPORT QSphereMesh : public Qt3DRender::QGeometryRenderer
17{
18 Q_OBJECT
19 Q_PROPERTY(int rings READ rings WRITE setRings NOTIFY ringsChanged)
20 Q_PROPERTY(int slices READ slices WRITE setSlices NOTIFY slicesChanged)
21 Q_PROPERTY(float radius READ radius WRITE setRadius NOTIFY radiusChanged)
22 Q_PROPERTY(bool generateTangents READ generateTangents WRITE setGenerateTangents NOTIFY generateTangentsChanged)
23
24public:
25 explicit QSphereMesh(Qt3DCore::QNode *parent = nullptr);
26 ~QSphereMesh();
27
28 int rings() const;
29 int slices() const;
30 float radius() const;
31 bool generateTangents() const;
32
33public Q_SLOTS:
34 void setRings(int rings);
35 void setSlices(int slices);
36 void setRadius(float radius);
37 void setGenerateTangents(bool gen);
38
39Q_SIGNALS:
40 void radiusChanged(float radius);
41 void ringsChanged(int rings);
42 void slicesChanged(int slices);
43 void generateTangentsChanged(bool generateTangents);
44
45private:
46 // As this is a default provided geometry renderer, no one should be able
47 // to modify the QGeometryRenderer's properties
48
49 void setVertexCount(int vertexCount);
50 void setIndexOffset(int indexOffset);
51 void setFirstInstance(int firstInstance);
52 void setRestartIndexValue(int index);
53 void setPrimitiveRestartEnabled(bool enabled);
54 void setGeometry(Qt3DCore::QGeometry *geometry);
55 void setPrimitiveType(PrimitiveType primitiveType);
56};
57
58} // namespace Qt3DExtras
59
60QT_END_NAMESPACE
61
62#endif // QT3DEXTRAS_QSPHEREMESH_H
63

source code of qt3d/src/extras/geometries/qspheremesh.h