Skip to main content

Module skin

Module skin 

Source
Expand description

GPU skinning shared by the viewer and the game: the ModelSkinLayout vertex attributes, the bone palette uniform and its WGSL. The original’s NormalSkin_*vs programs blend four bones from a palette of transforms (tc_transform, c41, four rows per bone).

Constants§

MAX_BONES
Bones per palette: the original’s tc_transform is 208 constants from c41, four per bone (NormalSkin_vs), so 52; the largest shipped skeleton has 22, a mod’s may have more.
PALETTE_BYTES
Bytes of one palette (MAX_BONES column-major 4x4 matrices); a multiple of 256 so palettes can be addressed with dynamic uniform offsets.
SKIN_WGSL
WGSL for the palette at @group(2) @binding(0) and the four-bone blend.

Functions§

palette_matrices
The palette as MAX_BONES matrices (identity padded; extra bones are dropped with a warning).
skin_layout
The palette’s bind group layout; dynamic palettes are addressed per instance by offset.
skinned_attributes
ModelSkinLayout (32-byte vertices): i16x4 position (/512), i16x4 texcoords, unorm8x4 normal, 4 unused bytes, unorm8x4 weights, u8x4 bone indices, at shader locations 0..4.