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

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