Skip to content

Armature ​

Introduction ​

vtkArmature manages a hierarchical collection of bones that define a skeletal rig for animation. It stores per bone local, world, and skinning matrices directly, provides methods for traversing the bone hierarchy, computing world-space transforms from local matrices, and producing skinning matrices used by GPU rendering backends.

Methods ​

addBone ​

Add a bone to the skeleton.

ArgumentTypeRequiredDescription
boneDataBoneDataYesPlain object with bone properties.

computeSkinningMatrices ​

Compute skinning matrices. skinningMatrix[i] = worldMatrix[i] * inverseBindMatrix[i]. Uses internal worldMatrices and writes to internal skinningMatrices.

computeWorldMatrices ​

Compute world matrices from local matrices by traversing the bone hierarchy. Uses internal localMatrices and writes to internal worldMatrices.

evaluatePose ​

Evaluate animation clip at a given time: compose TRS per bone from rest pose overridden by animated tracks, then compute world and skinning matrices.

ArgumentTypeRequiredDescription
clipYesThe animation clip to evaluate.
timeYesThe current time.

extend ​

Method used to decorate a given object (publicAPI+model) with vtkArmature characteristics.

ArgumentTypeRequiredDescription
publicAPIYesobject on which methods will be bounds (public)
modelYesobject on which data structure will be bounds (protected)
initialValuesIArmatureInitialValuesNo(default: {})

getBone ​

Get a bone by index.

ArgumentTypeRequiredDescription
indexnumberYesThe bone index.

getBoneIndexByName ​

Get a bone index by name.

ArgumentTypeRequiredDescription
namestringYesThe bone name.

getBoneName ​

Get the name of a bone by index.

ArgumentTypeRequiredDescription
indexnumberYesThe bone index.

getBones ​

Get all bones in the skeleton.

getChildrenIndices ​

Get all children indices for a bone.

ArgumentTypeRequiredDescription
indexnumberYesThe bone index.

getInverseBindMatrix ​

Get the inverse bind matrix for a bone.

ArgumentTypeRequiredDescription
boneIndexnumberYesThe bone index.

getLocalMatrices ​

Get the raw local matrices array (boneCount * 16 floats).

getLocalMatrix ​

Get the local matrix for a bone.

ArgumentTypeRequiredDescription
boneIndexnumberYesThe bone index.

getLocalRestMatrix ​

Compose the local rest matrix from TRS for a bone.

ArgumentTypeRequiredDescription
boneIndexnumberYesThe bone index.

getLocalRestRotation ​

Get the local rest rotation for a bone (quaternion [x, y, z, w]).

ArgumentTypeRequiredDescription
boneIndexnumberYesThe bone index.

getLocalRestScale ​

Get the local rest scale for a bone.

ArgumentTypeRequiredDescription
boneIndexnumberYesThe bone index.

getLocalRestTranslation ​

Get the local rest translation for a bone.

ArgumentTypeRequiredDescription
boneIndexnumberYesThe bone index.

getNodeId ​

Get the node ID for a bone.

ArgumentTypeRequiredDescription
boneIndexnumberYesThe bone index.

getNumberOfBones ​

Get the number of bones in the skeleton.

getParentIndex ​

Get the parent index for a bone.

ArgumentTypeRequiredDescription
indexnumberYesThe bone index.

getRootBoneIndices ​

Get all root bone indices (bones with parentIndex === -1).

getRootTransform ​

Get the root transform applied to root bones.

getSkinningMatrices ​

Get the raw skinning matrices array (boneCount * 16 floats).

getSkinningMatrix ​

Get the skinning matrix for a bone.

ArgumentTypeRequiredDescription
boneIndexnumberYesThe bone index.

getWorldMatrices ​

Get the raw world matrices array (boneCount * 16 floats).

getWorldMatrix ​

Get the world matrix for a bone.

ArgumentTypeRequiredDescription
boneIndexnumberYesThe bone index.

insertBone ​

Insert a bone at a specific index.

ArgumentTypeRequiredDescription
indexnumberYesThe index to insert at.
boneDataBoneDataYesPlain object with bone properties.

newInstance ​

Method used to create a new instance of vtkArmature.

ArgumentTypeRequiredDescription
initialValuesIArmatureInitialValuesNofor pre-setting some of its content

removeBone ​

Remove a bone at a specific index.

ArgumentTypeRequiredDescription
indexnumberYesThe index to remove.

setInverseBindMatrix ​

Set the inverse bind matrix for a bone.

ArgumentTypeRequiredDescription
boneIndexnumberYesThe bone index.
matrixFloat32Array or Array[number]YesThe 4x4 inverse bind matrix.

setLocalMatrix ​

Set the local matrix for a bone.

ArgumentTypeRequiredDescription
boneIndexnumberYesThe bone index.
matrixFloat32Array or Array[number]YesThe 4x4 local matrix.

setParentIndex ​

Set the parent index for a bone and update rootBoneIndices accordingly.

ArgumentTypeRequiredDescription
boneIndexnumberYesThe bone index.
parentIndexnumberYesThe parent bone index (-1 for root).

setRootTransform ​

Set the root transform applied to root bones.

ArgumentTypeRequiredDescription
transformNullable<Float32Array>YesThe root transform matrix (mat4).

setSkinningMatrix ​

Set the skinning matrix for a bone.

ArgumentTypeRequiredDescription
boneIndexnumberYesThe bone index.
matrixFloat32Array or Array[number]YesThe 4x4 skinning matrix.

setWorldMatrix ​

Set the world matrix for a bone.

ArgumentTypeRequiredDescription
boneIndexnumberYesThe bone index.
matrixFloat32Array or Array[number]YesThe 4x4 world matrix.