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.
| Argument | Type | Required | Description |
|---|---|---|---|
boneData | BoneData | Yes | Plain 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.
| Argument | Type | Required | Description |
|---|---|---|---|
clip | Yes | The animation clip to evaluate. | |
time | Yes | The current time. |
extend
Method used to decorate a given object (publicAPI+model) with vtkArmature characteristics.
| Argument | Type | Required | Description |
|---|---|---|---|
publicAPI | Yes | object on which methods will be bounds (public) | |
model | Yes | object on which data structure will be bounds (protected) | |
initialValues | IArmatureInitialValues | No | (default: {}) |
getBone
Get a bone by index.
| Argument | Type | Required | Description |
|---|---|---|---|
index | number | Yes | The bone index. |
getBoneIndexByName
Get a bone index by name.
| Argument | Type | Required | Description |
|---|---|---|---|
name | string | Yes | The bone name. |
getBoneName
Get the name of a bone by index.
| Argument | Type | Required | Description |
|---|---|---|---|
index | number | Yes | The bone index. |
getBones
Get all bones in the skeleton.
getChildrenIndices
Get all children indices for a bone.
| Argument | Type | Required | Description |
|---|---|---|---|
index | number | Yes | The bone index. |
getInverseBindMatrix
Get the inverse bind matrix for a bone.
| Argument | Type | Required | Description |
|---|---|---|---|
boneIndex | number | Yes | The bone index. |
getLocalMatrices
Get the raw local matrices array (boneCount * 16 floats).
getLocalMatrix
Get the local matrix for a bone.
| Argument | Type | Required | Description |
|---|---|---|---|
boneIndex | number | Yes | The bone index. |
getLocalRestMatrix
Compose the local rest matrix from TRS for a bone.
| Argument | Type | Required | Description |
|---|---|---|---|
boneIndex | number | Yes | The bone index. |
getLocalRestRotation
Get the local rest rotation for a bone (quaternion [x, y, z, w]).
| Argument | Type | Required | Description |
|---|---|---|---|
boneIndex | number | Yes | The bone index. |
getLocalRestScale
Get the local rest scale for a bone.
| Argument | Type | Required | Description |
|---|---|---|---|
boneIndex | number | Yes | The bone index. |
getLocalRestTranslation
Get the local rest translation for a bone.
| Argument | Type | Required | Description |
|---|---|---|---|
boneIndex | number | Yes | The bone index. |
getNodeId
Get the node ID for a bone.
| Argument | Type | Required | Description |
|---|---|---|---|
boneIndex | number | Yes | The bone index. |
getNumberOfBones
Get the number of bones in the skeleton.
getParentIndex
Get the parent index for a bone.
| Argument | Type | Required | Description |
|---|---|---|---|
index | number | Yes | The 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.
| Argument | Type | Required | Description |
|---|---|---|---|
boneIndex | number | Yes | The bone index. |
getWorldMatrices
Get the raw world matrices array (boneCount * 16 floats).
getWorldMatrix
Get the world matrix for a bone.
| Argument | Type | Required | Description |
|---|---|---|---|
boneIndex | number | Yes | The bone index. |
insertBone
Insert a bone at a specific index.
| Argument | Type | Required | Description |
|---|---|---|---|
index | number | Yes | The index to insert at. |
boneData | BoneData | Yes | Plain object with bone properties. |
newInstance
Method used to create a new instance of vtkArmature.
| Argument | Type | Required | Description |
|---|---|---|---|
initialValues | IArmatureInitialValues | No | for pre-setting some of its content |
removeBone
Remove a bone at a specific index.
| Argument | Type | Required | Description |
|---|---|---|---|
index | number | Yes | The index to remove. |
setInverseBindMatrix
Set the inverse bind matrix for a bone.
| Argument | Type | Required | Description |
|---|---|---|---|
boneIndex | number | Yes | The bone index. |
matrix | Float32Array or Array[number] | Yes | The 4x4 inverse bind matrix. |
setLocalMatrix
Set the local matrix for a bone.
| Argument | Type | Required | Description |
|---|---|---|---|
boneIndex | number | Yes | The bone index. |
matrix | Float32Array or Array[number] | Yes | The 4x4 local matrix. |
setParentIndex
Set the parent index for a bone and update rootBoneIndices accordingly.
| Argument | Type | Required | Description |
|---|---|---|---|
boneIndex | number | Yes | The bone index. |
parentIndex | number | Yes | The parent bone index (-1 for root). |
setRootTransform
Set the root transform applied to root bones.
| Argument | Type | Required | Description |
|---|---|---|---|
transform | Nullable<Float32Array> | Yes | The root transform matrix (mat4). |
setSkinningMatrix
Set the skinning matrix for a bone.
| Argument | Type | Required | Description |
|---|---|---|---|
boneIndex | number | Yes | The bone index. |
matrix | Float32Array or Array[number] | Yes | The 4x4 skinning matrix. |
setWorldMatrix
Set the world matrix for a bone.
| Argument | Type | Required | Description |
|---|---|---|---|
boneIndex | number | Yes | The bone index. |
matrix | Float32Array or Array[number] | Yes | The 4x4 world matrix. |