1// Copyright (C) 2016 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_QCONEGEOMETRY_H
5#define QT3DEXTRAS_QCONEGEOMETRY_H
6
7#include <Qt3DExtras/qt3dextras_global.h>
8#include <Qt3DCore/qgeometry.h>
9
10QT_BEGIN_NAMESPACE
11
12namespace Qt3DCore {
13class QAttribute;
14} // Render
15
16namespace Qt3DExtras {
17
18class QConeGeometryPrivate;
19
20class Q_3DEXTRASSHARED_EXPORT QConeGeometry : public Qt3DCore::QGeometry
21{
22 Q_OBJECT
23 Q_PROPERTY( bool hasTopEndcap READ hasTopEndcap WRITE setHasTopEndcap NOTIFY hasTopEndcapChanged )
24 Q_PROPERTY( bool hasBottomEndcap READ hasBottomEndcap WRITE setHasBottomEndcap NOTIFY hasBottomEndcapChanged )
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 topRadius READ topRadius WRITE setTopRadius NOTIFY topRadiusChanged )
28 Q_PROPERTY( float bottomRadius READ bottomRadius WRITE setBottomRadius NOTIFY bottomRadiusChanged )
29 Q_PROPERTY(float length READ length WRITE setLength NOTIFY lengthChanged)
30 Q_PROPERTY(Qt3DCore::QAttribute *positionAttribute READ positionAttribute CONSTANT)
31 Q_PROPERTY(Qt3DCore::QAttribute *normalAttribute READ normalAttribute CONSTANT)
32 Q_PROPERTY(Qt3DCore::QAttribute *texCoordAttribute READ texCoordAttribute CONSTANT)
33 Q_PROPERTY(Qt3DCore::QAttribute *indexAttribute READ indexAttribute CONSTANT)
34
35public:
36 explicit QConeGeometry(QNode *parent = nullptr);
37 ~QConeGeometry();
38
39 void updateVertices();
40 void updateIndices();
41
42 bool hasTopEndcap() const;
43 bool hasBottomEndcap() const;
44 float topRadius() const;
45 float bottomRadius() const;
46 int rings() const;
47 int slices() const;
48 float length() const;
49
50 Qt3DCore::QAttribute *positionAttribute() const;
51 Qt3DCore::QAttribute *normalAttribute() const;
52 Qt3DCore::QAttribute *texCoordAttribute() const;
53 Qt3DCore::QAttribute *indexAttribute() const;
54
55public Q_SLOTS:
56 void setHasTopEndcap( bool hasTopEndcap );
57 void setHasBottomEndcap( bool hasBottomEndcap );
58 void setTopRadius( float topRadius );
59 void setBottomRadius( float bottomRadius );
60 void setRings( int rings );
61 void setSlices( int slices );
62 void setLength( float length );
63
64Q_SIGNALS:
65 void hasTopEndcapChanged( bool hasTopEndcap );
66 void hasBottomEndcapChanged( bool hasBottomEndcap );
67 void topRadiusChanged( float topRadius );
68 void bottomRadiusChanged( float bottomRadius );
69 void ringsChanged( int rings );
70 void slicesChanged( int slices );
71 void lengthChanged( float length );
72
73protected:
74 QConeGeometry(QConeGeometryPrivate &dd, QNode *parent = nullptr);
75
76private:
77 Q_DECLARE_PRIVATE(QConeGeometry)
78};
79
80} // namespace Qt3DExtras
81
82QT_END_NAMESPACE
83
84#endif // QT3DEXTRAS_QCONEGEOMETRY_H
85

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