1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
use glium; use math::{Vec2, Vec3}; #[derive(Copy, Clone)] pub struct Vertex { position: [f32; 3], uv: [f32; 2], } impl Vertex { pub fn new<V: Into<Vec3>>(position: V, uv: Vec2) -> Self { let position = position.into(); Self { position: position.into(), uv: uv.into(), } } } pub type Index = u32; implement_vertex!(Vertex, position, uv); pub struct Mesh { pub vertices: glium::VertexBuffer<Vertex>, pub indices: glium::IndexBuffer<Index>, }