Skip to main content

Module edit

Module edit 

Source
Expand description

Multi-chunk edit API on Grid.

Region-shape edit operations (Grid::set_voxel, Grid::set_rect, Grid::set_sphere) take grid-local voxel coordinates spanning any number of chunks. The implementation:

  1. Computes the chunk index range the operation touches.
  2. For each chunk in that range, intersects the edit region with the chunk’s voxel footprint and translates to chunk-local coordinates.
  3. Calls the corresponding roxlap_formats::edit primitive with the per-chunk slice of the edit.

Implicit-air chunks are materialised on demand via Grid::ensure_chunk when the operation inserts voxels (color = Some(_)); pure-carve operations (color = None) skip materialisation for chunks that don’t already exist — carving from already-air voxels is a no-op.

Functions§

voxel_at
Convenience: forward a GridLocalPos-style decomposition back to voxel_global for callers that already hold one. Stays here rather than in crate::addr because it’s only useful in the edit-API call shape.