21 Rendering: Wall Segments and Texturing
This tour examines wall segment rendering in DOOM, covering R_StoreWallRange
, drawseg_t
data structures, and the scalelight
tables used for wall texturing.
R_StoreWallRange records a wall segment for rendering. File:
linuxdoom-1.10/r_segs.c, lines 370–377
The next group of steps examines R_StoreWallRange
, which handles storing and preparing wall segments for rendering. We’ll look at how it processes distances, textures, lighting and other properties needed for drawing walls.
Safety checks and distance computation for projection. File:
linuxdoom-1.10/r_segs.c, lines 379–390
Stores screen coordinates and texture scaling. File:
linuxdoom-1.10/r_segs.c, lines 413–421
R_StoreWallRange
is an internal function defined only in r_segs.c
with no header declaration.
Only R_RenderMaskedSegRange
is public in r_segs.h. File:
linuxdoom-1.10/r_segs.h, lines 32–36
Calculates viewpoint-relative texture bounds for single-sided walls. File:
linuxdoom-1.10/r_segs.c, lines 450–459
Texture alignment and placement using ML_DONTPEGBOTTOM. File:
linuxdoom-1.10/r_segs.c, lines 459–467
Handles masked middle textures like windows/grates. File:
linuxdoom-1.10/r_segs.c, lines 607–613
Computes horizontal texture offset from view angle. File:
linuxdoom-1.10/r_segs.c, lines 617–626
Lighting table selection based on wall orientation. File:
linuxdoom-1.10/r_segs.c, lines 641–649
The next steps examine how wall segments store their data and lighting information. We’ll look at the data structures and lighting tables used for rendering different surface orientations.
drawseg_t
structure for wall rendering segments. File:
linuxdoom-1.10/r_defs.h, lines 321–346
r_bsp.h
contains light table pointers that define lighting values for surfaces based on their orientation - horizontal, vertical, or diagonal.
Orientation-adjusted lighting using scalelight and h/vscalelight. File:
linuxdoom-1.10/r_bsp.h, lines 49–54
Wrap-up: How DOOM maps textures onto walls — using drawseg_t
, lighting tables, and careful preparation of geometry. File:
linuxdoom-1.10/r_segs.c, lines 122–134