Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/facett

facett-model3d/src/bin/gen_skull.rs

//! One-off: bake the procedural skull into `assets/skull.glb`. The committed
//! asset is this binary's output; re-run only to regenerate.
//!
//! `cargo run -p facett-model3d --bin gen_skull`

fn main() -> std::io::Result<()> {
    let mesh = facett_model3d::skull::skull_mesh();
    let glb = facett_model3d::glb::to_glb(&mesh);
    let path = concat!(env!("CARGO_MANIFEST_DIR"), "/assets/skull.glb");
    if let Some(dir) = std::path::Path::new(path).parent() {
        std::fs::create_dir_all(dir)?;
    }
    std::fs::write(path, &glb)?;
    println!(
        "wrote {} ({} bytes) — {} groups, {} triangles: {:?}",
        path,
        glb.len(),
        mesh.groups.len(),
        mesh.triangle_count(),
        mesh.group_names()
    );
    Ok(())
}