Skip to main content

Module render

Module render 

Source
Expand description

Scene-level rendering — drives roxlap_core::opticast::opticast across the grids of a Scene.

Two entry points:

  • render_scene_composed (recommended for multi-grid scenes): per grid, allocates a temporary framebuffer + zbuffer, runs opticast into the temp, then merges into the shared output via per-pixel min-z. Correctly composites overlapping grid output.
  • render_scene (single-grid trusting caller): writes every grid directly into the shared rasterizer. For single-grid scenes this matches a direct opticast call byte-for-byte; for multi-grid it’s last-grid-wins (sky writes from grid B overwrite grid A’s hits). Useful for tests / single-grid sanity checks.

§S4B.2.e: Approach B multi-chunk dispatch

Both APIs route per-grid rendering through crate::Grid::chunk_xy_backingroxlap_core::ChunkGridroxlap_core::GridView::from_chunk_gridopticast. opticast’s prelude looks up the camera’s chunk via roxlap_core::GridView::chunk_at_xy; the grouscan column-step swaps the active per-chunk (slab_buf, column_offsets) when rays cross a chunk-XY boundary. The combined-world stitch (Approach C, S4.0..S4.2) is no longer in the render path — the lighting bake still uses it until S4B.4 lands a per-chunk bake.

Per-grid rotation (S5) and per-grid LOD (S6) plug in at the same dispatch point: rotate the world camera into grid-local before the chunk-grid lookup, then dispatch coarse / fine / billboard based on grid-camera distance.

Enums§

RenderOutcome
Outcome of a render_scene / render_scene_composed call.

Functions§

compose_into
Per-pixel “min-z wins” merge of (temp_fb, temp_zb) into (shared_fb, shared_zb).
render_scene
Render every grid in scene directly into (fb, zb) — no per-grid temp buffer, no compose merge. For multi-grid scenes this is last-grid-wins (later grids’ opticast writes overwrite earlier grids’ pixels indiscriminately, including sky), so it’s only correct for single-grid scenes.
render_scene_composed
Render every grid in scene with per-grid temporary buffers + z-buffer composition. The canonical multi-grid scene render path.