Macro glitter::impl_vertex_data [] [src]

macro_rules! impl_vertex_data {
    ($name:ty, $($field_name:ident),*) => { ... };
}

Implement the VertexData trait for a struct. Each field of the struct must that is part of the VertexData implementation must be a type that implements VertexDatum.

Note

The generated implementation will not be panic safe with regards to the VertexDatum::attrib_type method of the vertex attribute fields. However, as the documentation of notes, implementors should be aware of this already.

Examples

#[macro_use] extern crate glitter;

// A type must implement `Copy` to implement `VertexData`
#[derive(Clone, Copy)]
struct MyVertex {
    position: [f32; 3],
    color: [f32; 3]
}

// Implement `VertexData`, using the "position" and "color" fields
// as vertex attributes.
impl_vertex_data!(MyVertex, position, color);