1 | // Copyright (C) 2014 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 "qcuboidmesh.h" |
5 | |
6 | #include <Qt3DExtras/qcuboidgeometryview.h> |
7 | |
8 | QT_BEGIN_NAMESPACE |
9 | |
10 | namespace Qt3DExtras { |
11 | |
12 | /*! |
13 | * \qmltype CuboidMesh |
14 | * \instantiates Qt3DExtras::QCuboidMesh |
15 | * \inqmlmodule Qt3D.Extras |
16 | * \brief A cuboid mesh. |
17 | */ |
18 | |
19 | /*! |
20 | * \qmlproperty real CuboidMesh::xExtent |
21 | * |
22 | * Holds the x extent of the mesh. |
23 | */ |
24 | |
25 | /*! |
26 | * \qmlproperty real CuboidMesh::yExtent |
27 | * |
28 | * Holds the y extent of the mesh. |
29 | */ |
30 | |
31 | /*! |
32 | * \qmlproperty real CuboidMesh::zExtent |
33 | * |
34 | * Holds the z extent of the mesh. |
35 | */ |
36 | |
37 | /*! |
38 | * \qmlproperty size CuboidMesh::yzMeshResolution |
39 | * |
40 | * Holds the y-z resolution of the mesh. |
41 | * The width and height values of this property specify the number of vertices generated for |
42 | * the y-z faces of the mesh. |
43 | */ |
44 | |
45 | /*! |
46 | * \qmlproperty size CuboidMesh::xzMeshResolution |
47 | * |
48 | * Holds the x-z resolution of the mesh. |
49 | * The width and height values of this property specify the number of vertices generated for |
50 | * the x-z faces of the mesh. |
51 | */ |
52 | |
53 | /*! |
54 | * \qmlproperty size CuboidMesh::xyMeshResolution |
55 | * |
56 | * Holds the x-y resolution of the mesh. |
57 | * The width and height values of this property specify the number of vertices generated for |
58 | * the x-y faces of the mesh. |
59 | */ |
60 | |
61 | /*! |
62 | * \class Qt3DExtras::QCuboidMesh |
63 | * \ingroup qt3d-extras-geometries |
64 | * \inheaderfile Qt3DExtras/QCuboidMesh |
65 | * \inmodule Qt3DExtras |
66 | * |
67 | * \inherits Qt3DRender::QGeometryRenderer |
68 | * |
69 | * \brief A cuboid mesh. |
70 | */ |
71 | |
72 | /*! |
73 | * Constructs a new QCuboidMesh with \a parent. |
74 | */ |
75 | QCuboidMesh::(QNode *parent) |
76 | : Qt3DRender::QGeometryRenderer(parent) |
77 | { |
78 | QCuboidGeometryView *geometry = new QCuboidGeometryView(this); |
79 | QObject::connect(sender: geometry, signal: &QCuboidGeometryView::xExtentChanged, context: this, slot: &QCuboidMesh::xExtentChanged); |
80 | QObject::connect(sender: geometry, signal: &QCuboidGeometryView::yExtentChanged, context: this, slot: &QCuboidMesh::yExtentChanged); |
81 | QObject::connect(sender: geometry, signal: &QCuboidGeometryView::zExtentChanged, context: this, slot: &QCuboidMesh::zExtentChanged); |
82 | QObject::connect(sender: geometry, signal: &QCuboidGeometryView::xyMeshResolutionChanged, context: this, slot: &QCuboidMesh::xyMeshResolutionChanged); |
83 | QObject::connect(sender: geometry, signal: &QCuboidGeometryView::xzMeshResolutionChanged, context: this, slot: &QCuboidMesh::xzMeshResolutionChanged); |
84 | QObject::connect(sender: geometry, signal: &QCuboidGeometryView::yzMeshResolutionChanged, context: this, slot: &QCuboidMesh::yzMeshResolutionChanged); |
85 | setView(geometry); |
86 | } |
87 | |
88 | /*! \internal */ |
89 | QCuboidMesh::() |
90 | { |
91 | } |
92 | |
93 | void QCuboidMesh::(float xExtent) |
94 | { |
95 | static_cast<QCuboidGeometryView *>(view())->setXExtent(xExtent); |
96 | } |
97 | |
98 | /*! |
99 | * \property QCuboidMesh::xExtent |
100 | * |
101 | * Holds the x extent of the mesh. |
102 | */ |
103 | float QCuboidMesh::() const |
104 | { |
105 | return static_cast<QCuboidGeometryView *>(view())->xExtent(); |
106 | } |
107 | |
108 | void QCuboidMesh::(float yExtent) |
109 | { |
110 | static_cast<QCuboidGeometryView *>(view())->setYExtent(yExtent); |
111 | } |
112 | |
113 | /*! |
114 | * \property QCuboidMesh::yExtent |
115 | * |
116 | * Holds the y extent of the mesh. |
117 | */ |
118 | float QCuboidMesh::() const |
119 | { |
120 | return static_cast<QCuboidGeometryView *>(view())->yExtent(); |
121 | } |
122 | |
123 | void QCuboidMesh::(float zExtent) |
124 | { |
125 | static_cast<QCuboidGeometryView *>(view())->setZExtent(zExtent); |
126 | } |
127 | |
128 | /*! |
129 | * \property QCuboidMesh::zExtent |
130 | * |
131 | * Holds the z extent of the mesh. |
132 | */ |
133 | float QCuboidMesh::() const |
134 | { |
135 | return static_cast<QCuboidGeometryView *>(view())->zExtent(); |
136 | } |
137 | |
138 | void QCuboidMesh::(const QSize &resolution) |
139 | { |
140 | static_cast<QCuboidGeometryView *>(view())->setYZMeshResolution(resolution); |
141 | } |
142 | |
143 | /*! |
144 | * \property QCuboidMesh::yzMeshResolution |
145 | * |
146 | * Holds the y-z resolution of the mesh. |
147 | * The width and height values of this property specify the number of vertices generated for |
148 | * the y-z faces of the mesh. |
149 | */ |
150 | QSize QCuboidMesh::() const |
151 | { |
152 | return static_cast<QCuboidGeometryView *>(view())->yzMeshResolution(); |
153 | } |
154 | |
155 | void QCuboidMesh::(const QSize &resolution) |
156 | { |
157 | static_cast<QCuboidGeometryView *>(view())->setXZMeshResolution(resolution); |
158 | } |
159 | |
160 | /*! |
161 | * \property QCuboidMesh::xzMeshResolution |
162 | * |
163 | * Holds the x-z resolution of the mesh. |
164 | * The width and height values of this property specify the number of vertices generated for |
165 | * the x-z faces of the mesh. |
166 | */ |
167 | QSize QCuboidMesh::() const |
168 | { |
169 | return static_cast<QCuboidGeometryView *>(view())->xzMeshResolution(); |
170 | } |
171 | |
172 | void QCuboidMesh::(const QSize &resolution) |
173 | { |
174 | static_cast<QCuboidGeometryView *>(view())->setXYMeshResolution(resolution); |
175 | } |
176 | |
177 | /*! |
178 | * \property QCuboidMesh::xyMeshResolution |
179 | * |
180 | * Holds the x-y resolution of the mesh. |
181 | * The width and height values of this property specify the number of vertices generated for |
182 | * the x-y faces of the mesh. |
183 | */ |
184 | QSize QCuboidMesh::() const |
185 | { |
186 | return static_cast<QCuboidGeometryView *>(view())->xyMeshResolution(); |
187 | } |
188 | |
189 | } // namespace Qt3DExtras |
190 | |
191 | QT_END_NAMESPACE |
192 | |
193 | #include "moc_qcuboidmesh.cpp" |
194 | |