1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt3D module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | #include "qcuboidmesh.h" |
41 | |
42 | #include <Qt3DExtras/qcuboidgeometry.h> |
43 | |
44 | QT_BEGIN_NAMESPACE |
45 | |
46 | namespace Qt3DExtras { |
47 | |
48 | /*! |
49 | * \qmltype CuboidMesh |
50 | * \instantiates Qt3DExtras::QCuboidMesh |
51 | * \inqmlmodule Qt3D.Extras |
52 | * \brief A cuboid mesh. |
53 | */ |
54 | |
55 | /*! |
56 | * \qmlproperty real CuboidMesh::xExtent |
57 | * |
58 | * Holds the x extent of the mesh. |
59 | */ |
60 | |
61 | /*! |
62 | * \qmlproperty real CuboidMesh::yExtent |
63 | * |
64 | * Holds the y extent of the mesh. |
65 | */ |
66 | |
67 | /*! |
68 | * \qmlproperty real CuboidMesh::zExtent |
69 | * |
70 | * Holds the z extent of the mesh. |
71 | */ |
72 | |
73 | /*! |
74 | * \qmlproperty size CuboidMesh::yzMeshResolution |
75 | * |
76 | * Holds the y-z resolution of the mesh. |
77 | * The width and height values of this property specify the number of vertices generated for |
78 | * the y-z faces of the mesh. |
79 | */ |
80 | |
81 | /*! |
82 | * \qmlproperty size CuboidMesh::xzMeshResolution |
83 | * |
84 | * Holds the x-z resolution of the mesh. |
85 | * The width and height values of this property specify the number of vertices generated for |
86 | * the x-z faces of the mesh. |
87 | */ |
88 | |
89 | /*! |
90 | * \qmlproperty size CuboidMesh::xyMeshResolution |
91 | * |
92 | * Holds the x-y resolution of the mesh. |
93 | * The width and height values of this property specify the number of vertices generated for |
94 | * the x-y faces of the mesh. |
95 | */ |
96 | |
97 | /*! |
98 | * \class Qt3DExtras::QCuboidMesh |
99 | \ingroup qt3d-extras-geometries |
100 | * \inheaderfile Qt3DExtras/QCuboidMesh |
101 | * \inmodule Qt3DExtras |
102 | * |
103 | * \inherits Qt3DRender::QGeometryRenderer |
104 | * |
105 | * \brief A cuboid mesh. |
106 | */ |
107 | |
108 | /*! |
109 | * Constructs a new QCuboidMesh with \a parent. |
110 | */ |
111 | QCuboidMesh::(QNode *parent) |
112 | : QGeometryRenderer(parent) |
113 | { |
114 | QCuboidGeometry *geometry = new QCuboidGeometry(this); |
115 | QObject::connect(sender: geometry, signal: &QCuboidGeometry::xExtentChanged, receiver: this, slot: &QCuboidMesh::xExtentChanged); |
116 | QObject::connect(sender: geometry, signal: &QCuboidGeometry::yExtentChanged, receiver: this, slot: &QCuboidMesh::yExtentChanged); |
117 | QObject::connect(sender: geometry, signal: &QCuboidGeometry::zExtentChanged, receiver: this, slot: &QCuboidMesh::zExtentChanged); |
118 | QObject::connect(sender: geometry, signal: &QCuboidGeometry::xyMeshResolutionChanged, receiver: this, slot: &QCuboidMesh::xyMeshResolutionChanged); |
119 | QObject::connect(sender: geometry, signal: &QCuboidGeometry::xzMeshResolutionChanged, receiver: this, slot: &QCuboidMesh::xzMeshResolutionChanged); |
120 | QObject::connect(sender: geometry, signal: &QCuboidGeometry::yzMeshResolutionChanged, receiver: this, slot: &QCuboidMesh::yzMeshResolutionChanged); |
121 | QGeometryRenderer::setGeometry(geometry); |
122 | } |
123 | |
124 | /*! \internal */ |
125 | QCuboidMesh::() |
126 | { |
127 | } |
128 | |
129 | void QCuboidMesh::(float xExtent) |
130 | { |
131 | static_cast<QCuboidGeometry *>(geometry())->setXExtent(xExtent); |
132 | } |
133 | |
134 | /*! |
135 | * \property QCuboidMesh::xExtent |
136 | * |
137 | * Holds the x extent of the mesh. |
138 | */ |
139 | float QCuboidMesh::() const |
140 | { |
141 | return static_cast<QCuboidGeometry *>(geometry())->xExtent(); |
142 | } |
143 | |
144 | void QCuboidMesh::(float yExtent) |
145 | { |
146 | static_cast<QCuboidGeometry *>(geometry())->setYExtent(yExtent); |
147 | } |
148 | |
149 | /*! |
150 | * \property QCuboidMesh::yExtent |
151 | * |
152 | * Holds the y extent of the mesh. |
153 | */ |
154 | float QCuboidMesh::() const |
155 | { |
156 | return static_cast<QCuboidGeometry *>(geometry())->yExtent(); |
157 | } |
158 | |
159 | void QCuboidMesh::(float zExtent) |
160 | { |
161 | static_cast<QCuboidGeometry *>(geometry())->setZExtent(zExtent); |
162 | } |
163 | |
164 | /*! |
165 | * \property QCuboidMesh::zExtent |
166 | * |
167 | * Holds the z extent of the mesh. |
168 | */ |
169 | float QCuboidMesh::() const |
170 | { |
171 | return static_cast<QCuboidGeometry *>(geometry())->zExtent(); |
172 | } |
173 | |
174 | void QCuboidMesh::(const QSize &resolution) |
175 | { |
176 | static_cast<QCuboidGeometry *>(geometry())->setYZMeshResolution(resolution); |
177 | } |
178 | |
179 | /*! |
180 | * \property QCuboidMesh::yzMeshResolution |
181 | * |
182 | * Holds the y-z resolution of the mesh. |
183 | * The width and height values of this property specify the number of vertices generated for |
184 | * the y-z faces of the mesh. |
185 | */ |
186 | QSize QCuboidMesh::() const |
187 | { |
188 | return static_cast<QCuboidGeometry *>(geometry())->yzMeshResolution(); |
189 | } |
190 | |
191 | void QCuboidMesh::(const QSize &resolution) |
192 | { |
193 | static_cast<QCuboidGeometry *>(geometry())->setXZMeshResolution(resolution); |
194 | } |
195 | |
196 | /*! |
197 | * \property QCuboidMesh::xzMeshResolution |
198 | * |
199 | * Holds the x-z resolution of the mesh. |
200 | * The width and height values of this property specify the number of vertices generated for |
201 | * the x-z faces of the mesh. |
202 | */ |
203 | QSize QCuboidMesh::() const |
204 | { |
205 | return static_cast<QCuboidGeometry *>(geometry())->xzMeshResolution(); |
206 | } |
207 | |
208 | void QCuboidMesh::(const QSize &resolution) |
209 | { |
210 | static_cast<QCuboidGeometry *>(geometry())->setXYMeshResolution(resolution); |
211 | } |
212 | |
213 | /*! |
214 | * \property QCuboidMesh::xyMeshResolution |
215 | * |
216 | * Holds the x-y resolution of the mesh. |
217 | * The width and height values of this property specify the number of vertices generated for |
218 | * the x-y faces of the mesh. |
219 | */ |
220 | QSize QCuboidMesh::() const |
221 | { |
222 | return static_cast<QCuboidGeometry *>(geometry())->xyMeshResolution(); |
223 | } |
224 | |
225 | } // namespace Qt3DExtras |
226 | |
227 | QT_END_NAMESPACE |
228 | |