1 | // Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). |
2 | // Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies). |
3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
4 | |
5 | #ifndef _USE_MATH_DEFINES |
6 | # define _USE_MATH_DEFINES // For MSVC |
7 | #endif |
8 | |
9 | #include "qcylindergeometryview.h" |
10 | |
11 | #include <Qt3DExtras/qcylindergeometry.h> |
12 | #include <Qt3DCore/qbuffer.h> |
13 | #include <Qt3DCore/qattribute.h> |
14 | #include <QtGui/QVector3D> |
15 | |
16 | #include <qmath.h> |
17 | |
18 | QT_BEGIN_NAMESPACE |
19 | |
20 | |
21 | namespace Qt3DExtras { |
22 | |
23 | using namespace Qt3DCore; |
24 | |
25 | /*! |
26 | * \qmltype CylinderGeometryView |
27 | * \nativetype Qt3DExtras::QCylinderGeometryView |
28 | * \inqmlmodule Qt3D.Extras |
29 | * \brief A cylindrical mesh. |
30 | */ |
31 | |
32 | /*! |
33 | * \qmlproperty int CylinderGeometryView::rings |
34 | * |
35 | * Holds the number of rings in the mesh. |
36 | */ |
37 | |
38 | /*! |
39 | * \qmlproperty int CylinderGeometryView::slices |
40 | * |
41 | * Holds the number of slices in the mesh. |
42 | */ |
43 | |
44 | /*! |
45 | * \qmlproperty real CylinderGeometryView::radius |
46 | * |
47 | * Holds the radius of the cylinder. |
48 | */ |
49 | |
50 | /*! |
51 | * \qmlproperty real CylinderGeometryView::length |
52 | * |
53 | * Holds the length of the cylinder. |
54 | */ |
55 | |
56 | /*! |
57 | * \class Qt3DExtras::QCylinderGeometryView |
58 | \ingroup qt3d-extras-geometries |
59 | * \inheaderfile Qt3DExtras/QCylinderGeometryView |
60 | * \inmodule Qt3DExtras |
61 | * |
62 | * \inherits Qt3DRender::QGeometryRenderer |
63 | * |
64 | * \brief A cylindrical mesh. |
65 | */ |
66 | |
67 | /*! |
68 | * Constructs a new QCylinderGeometryView with \a parent. |
69 | */ |
70 | QCylinderGeometryView::(QNode *parent) |
71 | : Qt3DCore::QGeometryView(parent) |
72 | { |
73 | QCylinderGeometry *geometry = new QCylinderGeometry(this); |
74 | QObject::connect(sender: geometry, signal: &QCylinderGeometry::radiusChanged, context: this, slot: &QCylinderGeometryView::radiusChanged); |
75 | QObject::connect(sender: geometry, signal: &QCylinderGeometry::ringsChanged, context: this, slot: &QCylinderGeometryView::ringsChanged); |
76 | QObject::connect(sender: geometry, signal: &QCylinderGeometry::slicesChanged, context: this, slot: &QCylinderGeometryView::slicesChanged); |
77 | QObject::connect(sender: geometry, signal: &QCylinderGeometry::lengthChanged, context: this, slot: &QCylinderGeometryView::lengthChanged); |
78 | |
79 | QGeometryView::setGeometry(geometry); |
80 | } |
81 | |
82 | /*! \internal */ |
83 | QCylinderGeometryView::() |
84 | { |
85 | } |
86 | |
87 | void QCylinderGeometryView::(int rings) |
88 | { |
89 | static_cast<QCylinderGeometry *>(geometry())->setRings(rings); |
90 | } |
91 | |
92 | void QCylinderGeometryView::(int slices) |
93 | { |
94 | static_cast<QCylinderGeometry *>(geometry())->setSlices(slices); |
95 | } |
96 | |
97 | void QCylinderGeometryView::(float radius) |
98 | { |
99 | static_cast<QCylinderGeometry *>(geometry())->setRadius(radius); |
100 | } |
101 | |
102 | void QCylinderGeometryView::(float length) |
103 | { |
104 | static_cast<QCylinderGeometry *>(geometry())->setLength(length); |
105 | } |
106 | |
107 | /*! |
108 | * \property Qt3DExtras::QCylinderGeometryView::rings |
109 | * |
110 | * Holds the number of rings in the mesh. |
111 | */ |
112 | int QCylinderGeometryView::() const |
113 | { |
114 | return static_cast<QCylinderGeometry *>(geometry())->rings(); |
115 | } |
116 | |
117 | /*! |
118 | * \property Qt3DExtras::QCylinderGeometryView::slices |
119 | * |
120 | * Holds the number of slices in the mesh. |
121 | */ |
122 | int QCylinderGeometryView::() const |
123 | { |
124 | return static_cast<QCylinderGeometry *>(geometry())->slices(); |
125 | } |
126 | |
127 | /*! |
128 | * \property Qt3DExtras::QCylinderGeometryView::radius |
129 | * |
130 | * Holds the radius of the cylinder. |
131 | */ |
132 | float QCylinderGeometryView::() const |
133 | { |
134 | return static_cast<QCylinderGeometry *>(geometry())->radius(); |
135 | } |
136 | |
137 | /*! |
138 | * \property Qt3DExtras::QCylinderGeometryView::length |
139 | * |
140 | * Holds the length of the cylinder. |
141 | */ |
142 | float QCylinderGeometryView::() const |
143 | { |
144 | return static_cast<QCylinderGeometry *>(geometry())->length(); |
145 | } |
146 | |
147 | } // namespace Qt3DExtras |
148 | |
149 | QT_END_NAMESPACE |
150 | |
151 | #include "moc_qcylindergeometryview.cpp" |
152 | |