pub struct GridUpload {
pub vsid: u32,
pub origin_chunk: [i32; 3],
pub chunks_dims: [u32; 3],
pub pool_dims: [u32; 3],
pub chunks: Vec<([i32; 3], ChunkUpload)>,
}Expand description
CPU-side aggregation of a grid’s chunks ready to upload. Host
(e.g. roxlap-scene-demo) builds this by iterating its
roxlap-scene::Grid and calling crate::decompress_chunk per
materialised chunk.
Fields§
§vsid: u32Shared XY extent of every chunk in voxels. Matches
roxlap-scene::CHUNK_SIZE_XY = 128.
origin_chunk: [i32; 3]Lowest chunk index present in the grid (min_chx, min_chy, min_chz). The grid’s bounding box runs from origin_chunk
to origin_chunk + chunks_dims exclusive.
chunks_dims: [u32; 3]Chunk-count along each axis = max - min + 1.
pool_dims: [u32; 3]GPU.7 slot-pool dimensions for modular chunk indexing.
Every component MUST be a power of 2. A chunk at index
(chx, chy, chz) maps to slot
(chx & (pool_dims.x - 1), chy & (pool_dims.y - 1), chz & (pool_dims.z - 1)). As long as
pool_dims_axis ≥ active_range_along_axis, no two
simultaneously-resident chunks collide. Set this larger than
chunks_dims only when streaming may install chunks at
indices outside the initial bbox.
chunks: Vec<([i32; 3], ChunkUpload)>(chunk_idx, decompressed) pairs. Chunks outside the
pool’s collision-free active range are still accepted —
modular indexing will assign them slots; the caller is
responsible for avoiding collisions with other resident
chunks.
Implementations§
Source§impl GridUpload
impl GridUpload
pub fn total_chunks(&self) -> u32
Sourcepub fn default_pool_dims(chunks_dims: [u32; 3]) -> [u32; 3]
pub fn default_pool_dims(chunks_dims: [u32; 3]) -> [u32; 3]
Default GPU.7 Self::pool_dims derived from
chunks_dims — each axis rounded up to the next power of 2.
Use this when the grid is static + slots map 1:1 to bbox
positions; for streaming grids, callers should pick a
larger pool that covers 2 × r_active_chunks + 1 along
each axis.
Auto Trait Implementations§
impl Freeze for GridUpload
impl RefUnwindSafe for GridUpload
impl Send for GridUpload
impl Sync for GridUpload
impl Unpin for GridUpload
impl UnsafeUnpin for GridUpload
impl UnwindSafe for GridUpload
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.