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
28
29
use crate::{glm, Vert, VertAttr, VertAttrType, VertLayout};

#[derive(Debug, Copy, Clone)]
#[repr(C)]
pub struct VertBasic {
    pub position: glm::Vec3,
    pub normal: glm::Vec3,
    pub tex_coords: glm::Vec2,
}

impl VertBasic {
    pub fn from_pos(x: f32, y: f32, z: f32) -> VertBasic {
        VertBasic {
            position: glm::vec3(x, y, z),
            normal: glm::vec3(0.0, 0.0, 0.0),
            tex_coords: glm::vec2(0.0, 0.0),
        }
    }
}

impl Vert for VertBasic {
    fn layout() -> VertLayout {
        VertLayout::new(vec![
            VertAttr::new(VertAttrType::Float3, false),
            VertAttr::new(VertAttrType::Float3, false),
            VertAttr::new(VertAttrType::Float2, false),
        ])
    }
}