1
+ //!
2
+ //!
3
+ //!
4
+ //!
5
+ //!
6
+ //!
7
+ //!
8
+
9
+
1
10
use bevy:: render:: {
2
11
mesh:: {
3
12
VertexAttribute ,
@@ -16,14 +25,14 @@ use lyon::{
16
25
17
26
use super :: shapes:: LyonShapeBuilder ;
18
27
19
- /// Type alias for the type of a mesh index in bevy.
28
+ /// Type alias for the type of a mesh index in [` bevy`] .
20
29
pub type BevyIndex = u32 ;
21
- /// Type alias for a `VertexBuffers` of `BevyVertex`'s and `BevyIndex`'s.
30
+ /// Type alias for a [ `VertexBuffers`](tess::VertexBuffers) of [ `BevyVertex`](BevyVertex) 's and [ `BevyIndex`](BevyIndex) 's.
22
31
pub type BevyVertexBuffers = tess:: VertexBuffers < BevyVertex , BevyIndex > ;
23
- /// Type alias for a buffer builder that contains the information to properly convert lyon points to `BevyVertex`'s and `BevyIndex`'s.
32
+ /// Type alias for a [`BuffersBuilder`](tess::BuffersBuilder) that contains the information to properly convert [` lyon`] points to [ `BevyVertex`] 's and [ `BevyIndex`] 's.
24
33
pub type BevyBuffersBuilder < ' a > = tess:: BuffersBuilder < ' a , BevyVertex , BevyIndex , BevyVertexConstructor > ;
25
34
26
- /// Builder that provides customizable functionality to create `lyon` tessellated meshes and build them so `bevy` can consume them.
35
+ /// Builder that provides customizable functionality to create [ `lyon`](lyon) tessellated meshes and build them so [ `bevy`](bevy) can consume them.
27
36
#[ derive( Debug , Clone ) ]
28
37
pub struct LyonMeshBuilder
29
38
{
@@ -42,15 +51,16 @@ impl LyonMeshBuilder
42
51
43
52
/// Finish the building and produce the final mesh.
44
53
///
45
- /// Uses TriangleStrip as the default primitive topology.
54
+ /// Uses [` TriangleStrip`](PrimitiveTopology::TriangleStrip) as the default primitive topology.
46
55
pub fn build ( self ) -> Mesh
47
56
{
57
+ LyonMeshBuilder ::
48
58
self. build_with_topology ( PrimitiveTopology :: TriangleStrip )
49
59
}
50
60
51
- /// Finishes a mesh using a custom specified `PrimitiveTopology`.
61
+ /// Finishes a mesh using a specific [ `PrimitiveTopology`] .
52
62
///
53
- /// Prefer using ` build()` as its default works in the vast majority of cases.
63
+ /// Prefer using [`LyonMeshBuilder:: build`] as its default topology works in the vast majority of cases.
54
64
pub fn build_with_topology ( self , topology : PrimitiveTopology ) -> Mesh
55
65
{
56
66
Mesh {
@@ -60,15 +70,30 @@ impl LyonMeshBuilder
60
70
}
61
71
}
62
72
63
- /// Adds a shape specified by its `LyonShapeBuilder` implementation to the mesh being constructed.
73
+ /// Adds a shape specified by argument's [ `LyonShapeBuilder`] implementation to the mesh being constructed.
64
74
pub fn with ( mut self , shape : impl LyonShapeBuilder ) -> Self
65
75
{
66
76
shape. build ( & mut self . buffers_builder ( ) ) ;
67
77
self
68
78
}
69
79
70
- /// A convenience function that makes a new `LyonMeshBuilder` and builds it with only the single shape provided.
71
- pub fn only ( shape : impl LyonShapeBuilder ) -> Mesh
80
+ /// A convenience function that makes a new [`LyonMeshBuilder`] and builds it with only the single shape provided.
81
+ ///
82
+ /// This is equivalent to calling:
83
+ /// ```rust
84
+ /// # use bevy::render::mesh::Mesh;
85
+ /// # use bevy_lyon::{
86
+ /// # LyonShapeBuilder,
87
+ /// # LyonMeshBuilder
88
+ /// # };
89
+ /// # fn with_only_example(shape: impl LyonShapeBuilder) -> Mesh
90
+ /// # {
91
+ /// LyonMeshBuilder::new()
92
+ /// .with(shape)
93
+ /// .build()
94
+ /// # }
95
+ /// ```
96
+ pub fn with_only ( shape : impl LyonShapeBuilder ) -> Mesh
72
97
{
73
98
LyonMeshBuilder :: new ( )
74
99
. with ( shape)
0 commit comments