use bytemuck::{Pod, Zeroable};
use nalgebra_glm as glm;
use crate::pbr::Color;
#[repr(C)]
#[derive(Copy, Clone, Debug, Zeroable, Pod)]
pub struct Vertex {
pub position: glm::Vec3,
pub normal: glm::Vec3,
pub color: Color,
}
impl Vertex {
const ATTRIBS: [wgpu::VertexAttribute; 3] = wgpu::vertex_attr_array![
0 => Float32x3,
1 => Float32x3,
2 => Float32x3,
];
pub(crate) fn vertex_buffer_layout() -> wgpu::VertexBufferLayout<'static> {
wgpu::VertexBufferLayout {
array_stride: std::mem::size_of::<Vertex>() as wgpu::BufferAddress,
step_mode: wgpu::VertexStepMode::Vertex,
attributes: &Self::ATTRIBS,
}
}
}