Crate kgltf[][src]

A minimal crate for loading glTF.

This crate is auto-generated from the specification’s Json Schema, so some comments may not exactly match the Rust names.

Structs

Accessor

A typed view into a bufferView. A bufferView contains raw binary data. An accessor provides a typed view into a bufferView or a subset of a bufferView similar to how WebGL’s vertexAttribPointer() defines an attribute in a buffer.

AccessorSparse

Sparse storage of attributes that deviate from their initialization value.

AccessorSparseIndices

Index array of size count that points to those accessor attributes that deviate from their initialization value. Indices must strictly increase.

AccessorSparseValues

Array of size count times number of components, storing the displaced accessor attributes pointed by indices. Substituted values must have the same componentType and number of components as the base accessor.

Animation

A keyframe animation.

AnimationChannel

Targets an animation’s sampler at a node’s property.

AnimationChannelTarget

The index of the node and TRS property to target.

AnimationSampler

Combines input and output accessors with an interpolation algorithm to define a keyframe graph (but not its target).

Asset

Metadata about the glTF asset.

Buffer

A buffer points to binary geometry, animation, or skins.

BufferView

A view into a buffer generally representing a subset of the buffer.

Camera

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

CameraOrthographic

An orthographic camera containing properties to create an orthographic projection matrix.

CameraPerspective

A perspective camera containing properties to create a perspective projection matrix.

Extension

Dictionary object with extension-specific objects.

GLB

A GLTF with all of its data included within a buffer.

GlTf

The root object for a glTF asset.

Image

Image data used to create a texture. Image can be referenced by URI or bufferView index. mimeType is required in the latter case.

Material

The material appearance of a primitive.

MaterialNormalTextureInfo

The normal map texture.

MaterialOcclusionTextureInfo

The occlusion map texture.

MaterialPbrMetallicRoughness

A set of parameter values that are used to define the metallic-roughness material model from Physically-Based Rendering (PBR) methodology. When not specified, all the default values of pbrMetallicRoughness apply.

Mesh

A set of primitives to be rendered. A node can contain one mesh. A node’s transform places the mesh in the scene.

MeshPrimitive

Geometry to be rendered with the given material.

Node

A node in the node hierarchy. When the node contains skin, all mesh.primitives must contain JOINTS_0 and WEIGHTS_0 attributes. A node can have either a matrix or any combination of translation/rotation/scale (TRS) properties. TRS properties are converted to matrices and postmultiplied in the T * R * S order to compose the transformation matrix; first the scale is applied to the vertices, then the rotation, and then the translation. If none are provided, the transform is the identity. When a node is targeted for animation (referenced by an animation.channel.target), only TRS properties may be present; matrix will not be present.

Sampler

Texture sampler properties for filtering and wrapping modes.

Scene

The root nodes of a scene.

Skin

Joints and matrices defining a skin.

Texture

A texture and its sampler.

TextureInfo

The base color texture.

Enums

AccessorComponentType

The datatype of components in the attribute.

AccessorSparseIndicesComponentType

The indices data type.

AccessorType

Specifies if the attribute is a scalar, vector, or matrix.

AnimationChannelTargetPath

The name of the node’s TRS property to modify, or the “weights” of the Morph Targets it instantiates. For the “translation” property, the values that are provided by the sampler are the translation along the x, y, and z axes. For the “rotation” property, the values are a quaternion in the order (x, y, z, w), where w is the scalar. For the “scale” property, the values are the scaling factors along the x, y, and z axes.

AnimationSamplerInterpolation

Interpolation algorithm.

BufferViewTarget

The target that the GPU buffer should be bound to.

CameraType

Specifies if the camera uses a perspective or orthographic projection.

GLBError
ImageMimeType

The image’s MIME type. Required if bufferView is defined.

MaterialAlphaMode

The alpha rendering mode of the material.

MeshPrimitiveMode

The type of primitives to render.

SamplerMagFilter

Magnification filter.

SamplerMinFilter

Minification filter.

SamplerWrapS

s wrapping mode.

SamplerWrapT

t wrapping mode.

Traits

FromJson
ToJson