-
-
Notifications
You must be signed in to change notification settings - Fork 0
VoxelGrid and Voxel Model
DESKTOP-5KM6RA3\david edited this page Apr 25, 2026
·
2 revisions
This page explains the two core storage types at the center of GridForge:
-
VoxelGrid, which owns one grid's runtime state -
Voxel, which represents one mutable cell inside that grid
If GridWorld is the world coordinator, these are the types that actually hold the world data.
VoxelGrid is the runtime container for one snapped, registered region of world space.
It owns:
- the grid's bounds and dimensions
- the 3D voxel array
- the scan-cell overlay
- neighboring grid links
- per-grid occupancy and obstacle summary state
- per-grid versioning
When a grid is initialized, VoxelGrid.Initialize(...):
- stores identity and configuration
- computes dimensions from snapped bounds and world voxel size
- generates scan cells and voxels
Voxel is the actual cell model.
A voxel carries:
-
WorldIndexandIndex WorldPositionScanCellKey-
ObstacleTrackerandObstacleCount OccupantCount- partition storage through
PartitionProvider<IVoxelPartition> - boundary awareness
- cached neighbors
CachedGridVersion
Neighbor handling spans both VoxelGrid and Voxel.
-
VoxelGrid.Neighborsstores neighboring grid ids bySpatialDirection -
Voxelexposes directional neighbor lookup throughTryGetNeighborFromDirection(...)andGetNeighbors(...)
If a local voxel lookup fails at the edge of a grid, the voxel resolves the matching world-space neighbor through its owning world.
Both grids and voxels are pooled, so reset behavior is part of the architecture.
The architecture depends on reset being thorough because reused pooled objects come back through the same types later.