Skip to main content

node_tree_from_gltf

Function node_tree_from_gltf 

Source
pub fn node_tree_from_gltf<'s, F>(
    doc: &Document,
    get_buffer_data: F,
) -> GltfTree
where F: Clone + for<'b> Fn(Buffer<'b>) -> Option<&'s [u8]>,
Available on crate feature gltf only.
Expand description

Builds the node tree of the default glTF scene as Nodes of MeshItems, wrapped in a GltfTree with the document-index → tree-path mapping.

get_buffer_data resolves a glTF buffer to its byte slice; returning None makes the affected accessors unreadable, so primitives fall back to their documented defaults. The bound is higher-ranked over the buffer’s lifetime (glTF’s Primitive::reader ties its own borrow to the call); the returned slice only borrows the resolver’s own storage (e.g. a GLB blob), never the document. See the module docs for the full mapping and the POC limitations.