Crate gltf

source · []
Expand description

glTF 2.0 loader

This crate is intended to load glTF 2.0, a file format designed for the efficient runtime transmission of 3D scenes. The crate aims to provide rustic utilities that make working with glTF simple and intuitive.


Add gltf to your Cargo.toml:

version = "1.0"


Basic usage

Walking the node hierarchy.

let gltf = Gltf::open("examples/Box.gltf")?;
for scene in gltf.scenes() {
    for node in scene.nodes() {
            "Node #{} has {} children",

Import function

Reading a glTF document plus its buffers and images from the file system.

let (document, buffers, images) = gltf::import("examples/Box.gltf")?;
assert_eq!(buffers.len(), document.buffers().count());
assert_eq!(images.len(), document.images().count());


This function is provided as a convenience for loading glTF and associated resources from the file system. It is suitable for real world use but may not be suitable for all real world use cases. More complex import scenarios such downloading from web URLs are not handled by this function. These scenarios are delegated to the user.

You can read glTF without loading resources by constructing the Gltf (standard glTF) or Glb (binary glTF) data structures explicitly.


pub extern crate gltf_json as json;


Accessors for reading vertex attributes from buffer views.

Animations, their channels, targets, and samplers.

Primitives for working with binary glTF.

Buffers and buffer views.

Cameras and their projections.

Images that may be used by textures.

Iterators for walking the glTF node hierarchy.


Support for the KHR_lights_punctual extension.


Support for the KHR_materials_variants extension.

Material properties of primitives.

Meshes and their primitives.

The glTF node heirarchy.

Mesh skinning primitives.

Textures and their samplers.


A typed view into a buffer view.

A keyframe animation.

A buffer points to binary data representing geometry, animations, or skins.

A camera’s projection. A node can reference a camera to apply a transform to place the camera in the scene.

glTF JSON wrapper.

Binary glTF contents.

glTF JSON wrapper plus binary payload.

Image data used to create a texture.

The material appearance of a primitive.

A set of primitives to be rendered.

A node in the node hierarchy.

Geometry to be rendered with the given material.

The root nodes of a scene.

Joints and matrices defining a skin.

A texture and its sampler.


Represents a runtime error.

Vertex attribute semantic name.


Import some glTF 2.0 from the file system.

Import some glTF 2.0 from a slice

Type Definitions

Vertex attribute data.

Result type for convenience.