(path: &str)
| 137 | static MODELS: Mutex<Vec<Option<Arc<Model>>>> = Mutex::new(Vec::new()); |
| 138 | |
| 139 | pub fn load(path: &str) -> u32 { |
| 140 | let Ok(bytes) = std::fs::read(path) else { return 0; }; |
| 141 | let Some(model) = parse_glb(&bytes) else { return 0; }; |
| 142 | |
| 143 | let mut reg = MODELS.lock().unwrap(); |
| 144 | if reg.is_empty() { reg.push(None); } // sentinel 0 handle |
| 145 | reg.push(Some(Arc::new(model))); |
| 146 | (reg.len() - 1) as u32 |
| 147 | } |
| 148 | |
| 149 | pub fn get(handle: u32) -> Option<Arc<Model>> { |
| 150 | let reg = MODELS.lock().unwrap(); |
no test coverage detected