diff options
| author | Micha White <botahamec@outlook.com> | 2022-10-17 23:06:51 -0400 |
|---|---|---|
| committer | Micha White <botahamec@outlook.com> | 2022-10-17 23:06:51 -0400 |
| commit | 9359df753ef76fdeb40a0de19c67080329710067 (patch) | |
| tree | 40a6b32ce940830c680e3f6b0b7424b50c497dc3 /src/vertex.rs | |
| parent | bc859833a41aa581228a476c3fa81acac9730a2e (diff) | |
More docs
Diffstat (limited to 'src/vertex.rs')
| -rw-r--r-- | src/vertex.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/vertex.rs b/src/vertex.rs index a24a601..570eec4 100644 --- a/src/vertex.rs +++ b/src/vertex.rs @@ -12,6 +12,7 @@ pub const SQUARE: [Vertex; 6] = [ Vertex::new(0.5, -0.5), ]; +/// A vertex that is usable by the alligator shader #[repr(C)] #[derive(Copy, Clone, Debug, PartialEq, Pod, Zeroable)] pub struct Vertex { @@ -19,16 +20,15 @@ pub struct Vertex { } impl Vertex { - const fn new(x: f32, y: f32) -> Self { - Self { position: [x, y] } - } -} - -impl Vertex { // whenever this is updated, please also update `sprite.wgsl` pub(crate) const ATTRIBUTES: [wgpu::VertexAttribute; 1] = wgpu::vertex_attr_array![0 => Float32x2]; + /// Create a new vertex + const fn new(x: f32, y: f32) -> Self { + Self { position: [x, y] } + } + pub(crate) const fn desc<'a>() -> wgpu::VertexBufferLayout<'a> { wgpu::VertexBufferLayout { array_stride: size_of::<Self>() as wgpu::BufferAddress, |
