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.