pub struct BrickCache { /* private fields */ }Expand description
Persistent, cross-frame brick occupancy cache (Substage DDA.7
perf). Keyed by (chunk x, y, z, mip) with the chunk’s edit
version; an entry is reused until its chunk’s version changes, so a
static / streamed-once world pays zero brick-build cost after the
first frame (the per-frame rebuild was the dominant DDA cost).
Owned by the caller across frames (the scene’s Grid), populated
single-threaded via Self::ensure, then borrowed immutably by the
parallel render bands.
Implementations§
Source§impl BrickCache
impl BrickCache
Sourcepub fn ensure(
&mut self,
chunk: [i32; 3],
mip: u32,
version: u64,
view: &GridView<'_>,
)
pub fn ensure( &mut self, chunk: [i32; 3], mip: u32, version: u64, view: &GridView<'_>, )
Ensure a current mip-mip brick map exists for chunk (built
from view); rebuilds only when the cached version differs.
Sourcepub fn retain_chunks(&mut self, keep: impl Fn([i32; 3]) -> bool)
pub fn retain_chunks(&mut self, keep: impl Fn([i32; 3]) -> bool)
Drop cached entries whose chunk fails keep — bounds memory as
streaming evicts chunks. Called once per frame by the scene.
Sourcepub fn brick_occupied_at(
&self,
chunk: [i32; 3],
mip: u32,
cell: [i32; 3],
) -> Option<bool>
pub fn brick_occupied_at( &self, chunk: [i32; 3], mip: u32, cell: [i32; 3], ) -> Option<bool>
PF.9 — occupancy of the BRICK³ block containing chunk-local
mip-mip cell cell of chunk. None when no map is cached for
that (chunk, mip) — the caller must fall back to dense stepping.
Some(false) guarantees the whole 8³ block holds no solid voxel,
so an external shadow march may skip it wholesale.
Sourcepub fn super_occupied_at(
&self,
chunk: [i32; 3],
mip: u32,
cell: [i32; 3],
) -> Option<bool>
pub fn super_occupied_at( &self, chunk: [i32; 3], mip: u32, cell: [i32; 3], ) -> Option<bool>
PF.9 — like Self::brick_occupied_at for the SUPER³ (64³ at
mip 0) super-brick level.
Trait Implementations§
Source§impl Debug for BrickCache
impl Debug for BrickCache
Source§impl Default for BrickCache
impl Default for BrickCache
Source§fn default() -> BrickCache
fn default() -> BrickCache
Auto Trait Implementations§
impl Freeze for BrickCache
impl RefUnwindSafe for BrickCache
impl Send for BrickCache
impl Sync for BrickCache
impl Unpin for BrickCache
impl UnsafeUnpin for BrickCache
impl UnwindSafe for BrickCache
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
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