Skip to main content

Module drawtile

Module drawtile 

Source
Expand description

Voxlap’s 2D textured-quad blit primitive — drawtile (voxlap5.c:6954). Used for HUD overlays, weapon sprites, and the oracle’s tile_* validation poses.

Three rendering paths fork on (black ^ white) & 0xff000000 (the two endpoints’ alpha bytes) and on the zoom factors:

  1. Ignore-alpha, 0.5× zoom (xz == yz == 32768): each output pixel is the byte-wise rounded average of a 2×2 source block. Voxlap’s MMX pavgb-chain fast path.
  2. Ignore-alpha, arbitrary zoom: nearest-neighbour texture stretch — output pixel = source[uu, vv] with Q16.16 fixed-point u/v.
  3. Alpha modulate + blend: per-channel (W - B)/256 + B modulation between the black / white endpoint colours, then alpha-blended onto the destination via the modulated alpha byte. Includes voxlap’s transparent-skip / opaque-passthrough trichotomy.

Tile pixels are voxlap’s BGRA i32 layout (low byte = blue, top byte = brightness/alpha) — same convention as the rest of the engine. The destination framebuffer is row-major u32 with pitch_pixels stride.

Functions§

drawtile
Render one screen-space tile blit. Mirror of voxlap5.c:6954-7082.