Expand description
Clean-room KV6 sprite raycaster for the DDA backend (Substage DDA.8).
Renders KV6 sprites by per-pixel ray casting: for every screen
pixel the sprite covers, transform the camera ray into the sprite’s
local voxel space, 3D-DDA through the KV6, and depth-composite the
first solid voxel against the shared z-buffer. Clean-room (no voxlap
code), the sprite counterpart to the terrain renderer in
crate::dda.
Depth parity. Transforming the ray by the inverse sprite basis
leaves the ray parameter unchanged in world units — a hit at local
parameter t is at world point cam.pos + dir·t — so the
perpendicular depth is t · (dir·forward), exactly the convention
crate::dda writes for terrain. Sprites therefore occlude and are
occluded by DDA terrain correctly.
Shading reads the KV6 voxel’s baked brightness byte (high byte of
the packed colour) via [crate::dda::shade] — the clean-room
brightness model, not voxlap’s dir-LUT reflection shading.
Functions§
- draw_
sprite_ dda - Draw one KV6
Spriteinto(fb, zb)by per-pixel ray casting, depth-compositing against whatever the terrain pass already wrote. Returns the number of pixels written.