Skip to main content

Module gline

Module gline 

Source
Expand description

gline per-scanline frustum setup — port of the projection math at the top of voxlap5.c:gline (lines 1146..1175).

For each screen-space scanline (x0, y0) → (x1, y1), this computes the 2D voxel-grid frustum the per-ray voxel-column walker (grouscanasm / R4.3c+) consumes:

  • World-space ray endpoints (vd0, vd1, vz0, vx1, vy1, vz1): the screen scanline projected through the camera basis to world coordinates.
  • gixy[2]: voxel-column step (±1 along x, ±vsid along y) in the direction the ray travels. voxlap stores byte-strides into sptr[VSID*VSID]; our port uses logical column-index units.
  • gpz[2]: distance to the next voxel-grid line along x and y from the current ray position, scaled by PREC. The lane with the smaller gpz is the leading lane — that’s the axis whose voxel boundary comes up next.
  • gdz[2]: per-column-step delta added to gpz after a column advance. Constant per scanline.

The trailing pieces of voxlap’s gline (cf[128] seeding, gxmax edge clipping, sky-radar bookkeeping, the grouscanasm_scalar call) land in R4.3c+; this module only ships the projection math because it’s hand-verifiable in isolation.

Structs§

GlineFrustum
Per-scanline frustum data — what the grouscan ray-walker consumes (R4.3c+). Values match voxlap’s globals one-to-one.

Functions§

derive_gline_frustum
Compute the per-scanline frustum.