pub struct ClusterConfig {
pub cell_pixels: u32,
pub z_slices: u32,
pub max_clusters: u32,
pub first_slice_depth: f32,
pub far: f32,
}Expand description
How a frame’s view is divided into cells.
Fields§
§cell_pixels: u32The target pixels one cell covers along x and y.
z_slices: u32How many slices the view’s depth is cut into.
max_clusters: u32The most cells the grid may hold, whatever the target size.
A finer grid costs only memory and CPU time — a fragment reads one cell however fine the grid is — but the whole grid is uploaded every frame, so it is bounded.
first_slice_depth: f32The end of the first depth slice.
This is a scene-scale choice, not the camera’s near plane. The first slice absorbs everything nearer; the remaining slices divide the rest of the range logarithmically under a perspective projection.
far: f32The farthest depth the slices span.
Implementations§
Source§impl ClusterConfig
impl ClusterConfig
Sourcepub const DEFAULT: Self
pub const DEFAULT: Self
Cells of about 128 pixels, 8 depth slices, at most 4096 cells. The first slice ends at 5 world units and the range ends at 1000.
Both ends are fixed so the grid does not depend on which lights happen to be present: a light-only range cannot match the visible surfaces it did not measure. A light nearer than the first slice’s end lands in that slice, which is where a fragment that near looks it up too.
Sourcepub fn dims(&self, size: (u32, u32)) -> [u32; 3]
pub fn dims(&self, size: (u32, u32)) -> [u32; 3]
The grid this configuration gives a size-pixel target.
The x and y counts come from the target size, then shrink together until
the grid fits Self::max_clusters, so the cells stay roughly square and
the grid follows the target’s aspect. Depth keeps its slice count, which
is what a caller sets for the depth range it cares about.
Trait Implementations§
Source§impl Clone for ClusterConfig
impl Clone for ClusterConfig
impl Copy for ClusterConfig
Source§impl Debug for ClusterConfig
impl Debug for ClusterConfig
Source§impl PartialEq for ClusterConfig
impl PartialEq for ClusterConfig
impl StructuralPartialEq for ClusterConfig
Auto Trait Implementations§
impl Forget for ClusterConfig
impl Freeze for ClusterConfig
impl RefUnwindSafe for ClusterConfig
impl Send for ClusterConfig
impl Sync for ClusterConfig
impl Unpin for ClusterConfig
impl UnsafeUnpin for ClusterConfig
impl UnwindSafe for ClusterConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more