Expand description
A simple glTF 2.0 reader using serde and serde_json. This crate is pretty much a 1:1
implementation of the glTF schema in Rust. It is purely structural and performs no validation
of the glTF asset.
The structures try to borrow from the glTF JSON as much as possible. While not zero-copy, this
crate is way more memory efficient than other glTF readers. You can still obtain an owned copy
of any structure through into_owned methods, though.
All of the types implement Deserialize, which in theory allow them to be deserialized from
any format. However, the only supported format intended is JSON through serde_json -
anything else has no guarantees of working.
You can easily parse a glTF JSON string with Root::from_str, which is just a wrapper around
serde_json::from_str.
§no-std
This is a no-std crate. It does, however, still require alloc.
Re-exports§
pub use serde_json;
Modules§
- json
- JSON types that show up in the parsed glTF structure.
Structs§
- Accessor
- A typed view into a buffer view that contains raw binary data.
- Alpha
Mode - The alpha rendering mode of a material.
- Animation
- A keyframe animation.
- Animation
Sampler - An animation sampler combines timestamps with a sequence of output values and defines an interpolation algorithm.
- Asset
- Metadata about a glTF asset.
- Attribute
- A vertex attribute semantic.
- Buffer
- A buffer points to binary geometry, animation, or skins.
- Buffer
View - A view into a buffer generally representing a subset of the buffer.
- Buffer
View Target - A hint of the intended GPU buffer type to use with a buffer view.
- Camera
- A camera’s projection.
- Camera
Type - Type of camera projection.
- Channel
- An animation channel combines an animation sampler with a target property being animated.
- Channel
Target - The descriptor of an animated property.
- Component
Type - Data type of an accessor’s components.
- Element
Type - Data type of an accessor’s elements.
- Extensions
- JSON object with extension-specific objects.
- Extras
- Application-specific data.
- Filter
- Sampling filter.
- Idx
- A glTF index. Since pratically all structures in the crate have a lifetime that doesn’t matter
for this type, it’s simply set to
static- in practice, just ignore it. - Image
- Image data used to create a texture.
- Interpolation
- Interpolation algorithm.
- Material
- The material appearence of a primitive.
- Mesh
- A set of primitives to be rendered.
- Mime
Type - The image’s media type.
- Mode
- The topology type of a set primitives to render.
- Node
- A node in the node hierarchy.
- Normal
Texture Info - Reference to a normal texture.
- Occlusion
Texture Info - Reference to an occlusion texture.
- Orthographic
- An orthographic camera containing properties to create an orthographic projection matrix.
- PbrMetallic
Roughness - A set of parameter values that are used to define the metallic-roughness material model from Physically-Based Rendering (PBR) methodology.
- Perspective
- A perspective camera containing properties to create a perspective projection matrix.
- Primitive
- A set of primitives to be rendered.
- Property
- The name of a node’s TRS property to animate, or the
weightsof the Morph Targets it instantiates. - Root
- The root object of a glTF asset.
- Sampler
- Texture sampler properties for filtering and wrapping modes.
- Scene
- The root nodes of a scene.
- Skin
- Joints and matrices defining a skin.
- Sparse
- Sparse storage of accessor values that deviate from their initialization value.
- Sparse
Indices - Sparse storage of accessor values that deviate from their initialization value.
- Sparse
Values - An object pointing to a buffer view containing the deviating accessor values.
- Texture
- A texture and it’s sampler.
- Texture
Info - Reference to a texture.
- Wrap
- Wrapping mode.
Enums§
- Alpha
Mode Enum - glTF known alpha modes.
- Attribute
Enum - glTF known attribute semantics.
- Buffer
View Target Enum - glTF known targets for buffer views.
- Camera
Type Enum - glTF known types of camera projection.
- Component
Type Enum - glTF known data types of an accessor’s components.
- Element
Type Enum - glTF known data types of an accessor’s elements.
- Filter
Enum - glTF known sampling filters.
- Interpolation
Enum - glTF known interpolation algorithms.
- Mime
Type Enum - glTF known mime types.
- Mode
Enum - glTF known primitive topologies.
- Property
Enum - glTF known animation properties.
- Wrap
Enum - glTF known wrapping modes.