Expand description
WebAssembly (and native) bindings for the OxiHuman morph engine.
The main type is WasmEngine, a thin wrapper around
oxihuman_morph::engine::HumanEngine that exposes a flat, JavaScript-
friendly API. In native builds it works exactly the same way — useful for
server-side rendering or CLI tools that embed the WASM surface.
§Buffer protocol
WasmEngine::build_mesh_bytes returns a compact binary buffer. The
layout is described by BUFFER_FORMAT_VERSION:
[version: u32 LE]
[n_verts: u32 LE]
[n_idx: u32 LE]
[positions: f32 * 3 * n_verts]
[normals: f32 * 3 * n_verts]
[uvs: f32 * 2 * n_verts]
[indices: u32 * n_idx]§JavaScript usage example
import init, { WasmEngine } from './oxihuman_wasm.js';
await init();
const engine = WasmEngine.new_from_obj_bytes(objBytes);
engine.set_height(0.8);
engine.set_weight(0.4);
const buf = engine.build_mesh_bytes(); // Uint8Array
const view = new DataView(buf.buffer);
const nVerts = view.getUint32(4, true); // little-endian
// upload positions starting at byte offset 12 to WebGL / WebGPURe-exports§
pub use buffer::parse_mesh_bytes_header;pub use engine::Particle;pub use engine::ParticleSystem;pub use engine::WasmEngine;
Modules§
- buffer
- Buffer serialization and parsing utilities for mesh data transfer.
- buffer_
transfer - Zero-copy buffer management between Rust/WASM and JavaScript.
- compressed_
target - Compressed morph target loading — pure Rust, no C/Fortran dependencies.
- engine
- Core engine logic:
WasmEnginestruct and its implementation. The implementation is split into focused sub-modules declared inlib.rs. - error
- Error types for the oxihuman-wasm crate.
- memory_
profile - Memory pressure profiling for the OxiHuman WASM runtime.
- pack
- ZIP pack scanning utilities for loading asset packs in-memory.
- service_
worker - Offline asset caching strategy and service-worker code generation.
Constants§
- BUFFER_
FORMAT_ VERSION - Buffer format tag for the raw mesh bytes returned by
build_mesh_bytes(). Layout: [n_verts: u32 LE][n_idx: u32 LE][positions: f323n][normals: f323n][uvs: f322n][indices: u32*m]