pub struct Selection { /* private fields */ }Expand description
Which lights hold the atlas’s light tiles, and its memory of last frame.
Topic 18’s 2026-08-13 rule, whole: eligible lights are ranked by projected screen influence, ties break by index so a frame’s answer does not depend on the order a caller happened to build the list in, they take slots and runs of tiles in that order until either budget runs out, and an incumbent keeps what it holds until a challenger clearly beats it.
A light that gets no tiles still lights. Nothing here removes a light from the frame; it decides which of them also occlude. A light can miss out two ways — no free slot, or no free run long enough — and the second is what a scene with three point lights hits: two cubes leave less than a cube behind them, so the third point light lights without occluding while a spot ranked below it still fits in the tiles left over.
Implementations§
Source§impl Selection
impl Selection
Sourcepub fn update(&mut self, lights: &[Light], camera: &Camera)
pub fn update(&mut self, lights: &[Light], camera: &Camera)
Re-runs the selection over lights for camera.
lights is the caller’s own list and the indices below are into it; a
caller whose shader rows are offset from it — the sun is row 0 — maps
them itself.
The whole camera rather than its eye, since the priority rung: what
a light’s map covers on screen depends on the projection as well as on
the distance, and coverage is the one number both the ranking and the
tile size are decided by.
Sourcepub const fn slots(&self) -> &[Option<Assignment>; 4]
pub const fn slots(&self) -> &[Option<Assignment>; 4]
What holds each slot, in slot order.
Sourcepub fn atlas_rect(&self, slot: usize) -> TileRect
pub fn atlas_rect(&self, slot: usize) -> TileRect
Where atlas slot slot’s map was rendered, in texels — the viewport the
shadow pass sets over it.
TileRect::EMPTY for a slot no map was rendered into, and for a slot
past TILES, which is the same answer for the same reason: nothing
sampled a map there.
Sourcepub fn atlas_rects(&self) -> [[f32; 4]; 16]
pub fn atlas_rects(&self) -> [[f32; 4]; 16]
The same rectangles as the shader reads them, ready for
FrameUniforms::shadow_atlas_rect:
a scale into the atlas in xy and an offset in zw, one row per slot.