Load a glTF or GLB model, the .bin and images of a .gltf from beside it
- A texture only OPAQUE materials use loads with its alpha set to 1, so the 3D pass cuts no holes in it
urlstring
LittleJS glTF Plugin
Load a glTF or GLB model, the .bin and images of a .gltf from beside it
url stringParse a model from GLB bytes or glTF JSON, fetching the buffers and images it refers to
data ArrayBuffer|ArrayBufferView|Object<string, any>|stringGLB bytes, or the glTF JSON as bytes, text or an object
baseUrl string optionalWhere the .bin and image files are, with its trailing slash; loadGLTF passes the file's folder
files Map<string, Blob> optionalThe files it refers to, by their paths, in place of fetching them
// the files of a drop, a .gltf with its .bin and textures, by their names
const files = new Map([...dataTransfer.files].map((file)=> [file.name, file]));
const gltf = [...files.values()].find((file)=> file.name.endsWith('.gltf'));
const model = await parseGLTF(await gltf.text(), '', files);GLTFChannel : Objectgltf.js:119What one channel of an animation moves, as the loader reads it
node numberThe index of the node it moves
path 'translation'|'rotation'|'scale'Which of the node's transform
interpolation 'LINEAR'|'STEP'|'CUBICSPLINE'How to go between keys
times ArrayLike<number>The key times in seconds
values ArrayLike<number>The key values, components numbers each, and an in and out tangent around each with CUBICSPLINE
components number4 for a rotation, 3 otherwise
GLTFNodeTree : Objectgltf.js:110A model's nodes as an animation needs them: each as the file has it, its parent, and where it rests
GLTFNodeTRS : Objectgltf.js:103A node's place as an animation sets it: its translation, rotation as a quaternion x y z w, and scale
translation Array<number>rotation Array<number>scale Array<number>GLTFSkin : Objectgltf.js:90What bends a skinned part: its joints, the nodes that move it, their inverse bind matrices, and for each vertex of its mesh four joints and four weights, with the place and normal each pose bends from
joints Array<number>The joints, as node numbers
inverseBind Array<Matrix4>Each joint's inverse bind matrix
vertexJoints Uint16ArrayFour joints a vertex, as places in joints
vertexWeights Float32ArrayFour weights a vertex, summing to 1
bindPoints Float32ArrayEach vertex's place as stored, x y z
bindNormals Float32ArrayEach vertex's normal as stored, x y z