Skip to main content

GridUpload

Struct GridUpload 

Source
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: u32

Shared 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

Source

pub fn total_chunks(&self) -> u32

Source

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.

Source

pub fn meta_idx_of(&self, chunk_idx: [i32; 3]) -> Option<u32>

Linear chunk index (meta_idx) for (chx, chy, chz) in the grid’s row-major bounding-box order. None if the index is outside the grid.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,