@@ -44,13 +44,10 @@ type IndexType = u32;
44
44
/// Lyon's [`VertexBuffers`] generic data type defined for [`Vertex`].
45
45
type VertexBuffers = tess:: VertexBuffers < Vertex , IndexType > ;
46
46
47
- // TODO: Turn into a tuple struct.
48
47
/// A vertex with all the necessary attributes to be inserted into a Bevy
49
48
/// [`Mesh`](bevy::render::mesh::Mesh).
50
49
#[ derive( Debug , Clone , Copy , PartialEq ) ]
51
- struct Vertex {
52
- position : [ f32 ; 3 ] ,
53
- }
50
+ struct Vertex ( [ f32 ; 3 ] ) ;
54
51
55
52
/// Zero-sized type used to implement various vertex construction traits from
56
53
/// Lyon.
@@ -59,18 +56,14 @@ struct VertexConstructor;
59
56
/// Enables the construction of a [`Vertex`] when using a `FillTessellator`.
60
57
impl FillVertexConstructor < Vertex > for VertexConstructor {
61
58
fn new_vertex ( & mut self , vertex : FillVertex ) -> Vertex {
62
- Vertex {
63
- position : [ vertex. position ( ) . x , vertex. position ( ) . y , 0.0 ] ,
64
- }
59
+ Vertex ( [ vertex. position ( ) . x , vertex. position ( ) . y , 0.0 ] )
65
60
}
66
61
}
67
62
68
63
/// Enables the construction of a [`Vertex`] when using a `StrokeTessellator`.
69
64
impl StrokeVertexConstructor < Vertex > for VertexConstructor {
70
65
fn new_vertex ( & mut self , vertex : StrokeVertex ) -> Vertex {
71
- Vertex {
72
- position : [ vertex. position ( ) . x , vertex. position ( ) . y , 0.0 ] ,
73
- }
66
+ Vertex ( [ vertex. position ( ) . x , vertex. position ( ) . y , 0.0 ] )
74
67
}
75
68
}
76
69
@@ -140,7 +133,7 @@ fn build_mesh(buffers: &VertexBuffers) -> Mesh {
140
133
buffers
141
134
. vertices
142
135
. iter ( )
143
- . map ( |v| v. position )
136
+ . map ( |v| v. 0 )
144
137
. collect :: < Vec < [ f32 ; 3 ] > > ( ) ,
145
138
) ;
146
139
0 commit comments