Skip to main content

Module skeleton

Module skeleton 

Source
Expand description

Skeleton maths for GraphicsMesh bones.

Convention (verified against all eight skinned meshes, combining weighted geometry with rigid node geometry when comparing stored bounds):

  • stored quaternions are conjugated relative to the column-vector convention used here;
  • world = parent_world * local;
  • skinning matrix = world * inverse_bind, where inv_rotation/inv_translation is the inverse bind.

Skinned vertices are stored in a per-mesh frame; the bind-pose palette maps them to model space.

Structs§

Transform
A bone transform: a rotation and a translation.

Functions§

bind_palette
Palette for the bind pose.
inverse_bind
The inverse of a bone’s bind transform, for skinning.
local_bind
Bone-local bind transform.
palette
Skinning palette (world * inverse bind) for the given local pose.
skin_to_static
Skin 32-byte ModelSkinLayout vertices (i16x4 position /512, i16x4 texcoords, unorm8x4 normal, 4 unused bytes, unorm8x4 weights, u8x4 bone indices) with a palette into the 24-byte static ModelLayout (position, texcoords, normal, zeroed user data). Used to draw characters in a fixed pose without GPU skinning.
world_transforms
World transforms for the given local transforms (bones are stored parents-first).