use anyhow::Result;
use oxihuman::export::export_auto;
use oxihuman::mesh::MeshBuffers;
use oxihuman::morph::{HumanEngine, ParamState};
use oxihuman_core::parser::obj::parse_obj;
use oxihuman_core::policy::{Policy, PolicyProfile};
const BASE_OBJ: &str = "\
v 0.0 0.0 0.0\n\
v 1.0 0.0 0.0\n\
v 1.0 1.0 0.0\n\
v 0.0 1.0 0.0\n\
vn 0.0 0.0 1.0\n\
vt 0.0 0.0\n\
vt 1.0 0.0\n\
vt 1.0 1.0\n\
vt 0.0 1.0\n\
f 1/1/1 2/2/1 3/3/1\n\
f 1/1/1 3/3/1 4/4/1\n\
";
fn main() -> Result<()> {
let base_obj = parse_obj(BASE_OBJ)?;
let policy = Policy::new(PolicyProfile::Standard);
let mut engine = HumanEngine::new(base_obj, policy);
engine.set_params(ParamState::new(0.75, 0.45, 0.55, 0.35));
let morph_buffers = engine.build_mesh();
let vertex_count = morph_buffers.positions.len();
let mesh = MeshBuffers::from_morph(morph_buffers);
let out_path = std::env::temp_dir().join("basic_generation.glb");
export_auto(&mesh, &out_path)?;
let byte_count = std::fs::metadata(&out_path)?.len();
println!(
"Generated mesh: {} vertices | GLB file: {} bytes → {}",
vertex_count,
byte_count,
out_path.display()
);
Ok(())
}