#vertex #glium #derive

macro glium_derive

Custom derive for glium Vertex

5 releases

Uses old Rust 2015

0.1.4 May 28, 2020
0.1.3 Sep 9, 2018
0.1.2 Sep 9, 2018
0.1.1 Jun 15, 2018
0.1.0 Jun 15, 2018

#27 in #vertex

MIT license

7KB
111 lines

glium_derive

Custom derive for glium Vertex

Example

extern crate glium;
#[macro_use]
extern crate glium_derive;

#[derive(Clone, Copy, Vertex)]
struct MyVertex {
    #[glium(attr = "a_pos")
    pos: [f32; 3],
    #[glium(attr = "a_uv")
    uv: [f32; 2],
    #[glium(attr = "a_color", normalize)
    color: u32,
}

lib.rs:

A custom derive implementation for Glium Vertex

Example

extern crate glium;
#[macro_use]
extern crate glium_derive;

#[derive(Clone, Copy, Vertex)]
struct MyVertex {
    #[glium(attr = "a_pos")]
    pos: [f32; 3],
    #[glium(attr = "a_uv")]
    uv: [f32; 2],
    #[glium(attr = "a_color", normalize)]
    color: u32,
    a_custom: u32, // the attribute can be omitted
}

Dependencies

~1.5MB
~37K SLoC