try_export_glb_with_stats

Function try_export_glb_with_stats 

Source
pub fn try_export_glb_with_stats(
    content: &[u8],
    opts: &GltfOptions,
) -> Result<(Vec<u8>, GltfStats), ExportError>
Expand description

Like try_export_glb but also returns coverage stats. Meshes the model from bytes.

Inputs at or above the streaming threshold (default 64 MB, native override IFC_LITE_GLB_STREAM_THRESHOLD_MB, 0 disables) route to the bounded two-pass assembler (try_export_glb_streaming_bounded) so a large model never materializes all of its MeshData at once (the wasm-OOM fix). Small models keep the in-memory instanced assembler.

Beyond the ExportError::NoRenderGeometry guard, a large input that would exceed the glTF 4 GiB single-GLB limit returns ExportError::TooLarge instead of panicking: the bounded path fails fast after pass 1, so a caller can fall back to export_gltf_streaming without catching a panic (#1516).

A SUB-THRESHOLD input (default < 64 MB) keeps the in-memory instanced assembler, which retains the historical 4 GiB pack_glb assert. That bound is only reachable if such a small file meshed to over 4 GiB of GLB (a ~64x expansion, not observed in practice); a caller that must be panic-proof even then can force the checked bounded path with IFC_LITE_GLB_STREAM_THRESHOLD_MB=1.