render3d: the fog wall culls on the CPU - nothing past it costs a draw, a vertex or a caster

cam_sphere_visible refuses a sphere wholly past the wall (terrain patches, scatter cells, stream
chunks, grass tiles, water), actors past it are skipped for draws, casters and outlines, the grass
reach and the streams' generate-and-gather reach end at it, and the card shadows cast only from
the wall's share of a layer (fog_casters.ludic, rebuilt every 4 m). r3d_beyond_fog is exported for
the game to skip animating what will not be drawn. Render-only: no query of the ground or the world
changes, and off is the old frame (0 pixels over 8 against 160ce96, twice per side).

Draws per frame at the overlook: 2757 off, 1104 at 175 m, 484 at 30 m.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 15:38:00 +03:00
parent b9f9cb8495
commit 2ce2d997be
9 changed files with 88 additions and 11 deletions

View file

@ -54,7 +54,10 @@ const R3D_FOG_MARGIN: float = 8.0
export function r3d_fog_wall(render3d_st: mut Render3dState, dist: float) -> void {
var d = dist
if d < 0.0 { d = 0.0 }
if d == render3d_st.r3d_fog_wall { return }
render3d_st.r3d_fog_wall = d
# every layer and stream re-gathers for the new reach
render3d_st.sc_view_gen += 1
cam_update(render3d_st)
}
# how far anything is drawn: the fog wall and a margin, or `far` (0: no limit of its own) without one