pub struct HashGrid {
pub grid_w: u32,
pub grid_h: u32,
pub cell_w: f32,
pub cell_h: f32,
}Expand description
Cell geometry on its own, for a caller that needs the grid without the buckets. A GPU model mirrors it into its step uniform so its query walks the same grid as the CPU sort.
Fields§
§grid_w: u32Cells along x.
grid_h: u32Cells along y.
cell_w: f32World width one cell spans.
cell_h: f32World height one cell spans.
Implementations§
Source§impl HashGrid
impl HashGrid
Sourcepub fn new(extent: Extent, cell_size: f32) -> Self
pub fn new(extent: Extent, cell_size: f32) -> Self
Returns the geometry that fits whole cells to the world.
A query walks in cell index space, so cells all have to span the same distance or the wrap seam gets under-covered.
A grid that would hold more than MAX_INDEX_CELLS cells is coarsened by one factor on both
axes, and a cell_size that is not positive counts as 1. This is the one place the geometry is
decided. SpatialHash and its GPU counterpart both build from here, so neither backend can walk a
grid that the other backend did not sort.