Skip to main content

write

Function write 

Source
pub fn write(doc: &Document, path: &Path) -> Result<WriteSummary, WriteError>
Expand description

Serialize doc to path (.glb for binary, anything else as .gltf JSON with an embedded data-URI buffer): skeleton, animation, and any scene assets it carries (Document::assets — triangulated meshes, skins, factor-only materials, and embedded PNG/JPEG base-color textures). A Document with default-empty assets writes animation and skeleton only.

§Errors

Returns WriteError::Serialize if the generated glTF JSON cannot be serialized, WriteError::TooLarge if a GLB length field would exceed the format’s 4 GiB u32 limit, and WriteError::Io when the output file cannot be written.