use strafesnet_common::model::MeshId; //duplicate this code for now #[derive(Clone)] pub struct MdlData(Vec); impl MdlData{ pub const fn new(value:Vec)->Self{ Self(value) } pub fn get(self)->Vec{ self.0 } } #[derive(Clone)] pub struct VtxData(Vec); impl VtxData{ pub const fn new(value:Vec)->Self{ Self(value) } pub fn get(self)->Vec{ self.0 } } #[derive(Clone)] pub struct VvdData(Vec); impl VvdData{ pub const fn new(value:Vec)->Self{ Self(value) } pub fn get(self)->Vec{ self.0 } } #[derive(Clone)] pub struct ModelData{ pub mdl:MdlData, pub vtx:VtxData, pub vvd:VvdData, } //meshes is more prone to failure pub struct Meshes{ meshes:Vec>, } impl Meshes{ pub(crate) const fn new(meshes:Vec>)->Self{ Self{ meshes, } } pub fn get_texture(&self,texture_id:MeshId)->Option<&ModelData>{ self.meshes.get(texture_id.get() as usize)?.as_ref() } pub fn into_iter(self)->impl Iterator{ self.meshes.into_iter().enumerate().filter_map(|(mesh_id,maybe_mesh)| maybe_mesh.map(|mesh|(MeshId::new(mesh_id as u32),mesh)) ) } }