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

Function bloom_commit_model

native/ios/src/lib.rs:2158–2180  ·  view source on GitHub ↗
(staging_handle: f64)

Source from the content-addressed store, hash-verified

2156
2157#[no_mangle]
2158pub extern "C" fn bloom_commit_model(staging_handle: f64) -> f64 {
2159 let staged = match bloom_shared::staging::take_model(staging_handle) {
2160 Some(s) => s,
2161 None => return 0.0,
2162 };
2163 let eng = engine();
2164 let mut tex_map: Vec<u32> = Vec::with_capacity(staged.textures.len());
2165 for tex in &staged.textures {
2166 tex_map.push(eng.renderer.register_texture(tex.width, tex.height, &tex.data));
2167 }
2168 let mut model = staged.model;
2169 for mesh in &mut model.meshes {
2170 if let Some(ref mut idx) = mesh.texture_idx {
2171 let staged_idx = *idx as usize;
2172 if staged_idx > 0 && staged_idx <= tex_map.len() {
2173 *idx = tex_map[staged_idx - 1];
2174 } else {
2175 mesh.texture_idx = None;
2176 }
2177 }
2178 }
2179 eng.models.models.alloc(model)
2180}
2181
2182#[no_mangle]
2183pub extern "C" fn bloom_commit_sound(staging_handle: f64) -> f64 {

Callers 2

loadModelAsyncFunction · 0.50
commitModelFunction · 0.50

Calls 5

take_modelFunction · 0.85
register_textureMethod · 0.80
allocMethod · 0.80
engineFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected