use crate::vector::{Vec2, Vec3}; #[derive(Debug, Clone)] #[repr(C)] pub struct Vertex { pub pos: Vec3, pub texture_coords: Vec2, pub normal: Vec3, } impl Vertex { pub fn attrs() -> &'static [Attribute] { #[allow(clippy::cast_possible_truncation)] &[ Attribute { index: 0, component_type: AttributeComponentType::Float, component_cnt: AttributeComponentCnt::Three, component_size: size_of::() as u32, }, Attribute { index: 1, component_type: AttributeComponentType::Float, component_cnt: AttributeComponentCnt::Two, component_size: size_of::() as u32, }, Attribute { index: 2, component_type: AttributeComponentType::Float, component_cnt: AttributeComponentCnt::Three, component_size: size_of::() as u32, }, ] } } #[derive(Debug)] pub struct Attribute { pub index: u32, pub component_type: AttributeComponentType, pub component_cnt: AttributeComponentCnt, pub component_size: u32, } #[derive(Debug)] pub enum AttributeComponentType { Float, } #[derive(Debug, Clone, Copy)] #[repr(u32)] #[allow(dead_code)] pub enum AttributeComponentCnt { One = 1, Two = 2, Three = 3, Four = 4, }