1 | // Copyright (C) 2015 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_QTORUSGEOMETRY_H |
5 | #define QT3DEXTRAS_QTORUSGEOMETRY_H |
6 | |
7 | #include <Qt3DExtras/qt3dextras_global.h> |
8 | #include <Qt3DCore/qgeometry.h> |
9 | |
10 | QT_BEGIN_NAMESPACE |
11 | |
12 | namespace Qt3DCore { |
13 | |
14 | class QAttribute; |
15 | |
16 | } // Qt3DCore |
17 | |
18 | namespace Qt3DExtras { |
19 | |
20 | class QTorusGeometryPrivate; |
21 | |
22 | class Q_3DEXTRASSHARED_EXPORT QTorusGeometry : public Qt3DCore::QGeometry |
23 | { |
24 | Q_OBJECT |
25 | Q_PROPERTY(int rings READ rings WRITE setRings NOTIFY ringsChanged) |
26 | Q_PROPERTY(int slices READ slices WRITE setSlices NOTIFY slicesChanged) |
27 | Q_PROPERTY(float radius READ radius WRITE setRadius NOTIFY radiusChanged) |
28 | Q_PROPERTY(float minorRadius READ minorRadius WRITE setMinorRadius NOTIFY minorRadiusChanged) |
29 | Q_PROPERTY(Qt3DCore::QAttribute *positionAttribute READ positionAttribute CONSTANT) |
30 | Q_PROPERTY(Qt3DCore::QAttribute *normalAttribute READ normalAttribute CONSTANT) |
31 | Q_PROPERTY(Qt3DCore::QAttribute *texCoordAttribute READ texCoordAttribute CONSTANT) |
32 | Q_PROPERTY(Qt3DCore::QAttribute *indexAttribute READ indexAttribute CONSTANT) |
33 | |
34 | public: |
35 | explicit QTorusGeometry(QNode *parent = nullptr); |
36 | ~QTorusGeometry(); |
37 | |
38 | void updateVertices(); |
39 | void updateIndices(); |
40 | |
41 | int rings() const; |
42 | int slices() const; |
43 | float radius() const; |
44 | float minorRadius() const; |
45 | |
46 | Qt3DCore::QAttribute *positionAttribute() const; |
47 | Qt3DCore::QAttribute *normalAttribute() const; |
48 | Qt3DCore::QAttribute *texCoordAttribute() const; |
49 | Qt3DCore::QAttribute *indexAttribute() const; |
50 | |
51 | public Q_SLOTS: |
52 | void setRings(int rings); |
53 | void setSlices(int slices); |
54 | void setRadius(float radius); |
55 | void setMinorRadius(float minorRadius); |
56 | |
57 | Q_SIGNALS: |
58 | void radiusChanged(float radius); |
59 | void ringsChanged(int rings); |
60 | void slicesChanged(int slices); |
61 | void minorRadiusChanged(float minorRadius); |
62 | |
63 | |
64 | protected: |
65 | QTorusGeometry(QTorusGeometryPrivate &dd, QNode *parent = nullptr); |
66 | |
67 | private: |
68 | Q_DECLARE_PRIVATE(QTorusGeometry) |
69 | }; |
70 | |
71 | } // Qt3DExtras |
72 | |
73 | QT_END_NAMESPACE |
74 | |
75 | #endif // QT3DEXTRAS_QTORUSGEOMETRY_H |
76 |
Definitions
Learn Advanced QML with KDAB
Find out more