Skip to main content

Module kfa_draw

Module kfa_draw 

Source
Expand description

KFA (animated kv6) sprite renderer — voxlap’s kfadraw (voxlap5.c:9759) plus the bone-transform helpers genperp (voxlap5.c:9546), mat0 (voxlap5.c:9568), and setlimb (voxlap5.c:9643).

A KFA sprite is a hierarchy of bones; each bone carries an optional Sprite (= one kv6 limb) plus a hinge tying it to its parent. Per frame, the user updates kfaval[i] (a 16-bit angle) for each animated bone; this module walks the hinge tree in topological order and computes each limb’s world transform from the parent’s, then dispatches the existing crate::sprite::draw_sprite per limb to rasterise the kv6 data.

Voxlap’s full animation system (animsprite + seq[] + frmval[] interpolation) is not ported here — the host drives kfaval[] directly each frame, which is enough for procedural animation. Adding animsprite later would let .kfa files with baked frame curves play back unchanged.

No oracle pose exercises KFA, so this module’s correctness gate is “looks right + tests verify the bone math”. We can tighten validation when a real .kfa asset lands.

Functions§

draw_kfa_sprite
Render an animated KFA sprite — voxlap’s kfadraw (voxlap5.c:9759). Walks the bone tree in topological order (parents first), computes each limb’s world transform from the parent’s via the per-limb setlimb walk, then dispatches crate::sprite::draw_sprite per limb to rasterise its kv6.