(staging_handle: f64)
| 1722 | |
| 1723 | #[no_mangle] |
| 1724 | pub extern "C" fn bloom_commit_model(staging_handle: f64) -> f64 { |
| 1725 | let staged = match bloom_shared::staging::take_model(staging_handle) { |
| 1726 | Some(s) => s, |
| 1727 | None => return 0.0, |
| 1728 | }; |
| 1729 | let eng = engine(); |
| 1730 | let mut tex_map: Vec<u32> = Vec::with_capacity(staged.textures.len()); |
| 1731 | for tex in &staged.textures { |
| 1732 | tex_map.push(eng.renderer.register_texture(tex.width, tex.height, &tex.data)); |
| 1733 | } |
| 1734 | let mut model = staged.model; |
| 1735 | for mesh in &mut model.meshes { |
| 1736 | if let Some(ref mut idx) = mesh.texture_idx { |
| 1737 | let staged_idx = *idx as usize; |
| 1738 | if staged_idx > 0 && staged_idx <= tex_map.len() { |
| 1739 | *idx = tex_map[staged_idx - 1]; |
| 1740 | } else { |
| 1741 | mesh.texture_idx = None; |
| 1742 | } |
| 1743 | } |
| 1744 | } |
| 1745 | eng.models.models.alloc(model) |
| 1746 | } |
| 1747 | |
| 1748 | #[no_mangle] |
| 1749 | pub extern "C" fn bloom_commit_sound(staging_handle: f64) -> f64 { |
nothing calls this directly
no test coverage detected