diff options
| author | Jon Santmyer <jon@jonsantmyer.com> | 2026-04-15 16:53:58 -0400 |
|---|---|---|
| committer | Jon Santmyer <jon@jonsantmyer.com> | 2026-04-15 16:53:58 -0400 |
| commit | b5ced3af46c96ceb959fbbf1addfeba3bd4f76d5 (patch) | |
| tree | 06d06fc9562dc99eede655b53635576f67c37e3b /src/vertex.rs | |
| download | systemic4x-b5ced3af46c96ceb959fbbf1addfeba3bd4f76d5.tar.gz systemic4x-b5ced3af46c96ceb959fbbf1addfeba3bd4f76d5.tar.bz2 systemic4x-b5ced3af46c96ceb959fbbf1addfeba3bd4f76d5.zip | |
first commit. working body rendering
Diffstat (limited to 'src/vertex.rs')
| -rw-r--r-- | src/vertex.rs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/vertex.rs b/src/vertex.rs new file mode 100644 index 0000000..aab7d02 --- /dev/null +++ b/src/vertex.rs @@ -0,0 +1,33 @@ +#[repr(C)] +#[derive(Copy, Clone, Debug, bytemuck::Pod, bytemuck::Zeroable)] +pub struct Vertex +{ + pub position: [f32;3], + pub uv: [f32;2] +} + +impl Vertex +{ + const ATTRIBS: [wgpu::VertexAttribute;2] = + wgpu::vertex_attr_array![0 => Float32x3, 1 => Float32x2]; + + pub fn descr() + -> wgpu::VertexBufferLayout<'static> { + use std::mem; + + wgpu::VertexBufferLayout { + array_stride: mem::size_of::<Self>() as wgpu::BufferAddress, + step_mode: wgpu::VertexStepMode::Vertex, + attributes: &Self::ATTRIBS + } + } +} + +pub const QUAD_VERTICES: &[Vertex] = &[ + Vertex { position: [ -1.0, -1.0, 0.0 ], uv: [ 0.0, 1.0 ] }, + Vertex { position: [ 1.0, -1.0, 0.0 ], uv: [ 1.0, 1.0 ] }, + Vertex { position: [ 1.0, 1.0, 0.0 ], uv: [ 1.0, 0.0 ] }, + Vertex { position: [ 1.0, 1.0, 0.0 ], uv: [ 1.0, 0.0 ] }, + Vertex { position: [ -1.0, 1.0, 0.0 ], uv: [ 0.0, 0.0 ] }, + Vertex { position: [ -1.0, -1.0, 0.0 ], uv: [ 0.0, 1.0 ] } +]; |
