(staging_handle: f64)
| 3007 | |
| 3008 | #[no_mangle] |
| 3009 | pub extern "C" fn bloom_commit_model(staging_handle: f64) -> f64 { |
| 3010 | let staged = match bloom_shared::staging::take_model(staging_handle) { |
| 3011 | Some(s) => s, |
| 3012 | None => return 0.0, |
| 3013 | }; |
| 3014 | let eng = engine(); |
| 3015 | // Register staged textures with GPU and build index map. |
| 3016 | // Staged texture_idx values are 1-based into staged.textures. |
| 3017 | // We map them to actual renderer bind_group_idx values. |
| 3018 | let mut tex_map: Vec<u32> = Vec::with_capacity(staged.textures.len()); |
| 3019 | for tex in &staged.textures { |
| 3020 | tex_map.push(eng.renderer.register_texture(tex.width, tex.height, &tex.data)); |
| 3021 | } |
| 3022 | let mut model = staged.model; |
| 3023 | for mesh in &mut model.meshes { |
| 3024 | if let Some(ref mut idx) = mesh.texture_idx { |
| 3025 | let staged_idx = *idx as usize; |
| 3026 | if staged_idx > 0 && staged_idx <= tex_map.len() { |
| 3027 | *idx = tex_map[staged_idx - 1]; |
| 3028 | } else { |
| 3029 | mesh.texture_idx = None; |
| 3030 | } |
| 3031 | } |
| 3032 | } |
| 3033 | eng.models.models.alloc(model) |
| 3034 | } |
| 3035 | |
| 3036 | #[no_mangle] |
| 3037 | pub extern "C" fn bloom_commit_sound(staging_handle: f64) -> f64 { |
nothing calls this directly
no test coverage detected