Crate gltf[][src]

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.

Installation

Add gltf version 0.11 to your Cargo.toml.

[dependencies.gltf]
version = "0.11"

Examples

Basic usage

Walking the node hierarchy.

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

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());

Re-exports

pub extern crate gltf_json as json;

Modules

accessor

Accessors for reading vertex attributes from buffer views.

animation

Animations, their channels, targets, and samplers.

binary

Primitives for working with binary glTF.

buffer

Buffers and buffer views.

camera

Cameras and their projections.

image

Images that may be used by textures.

iter

Iterators for walking the glTF node hierarchy.

material

Material properties of primitives.

mesh

Meshes and their primitives.

scene

The glTF node heirarchy.

skin

Mesh skinning primitives.

texture

Textures and their samplers.

Structs

Accessor

A typed view into a buffer view.

Animation

A keyframe animation.

Buffer

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

Camera

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

Document

glTF JSON wrapper.

Gltf

glTF JSON wrapper plus binary payload.

Image

Image data used to create a texture.

Material

The material appearance of a primitive.

Mesh

A set of primitives to be rendered.

Node

A node in the node hierarchy.

Primitive

Geometry to be rendered with the given material.

Scene

The root nodes of a scene.

Skin

Joints and matrices defining a skin.

Texture

A texture and its sampler.

Enums

Error

Represents a runtime error.

Semantic

Vertex attribute semantic name.

Functions

import

Import some glTF 2.0 from the file system.

Type Definitions

Attribute

Vertex attribute data.

Result

Result type for convenience.