Expand description
Resolution-independent software renderer for Build-style worlds.
Each screen column casts one ray through the sector/portal graph. Walls, sloped floors/ceilings and parallax skies are drawn front to back into a column-major buffer with a per-pixel depth (perpendicular distance in xy units). Sprites and masked walls are drawn afterwards, back to front, with a depth test. Columns are independent, so both passes run in parallel on all CPU cores.
Structsยง
- Camera
- ColSeg ๐
- Traces one pixelโs ray through sectors starting at (ox, oy, oz) in sector
s.dzis z units per xy unit;t_baseis the distance already travelled. One stretch of a columnโs 2D ray inside a sector (global ray parametert). - ColTrace ๐
- Sectors crossed by a columnโs ray
(ox, oy) + t (dx, dy), found lazily: only as far along as some pixel of the column actually reaches. - MaskSeg ๐
- Plane
Ctx ๐ - Renderer
- Ror
- RorLink
- Room-over-room link: looking through a floor/ceiling continues in
sector, offset by (dx, dy, dz) (Bloodโs stack / link markers). - Scene
- Shade
Luts - True-colour shade tables, one per palookup (
pal), each64 * 256entries. - SprProj ๐
- Sprite
Draw - A sprite prepared by the game for drawing (picnum already animated/rotated if desired).
- View ๐
Enumsยง
- SprKind ๐
Constantsยง
- PLANE_
PARALLAX - PLANE_
RELATIVE - PLANE_
SMOOSH - PLANE_
SWAPXY - PLANE_
XFLIP - PLANE_
YFLIP - SPR_
ALIGN_ MASK - SPR_
BLOCK - SPR_
CENTER - SPR_
FLOOR - SPR_
INVISIBLE - SPR_
ONESIDED - SPR_
TRANS - SPR_
TRANS_ REV - SPR_
WALL - SPR_
XFLIP - SPR_
YFLIP - TRANSPARENT
- VIS_
DIVISOR ๐ - Distance (xy units) times visibility per shade step.
- WALL_
ALIGN_ BOTTOM - WALL_
BLOCK - WALL_
BOTTOM_ SWAP - WALL_
MASKED - WALL_
ONEWAY - WALL_
TRANS - WALL_
TRANS_ REV - WALL_
XFLIP - WALL_
YFLIP
Functionsยง
- blend ๐
- cast_
column ๐ - draw_
masked ๐ - draw_
plane ๐ - draw_
sky ๐ - draw_
sprite_ ๐column - draw_
wall_ ๐span - linked_
room ๐ - Sectors reachable from
startthrough open walls (bounded), i.e. one โroomโ. - portal_
id - Id of the see-through plane of sector
s(floor or ceiling) in the portal mask. - project_
sprite ๐ - project_
voxel ๐ - sample_
plane ๐ - Texture colour of a floor or ceiling at world point (px, py),
tunits away. - sample_
wall ๐ - Texture colour of a wall at position
s(0..1 along it) and heightz. - sector_
vis ๐ - Visibility of sector
si: the mapโs global value scaled by the sectorโs own, stored as a signed byte offset (0 = use the global value). - shade_
index ๐ - sprite_
dims ๐ - Sprite world extents: (half width in xy, height in z, left offset texels).
- trace_
column ๐ - Colour and depth for one pixelโs ray
(ox, oy, oz) + t (dx, dy, dz)entering the linked room att_entry, using the columnโs precomputed sector list. Same result astrace_pixel, which still handles portals nested inside the linked room. - trace_
pixel ๐ - wrap ๐
- Euclidean
v mod n, using a mask whennis a power of two (almost every Build texture): an integer division per pixel was a large part of the wall/floor cost.
Type Aliasesยง
- WallHit ๐
- (wall index, position along the wall, next sectorโs (ceiling, floor) z for a portal).