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

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