UNPKG

nanogl-gltf

Version:
42 lines (41 loc) 1.34 kB
import Node from './Node'; import { mat4 } from 'gl-matrix'; import Gltf2 from '../types/Gltf2'; import GltfLoader from '../io/GltfLoader'; import GltfTypes from '../types/GltfTypes'; import { IElement } from '../types/Elements'; /** * The Skin element contains the joints nodes and inverse bind matrices used to animate a mesh. */ export default class Skin implements IElement { readonly gltftype: GltfTypes.SKIN; name: undefined | string; extras: any; /** * Array of inverse bind matrices, one for each joint */ inverseBindMatrices: mat4[]; /** * Root node of the skeleton */ skeletonRoot: Node; /** * Array of all joints nodes */ joints: Node[]; /** * Parse the Skin data. * * Is async as it needs to wait for all the skeleton root and joints Nodes, * and the possible inverseBindMatrices Accessor to be created. * @param gltfLoader GLTFLoader to use * @param data Data to parse */ parse(gltfLoader: GltfLoader, data: Gltf2.ISkin): Promise<void>; /** * Compute the joints matrices, used to animate the skin. * @param skinnedNode Skinned node to compute the joints matrices for * @param jointMatrices Joints matrices to compute */ computeJoints(skinnedNode: Node, jointMatrices: mat4[]): void; }