(staging_handle: f64)
| 1609 | |
| 1610 | #[no_mangle] |
| 1611 | pub extern "C" fn bloom_commit_model(staging_handle: f64) -> f64 { |
| 1612 | let staged = match bloom_shared::staging::take_model(staging_handle) { |
| 1613 | Some(s) => s, |
| 1614 | None => return 0.0, |
| 1615 | }; |
| 1616 | let eng = engine(); |
| 1617 | let mut tex_map: Vec<u32> = Vec::with_capacity(staged.textures.len()); |
| 1618 | for tex in &staged.textures { |
| 1619 | tex_map.push(eng.renderer.register_texture(tex.width, tex.height, &tex.data)); |
| 1620 | } |
| 1621 | let mut model = staged.model; |
| 1622 | for mesh in &mut model.meshes { |
| 1623 | if let Some(ref mut idx) = mesh.texture_idx { |
| 1624 | let staged_idx = *idx as usize; |
| 1625 | if staged_idx > 0 && staged_idx <= tex_map.len() { |
| 1626 | *idx = tex_map[staged_idx - 1]; |
| 1627 | } else { |
| 1628 | mesh.texture_idx = None; |
| 1629 | } |
| 1630 | } |
| 1631 | } |
| 1632 | eng.models.models.alloc(model) |
| 1633 | } |
| 1634 | |
| 1635 | #[no_mangle] |
| 1636 | pub extern "C" fn bloom_commit_sound(staging_handle: f64) -> f64 { |
nothing calls this directly
no test coverage detected