17  Rendering: Overview

This walkthrough covers the main rendering pipeline entry points, core interfaces, and key data structures used in DOOM’s software renderer. You’ll see how view setup, BSP traversal, wall and floor drawing, and video I/O fit together to render each frame.


r_main.c

r_main.h


Next we’ll look at r_defs.h, which defines the data structures used by DOOM’s software renderer.

r_defs.h

Defines the foundational rendering data structures and constants: - vertex_t, line_t, seg_t, node_t: BSP geometry - drawseg_t: deferred wall segments - patch_t: column‐based textures - vissprite_t: visible objects - visplane_t: floor/ceiling spans

p_setup.c

r_plane.c


r_bsp.h

Handles BSP tree traversal for finding visible walls: - R_RenderBSPNode traverses the tree - R_ClearClipSegs and R_ClearDrawSegs manage clipping and wall segment lists

r_plane.h

r_draw.h

r_segs.c


17.0.1 R_StoreWallRange summary

Prepares a wall segment for rendering by:

  1. Computing view-relative distances/angles
  2. Setting up drawseg record
  3. Handling:
    • Single-sided walls: midtexture and silhouette
    • Double-sided walls: top/bottom textures, partial silhouettes
  4. Texture offsets & lighting
  5. Floor/ceiling visibility
  6. Sprite clipping prep

r_data.h

  • R_InitData: loads and caches WAD textures and flats
    (Lines 1–8)
  • R_InitTranslationTables: builds palette translation tables
    (Lines 40–42)

r_draw.h

  • Prototype of R_InitTranslationTables
    (Lines 96–98)

r_sky.h

  • R_InitSkyMap: rebuilds angle→sky mapping for sky drawing
    (Lines 6–9 and declaration at line 41)

v_video.h

And that’s the overview of DOOM’s renderer – from initialization through BSP traversal to final output. Each component works together in a carefully designed pipeline to create DOOM’s distinctive visuals.