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_QCONEMESH_H
5#define QT3DEXTRAS_QCONEMESH_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 QConeMesh : 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( bool hasTopEndcap READ hasTopEndcap WRITE setHasTopEndcap NOTIFY hasTopEndcapChanged )
20 Q_PROPERTY( bool hasBottomEndcap READ hasBottomEndcap WRITE setHasBottomEndcap NOTIFY hasBottomEndcapChanged )
21 Q_PROPERTY( float topRadius READ topRadius WRITE setTopRadius NOTIFY topRadiusChanged )
22 Q_PROPERTY( float bottomRadius READ bottomRadius WRITE setBottomRadius NOTIFY bottomRadiusChanged )
23 Q_PROPERTY(float length READ length WRITE setLength NOTIFY lengthChanged)
24public:
25 explicit QConeMesh(Qt3DCore::QNode *parent = nullptr);
26 ~QConeMesh();
27
28 int rings() const;
29 int slices() const;
30 bool hasTopEndcap() const;
31 bool hasBottomEndcap() const;
32 float topRadius() const;
33 float bottomRadius() const;
34 float length() const;
35
36public Q_SLOTS:
37 void setHasTopEndcap( bool hasTopEndcap );
38 void setHasBottomEndcap( bool hasBottomEndcap );
39 void setTopRadius( float topRadius );
40 void setBottomRadius( float bottomRadius );
41 void setRings( int rings );
42 void setSlices( int slices );
43 void setLength( float length );
44
45Q_SIGNALS:
46 void hasTopEndcapChanged( bool hasTopEndcap );
47 void hasBottomEndcapChanged( bool hasBottomEndcap );
48 void topRadiusChanged( float topRadius );
49 void bottomRadiusChanged( float bottomRadius );
50 void ringsChanged( int rings );
51 void slicesChanged( int slices );
52 void lengthChanged( float length );
53
54private:
55 // As this is a default provided geometry renderer, no one should be able
56 // to modify the QGeometryRenderer's properties
57
58 void setInstanceCount(int instanceCount);
59 void setVertexCount(int vertexCount);
60 void setIndexOffset(int indexOffset);
61 void setFirstInstance(int firstInstance);
62 void setRestartIndexValue(int index);
63 void setPrimitiveRestartEnabled(bool enabled);
64 void setGeometry(Qt3DCore::QGeometry *geometry);
65 void setPrimitiveType(PrimitiveType primitiveType);
66};
67
68} // namespace Qt3DExtras
69
70QT_END_NAMESPACE
71
72#endif // QT3DEXTRAS_QCONEMESH_H
73

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