use crate::wgpu; #[derive(Debug, Copy, Clone, bytemuck::Pod, bytemuck::Zeroable)] #[repr(C)] pub struct Vertex { pub pos: glam::Vec3, pub normal: glam::Vec3, pub tangent: glam::Vec3, pub uv: glam::Vec2, } impl Vertex { const ATTRIBS: [wgpu::VertexAttribute; 4] = wgpu::vertex_attr_array![ //position 0 => Float32x3, //normal 1 => Float32x3, //tangent 2 => Float32x3, //uv 3 => Float32x2, ]; pub fn desc<'a>() -> wgpu::VertexBufferLayout<'a> { wgpu::VertexBufferLayout { array_stride: std::mem::size_of::() as wgpu::BufferAddress, step_mode: wgpu::VertexStepMode::Vertex, attributes: &Self::ATTRIBS, } } }