@@ -158,7 +158,7 @@ impl Geometry {
158
158
) -> Self {
159
159
Self :: generate (
160
160
generators:: Plane :: new ( ) ,
161
- |GenVertex { pos, .. } | [ pos[ 0 ] * 0.5 * width, pos[ 1 ] * 0.5 * height, 0.0 ] . into ( ) ,
161
+ |GenVertex { pos, .. } | [ pos. x * 0.5 * width, pos. y * 0.5 * height, 0.0 ] . into ( ) ,
162
162
|v| v. normal . into ( ) ,
163
163
)
164
164
}
@@ -188,9 +188,9 @@ impl Geometry {
188
188
generators:: Cube :: new ( ) ,
189
189
|GenVertex { pos, .. } | {
190
190
[
191
- pos[ 0 ] * 0.5 * width,
192
- pos[ 1 ] * 0.5 * height,
193
- pos[ 2 ] * 0.5 * depth,
191
+ pos. x * 0.5 * width,
192
+ pos. y * 0.5 * height,
193
+ pos. z * 0.5 * depth,
194
194
] . into ( )
195
195
} ,
196
196
|v| v. normal . into ( ) ,
@@ -230,10 +230,10 @@ impl Geometry {
230
230
generators:: Cylinder :: new ( radius_segments) ,
231
231
//Three.js has height along the Y axis for some reason
232
232
|GenVertex { pos, .. } | {
233
- let scale = ( pos[ 2 ] + 1.0 ) * 0.5 * radius_top + ( 1.0 - pos[ 2 ] ) * 0.5 * radius_bottom;
234
- [ pos[ 1 ] * scale, pos[ 2 ] * 0.5 * height, pos[ 0 ] * scale] . into ( )
233
+ let scale = ( pos. z + 1.0 ) * 0.5 * radius_top + ( 1.0 - pos. z ) * 0.5 * radius_bottom;
234
+ [ pos. y * scale, pos. z * 0.5 * height, pos. x * scale] . into ( )
235
235
} ,
236
- |GenVertex { normal, .. } | [ normal[ 1 ] , normal[ 2 ] , normal[ 0 ] ] . into ( ) ,
236
+ |GenVertex { normal, .. } | [ normal. y , normal. z , normal. x ] . into ( ) ,
237
237
)
238
238
}
239
239
@@ -257,8 +257,8 @@ impl Geometry {
257
257
meridional_segments : usize ,
258
258
) -> Self {
259
259
Self :: generate (
260
- generators:: SphereUV :: new ( equatorial_segments, meridional_segments) ,
261
- |GenVertex { pos, .. } | [ pos[ 0 ] * radius, pos[ 1 ] * radius, pos[ 2 ] * radius] . into ( ) ,
260
+ generators:: SphereUv :: new ( equatorial_segments, meridional_segments) ,
261
+ |GenVertex { pos, .. } | [ pos. x * radius, pos. y * radius, pos. z * radius] . into ( ) ,
262
262
|v| v. normal . into ( ) ,
263
263
)
264
264
}
0 commit comments