MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / load

Function load

native/watchos/src/models.rs:139–147  ·  view source on GitHub ↗
(path: &str)

Source from the content-addressed store, hash-verified

137static MODELS: Mutex<Vec<Option<Arc<Model>>>> = Mutex::new(Vec::new());
138
139pub 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
149pub fn get(handle: u32) -> Option<Arc<Model>> {
150 let reg = MODELS.lock().unwrap();

Callers 2

bloom_load_textureFunction · 0.70
bloom_load_modelFunction · 0.70

Calls 2

parse_glbFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected