Model loading · interface

GltfSkin

Skins and animations out of a glTF document, sorted into the order a palette can be resolved in.

Explained in Importing models.

interface GltfSkin
import type { GltfSkin } from '@driftengine/assets';

In depth

Its own module rather than more of gltf.ts, because the two answer different questions: that file turns primitives into geometry in world space and says in its header that the node graph does not survive it. A skin is the one thing that needs the graph, and keeping the reader for it separate is what lets the flattening stay exactly as it was for every document without one.

Nothing here depends on @driftengine/animation. The shapes it produces live in the format package, beside the chunks that carry them, so the package that writes a rig and the package that plays one meet over data rather than over each other.

Properties

NameTypeDescription
jointsreadonlyreadonly Joint[]
inverseBindreadonlyFloat32ArraySixteen floats a joint, column-major, in the same order as joints.
remapreadonlyUint16ArrayglTF joint index to sorted joint index.
More

The importer sorts parents-first because a palette is resolved in index order, and it is also the only layer that can: every index naming a joint has to move with it — a mesh's JOINTS_0 and every animation channel's target. A caller re-indexing a mesh needs this.