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 | #include "qconegeometryview.h" |
5 | |
6 | #include <Qt3DExtras/qconegeometry.h> |
7 | #include <Qt3DCore/qbuffer.h> |
8 | #include <Qt3DCore/qattribute.h> |
9 | #include <QtGui/QVector3D> |
10 | |
11 | #include <qmath.h> |
12 | |
13 | QT_BEGIN_NAMESPACE |
14 | |
15 | namespace Qt3DExtras { |
16 | |
17 | /*! |
18 | * \qmltype ConeGeometryView |
19 | * \instantiates Qt3DExtras::QConeGeometryView |
20 | * \inqmlmodule Qt3D.Extras |
21 | * \brief A conical mesh. |
22 | */ |
23 | |
24 | /*! |
25 | * \qmlproperty int ConeGeometryView::rings |
26 | * |
27 | * Holds the number of rings in the mesh. |
28 | */ |
29 | |
30 | /*! |
31 | * \qmlproperty int ConeGeometryView::slices |
32 | * |
33 | * Holds the number of slices in the mesh. |
34 | */ |
35 | |
36 | /*! |
37 | * \qmlproperty bool ConeGeometryView::hasTopEndcap |
38 | * |
39 | * Determines if the cone top is capped or open. |
40 | */ |
41 | |
42 | /*! |
43 | * \qmlproperty bool ConeGeometryView::hasBottomEndcap |
44 | * |
45 | * Determines if the cone bottom is capped or open. |
46 | */ |
47 | |
48 | /*! |
49 | * \qmlproperty real ConeGeometryView::topRadius |
50 | * |
51 | * Holds the top radius of the cone. |
52 | */ |
53 | |
54 | /*! |
55 | * \qmlproperty real ConeGeometryView::bottomRadius |
56 | * |
57 | * Holds the bottom radius of the cone. |
58 | */ |
59 | |
60 | /*! |
61 | * \qmlproperty real ConeGeometryView::length |
62 | * |
63 | * Holds the length of the cone. |
64 | */ |
65 | |
66 | /*! |
67 | * \class Qt3DExtras::QConeGeometryView |
68 | \ingroup qt3d-extras-geometries |
69 | * \inheaderfile Qt3DExtras/QConeGeometryView |
70 | * \inmodule Qt3DExtras |
71 | * |
72 | * \inherits Qt3DRender::QGeometryRenderer |
73 | * |
74 | * \brief A conical mesh. |
75 | */ |
76 | |
77 | QConeGeometryView::(QNode *parent) |
78 | : Qt3DCore::QGeometryView(parent) |
79 | { |
80 | QConeGeometry *geometry = new QConeGeometry(this); |
81 | QObject::connect(sender: geometry, signal: &QConeGeometry::hasTopEndcapChanged, context: this, slot: &QConeGeometryView::hasTopEndcapChanged); |
82 | QObject::connect(sender: geometry, signal: &QConeGeometry::hasBottomEndcapChanged, context: this, slot: &QConeGeometryView::hasBottomEndcapChanged); |
83 | QObject::connect(sender: geometry, signal: &QConeGeometry::topRadiusChanged, context: this, slot: &QConeGeometryView::topRadiusChanged); |
84 | QObject::connect(sender: geometry, signal: &QConeGeometry::bottomRadiusChanged, context: this, slot: &QConeGeometryView::bottomRadiusChanged); |
85 | QObject::connect(sender: geometry, signal: &QConeGeometry::ringsChanged, context: this, slot: &QConeGeometryView::ringsChanged); |
86 | QObject::connect(sender: geometry, signal: &QConeGeometry::slicesChanged, context: this, slot: &QConeGeometryView::slicesChanged); |
87 | QObject::connect(sender: geometry, signal: &QConeGeometry::lengthChanged, context: this, slot: &QConeGeometryView::lengthChanged); |
88 | |
89 | QGeometryView::setGeometry(geometry); |
90 | } |
91 | |
92 | /*! \internal */ |
93 | QConeGeometryView::() |
94 | { |
95 | } |
96 | |
97 | void QConeGeometryView::(bool hasTopEndcap) |
98 | { |
99 | static_cast<QConeGeometry *>(geometry())->setHasTopEndcap(hasTopEndcap); |
100 | } |
101 | |
102 | void QConeGeometryView::(bool hasBottomEndcap) |
103 | { |
104 | static_cast<QConeGeometry *>(geometry())->setHasBottomEndcap(hasBottomEndcap); |
105 | } |
106 | |
107 | void QConeGeometryView::(float topRadius) |
108 | { |
109 | static_cast<QConeGeometry *>(geometry())->setTopRadius(topRadius); |
110 | } |
111 | |
112 | void QConeGeometryView::(float bottomRadius) |
113 | { |
114 | static_cast<QConeGeometry *>(geometry())->setBottomRadius(bottomRadius); |
115 | } |
116 | |
117 | void QConeGeometryView::(int rings) |
118 | { |
119 | static_cast<QConeGeometry *>(geometry())->setRings(rings); |
120 | } |
121 | |
122 | void QConeGeometryView::(int slices) |
123 | { |
124 | static_cast<QConeGeometry *>(geometry())->setSlices(slices); |
125 | } |
126 | |
127 | void QConeGeometryView::(float length) |
128 | { |
129 | static_cast<QConeGeometry *>(geometry())->setLength(length); |
130 | } |
131 | |
132 | /*! |
133 | * \property QConeGeometryView::hasTopEndcap |
134 | * |
135 | * Determines if the cone top is capped or open. |
136 | */ |
137 | bool QConeGeometryView::() const |
138 | { |
139 | return static_cast<QConeGeometry *>(geometry())->hasTopEndcap(); |
140 | } |
141 | |
142 | /*! |
143 | * \property QConeGeometryView::hasBottomEndcap |
144 | * |
145 | * Determines if the cone bottom is capped or open. |
146 | */ |
147 | bool QConeGeometryView::() const |
148 | { |
149 | return static_cast<QConeGeometry *>(geometry())->hasBottomEndcap(); |
150 | } |
151 | |
152 | /*! |
153 | * \property QConeGeometryView::topRadius |
154 | * |
155 | * Holds the top radius of the cone. |
156 | */ |
157 | float QConeGeometryView::() const |
158 | { |
159 | return static_cast<QConeGeometry *>(geometry())->topRadius(); |
160 | } |
161 | |
162 | /*! |
163 | * \property QConeGeometryView::bottomRadius |
164 | * |
165 | * Holds the bottom radius of the cone. |
166 | */ |
167 | float QConeGeometryView::() const |
168 | { |
169 | return static_cast<QConeGeometry *>(geometry())->bottomRadius(); |
170 | } |
171 | |
172 | /*! |
173 | * \property QConeGeometryView::rings |
174 | * |
175 | * Holds the number of rings in the mesh. |
176 | */ |
177 | int QConeGeometryView::() const |
178 | { |
179 | return static_cast<QConeGeometry *>(geometry())->rings(); |
180 | } |
181 | |
182 | /*! |
183 | * \property QConeGeometryView::slices |
184 | * |
185 | * Holds the number of slices in the mesh. |
186 | */ |
187 | int QConeGeometryView::() const |
188 | { |
189 | return static_cast<QConeGeometry *>(geometry())->slices(); |
190 | } |
191 | |
192 | /*! |
193 | * \property QConeGeometryView::length |
194 | * |
195 | * Holds the length of the cone. |
196 | */ |
197 | float QConeGeometryView::() const |
198 | { |
199 | return static_cast<QConeGeometry *>(geometry())->length(); |
200 | } |
201 | |
202 | } // namespace Qt3DExtras |
203 | |
204 | QT_END_NAMESPACE |
205 | |
206 | #include "moc_qconegeometryview.cpp" |
207 | |