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 animation-curve playback (animsprite + seq[] + frmval[] interpolation) lives in roxlap_formats::kfa::KfaSprite::animsprite — call it to advance kfaval[] from a baked curve, or poke kfaval[] directly for procedural animation, then render here. The bone posing this module computes is also exposed standalone as solve_kfa_limbs for non-CPU backends (the GPU sprite pass).

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.
solve_kfa_limbs
Pose every limb of a KFA sprite — the bone-transform half of draw_kfa_sprite, without rasterising. Walks the hinge tree in topological order (parents first) and writes each limb’s world (s, h, f, p) from its parent’s via the per-limb setlimb math, reading the current KfaSprite::kfaval angles. Mirror of the transform portion of voxlap’s kfadraw (voxlap5.c:9759).