(path_ptr: *const u8)
| 1432 | |
| 1433 | #[no_mangle] |
| 1434 | pub extern "C" fn bloom_load_model(path_ptr: *const u8) -> f64 { |
| 1435 | let path = str_from_header(path_ptr); |
| 1436 | match std::fs::read(path) { |
| 1437 | Ok(data) => { |
| 1438 | let eng = engine(); |
| 1439 | let EngineState { ref mut models, ref mut renderer, .. } = *eng; |
| 1440 | // .gltf = loose file with external .bin + image URIs; pass |
| 1441 | // the directory so relative paths resolve. .glb (binary) |
| 1442 | // embeds everything and needs no base dir. |
| 1443 | let p = std::path::Path::new(&path); |
| 1444 | let is_loose = p.extension().and_then(|e| e.to_str()) == Some("gltf"); |
| 1445 | if is_loose { |
| 1446 | if let Some(dir) = p.parent() { |
| 1447 | return models.load_model_with_textures_from_path(&data, dir, renderer); |
| 1448 | } |
| 1449 | } |
| 1450 | models.load_model_with_textures(&data, renderer) |
| 1451 | } |
| 1452 | Err(_) => 0.0, |
| 1453 | } |
| 1454 | } |
| 1455 | |
| 1456 | #[no_mangle] |
| 1457 | pub extern "C" fn bloom_draw_model(handle: f64, x: f64, y: f64, z: f64, scale: f64, r: f64, g: f64, b: f64, a: f64) { |
nothing calls this directly
no test coverage detected