23 Rendering: Column Rendering
This tour covers DOOM’s column rendering routines, showing the prototypes in r_draw.h
, function pointers in r_main.h
, and implementations of R_DrawColumn
, R_DrawFuzzColumn
, and R_DrawTranslatedColumn
.
File: linuxdoom-1.10/r_draw.h
Lines: 46–57
> r_draw.h declares the core column‐drawing interfaces. Here are the primary prototypes for wall column rendering and effects.
File: linuxdoom-1.10/r_draw.h
Lines: 83–87
> r_draw.h provides span-drawing functions for floors and ceilings.
File: linuxdoom-1.10/r_main.h
Lines: 98–105
> Function pointers used to select different column and span rendering effects at runtime.
Now we’ll look at R_DrawColumn
, which draws vertical slices of wall textures to the screen.
File: linuxdoom-1.10/r_draw.h
Line: 32
> r_draw.h declares dc_colormap, which maps texture indices through a palette for shading.
File: linuxdoom-1.10/r_draw.h
Line: 33
> R_DrawColumn draws a vertical slice of a wall texture.
File: linuxdoom-1.10/r_draw.h
Line: 34
> Checks that the column position (dc_x) and height range (dc_yl to dc_yh) stay within screen bounds.
File: linuxdoom-1.10/r_draw.h
Line: 35
> Sets up DDA (Digital Differential Analyzer) scaling parameters for texture mapping.
File: linuxdoom-1.10/r_draw.h
Line: 37
> Each iteration maps a texture sample to a screen pixel, advancing vertically by SCREENWIDTH.
File: linuxdoom-1.10/r_draw.h
Line: 40
> The byte pointer dc_source
points to the first texel of the texture column to be sampled.
File: linuxdoom-1.10/r_draw.c
Lines: 105–113
> R_DrawColumn begins by computing the number of pixels to draw and early‐exiting on zero height.
File: linuxdoom-1.10/r_draw.c
Lines: 118–126
> The fuzzoffset table and fuzzpos counter work together to create the spectre/invisibility effect by shifting column pixels horizontally during drawing.
File: linuxdoom-1.10/r_draw.c
Lines: 132–137
> R_DrawFuzzColumn creates the shimmering effect seen when taking damage.
File: linuxdoom-1.10/r_draw.c
Lines: 138–147
> The loop samples nearby pixels using fuzzoffset[] and applies colormap 6 for transparency.
File: linuxdoom-1.10/r_main.c
Line: 704
> R_DrawTranslatedColumn remaps texture color indices via a translation table before lighting.
File: linuxdoom-1.10/r_plane.c
Lines: 414–415
> The initial setup matches R_DrawColumn’s pattern.
Each pixel passes through
dc_translation
before the lighting colormap is applied.
Show
dc_translation
: pointer to color translation table.
File: linuxdoom-1.10/r_draw.c
Lines: 263–265
> dc_translation is a pointer to a color remap table used by R_DrawTranslatedColumn to transform texture colors during rendering.
File: linuxdoom-1.10/r_draw.c
Lines: 285–294
> When MF_TRANSLATION is set, colfunc is assigned R_DrawTranslatedColumn to render sprites with different color ramps.
In hi-detail mode, the renderer assigns
R_DrawTranslatedColumn
totranscolfunc
.
File: linuxdoom-1.10/r_draw.c
Lines: 385–394
> The colfunc, fuzzcolfunc, transcolfunc, and spanfunc pointers dispatch DOOM’s column rendering routines at runtime.