albedo-engine / albedo

Efficient and easy to use rendering framework for real-time visualization based on WebGPU
MIT License
66 stars 2 forks source link

albedo_backend: MeshAttribute #13

Closed DavidPeicho closed 6 months ago

DavidPeicho commented 1 year ago

Create MeshAttribute struct:

pub struct VertexAttributesLayout {
    attributes: Vec<VertexAttribute>,
    data: Vec<u8>,
    names: Vec<String>,
    stride: u16,
}

Add a derive to automatically create attribute from vertex struct:

#[derive(AsVertexAttributesLayout)]
struct Vertex {
    position: [f32; 3];
    uv: [f32; 2];
}