19 releases (1 stable)

1.0.0 Jan 30, 2022
0.16.0 May 13, 2021
0.15.2 Mar 29, 2020
0.14.0 Oct 6, 2019
0.9.3 Oct 28, 2017

#6 in Data formats

Download history 10276/week @ 2022-08-17 10299/week @ 2022-08-24 7976/week @ 2022-08-31 8566/week @ 2022-09-07 7102/week @ 2022-09-14 7657/week @ 2022-09-21 7573/week @ 2022-09-28 8577/week @ 2022-10-05 7273/week @ 2022-10-12 7041/week @ 2022-10-19 8920/week @ 2022-10-26 9361/week @ 2022-11-02 11132/week @ 2022-11-09 9303/week @ 2022-11-16 7892/week @ 2022-11-23 6921/week @ 2022-11-30

36,494 downloads per month
Used in 193 crates (4 directly)

MIT/Apache

130KB
2.5K SLoC

gltf

travis crates.io docs.rs


This crate is intended to load glTF 2.0, a file format designed for the efficient transmission of 3D assets.

rustc version 1.32 or above is required.

Reference infographic

infographic

From javagl/gltfOverview

PDF version

Usage

See the crate documentation for example usage.

Features

Extras and names

By default, gltf ignores all extras and names included with glTF assets. You can negate this by enabling the extras and names features, respectively.

[dependencies.gltf]
version = "1.0"
features = ["extras", "names"]

glTF extensions

The following glTF extensions are supported by the crate:

  • KHR_lights_punctual
  • KHR_materials_pbrSpecularGlossiness
  • KHR_materials_unlit
  • KHR_texture_transform
  • KHR_materials_variants
  • KHR_materials_volume
  • KHR_materials_specular

To use an extension, list its name in the features section.

[dependencies.gltf]
features = ["KHR_materials_unlit"]

Examples

gltf-display

Demonstrates how the glTF JSON is deserialized.

cargo run --example gltf-display path/to/asset.gltf

gltf-export

Demonstrates how glTF JSON can be built and exported using the gltf-json crate.

cargo run --example gltf-export

gltf-roundtrip

Deserializes and serializes the JSON part of a glTF asset.

cargo run --example gltf-roundtrip path/to/asset.gltf

gltf-tree

Visualises the scene heirarchy of a glTF asset, which is a strict tree of nodes.

cargo run --example gltf-tree path/to/asset.gltf

Tests

Running tests locally requires to clone the glTF-Sample-Models repository first.

git clone https://github.com/KhronosGroup/glTF-Sample-Models.git

Dependencies

~0.6–1.3MB
~30K SLoC