Struct GridConfiguration
- Namespace
- GridForge.Configuration
- Assembly
- GridForge.dll
Defines the configuration parameters for a grid, including boundaries, topology, storage, and scan cell size. Used to describe grid properties before a world normalizes and registers the grid.
[MemoryPackable(GenerateType.Object)]
public readonly struct GridConfiguration : IMemoryPackable<GridConfiguration>, IMemoryPackFormatterRegister
- Implements
-
IMemoryPackable<GridConfiguration>IMemoryPackFormatterRegister
- Inherited Members
Remarks
MemoryPack GenerateType: unmanaged
FixedMathSharp.Vector3d BoundsMin
FixedMathSharp.Vector3d BoundsMax
int ScanCellSize
GridForge.Grids.Topology.GridTopologyKind TopologyKind
GridForge.Grids.Topology.GridTopologyMetrics TopologyMetrics
GridForge.Grids.Storage.GridStorageKind StorageKind
Constructors
GridConfiguration(Vector3d, Vector3d, int, GridTopologyKind, GridTopologyMetrics, GridStorageKind)
Initializes a new instance of GridConfiguration with specified bounds and scan cell size. Ensures that BoundsMin is always less than or equal to BoundsMax.
[JsonConstructor]
public GridConfiguration(Vector3d boundsMin, Vector3d boundsMax, int scanCellSize = 8, GridTopologyKind topologyKind = GridTopologyKind.RectangularPrism, GridTopologyMetrics topologyMetrics = default, GridStorageKind storageKind = GridStorageKind.Dense)
Parameters
boundsMinVector3dThe minimum boundary of the grid.
boundsMaxVector3dThe maximum boundary of the grid.
scanCellSizeintThe size of scan cells within the grid. Default is 8.
topologyKindGridTopologyKindThe topology kind used by the grid. Defaults to rectangular-prism.
topologyMetricsGridTopologyMetricsDeterministic topology metrics. Defaults to 1x1x1 rectangular-prism cells.
storageKindGridStorageKindThe physical voxel storage kind. Defaults to dense storage.
Fields
BoundsMax
The maximum boundary of the grid in world coordinates.
[JsonInclude]
[MemoryPackInclude]
public readonly Vector3d BoundsMax
Field Value
- Vector3d
BoundsMin
The minimum boundary of the grid in world coordinates.
[JsonInclude]
[MemoryPackInclude]
public readonly Vector3d BoundsMin
Field Value
- Vector3d
DefaultScanCellSize
The default size of each scan cell.
public const int DefaultScanCellSize = 8
Field Value
ScanCellSize
The size of each scan cell, determining the granularity of spatial partitioning. Customizable based on grid density and expected entity distribution.
[JsonInclude]
[MemoryPackInclude]
public readonly int ScanCellSize
Field Value
StorageKind
The physical voxel storage used by this grid. Dense storage materializes every in-bounds voxel; sparse storage materializes only explicitly configured voxels.
[JsonInclude]
[MemoryPackInclude]
public readonly GridStorageKind StorageKind
Field Value
TopologyKind
The cell topology used by this grid. Rectangular-prism grids interpret VoxelIndex as local X/Y/Z coordinates; hex-prism grids interpret it as axial Q, vertical layer, and axial R.
[JsonInclude]
[MemoryPackInclude]
public readonly GridTopologyKind TopologyKind
Field Value
TopologyMetrics
The deterministic cell geometry used by this grid's topology. Rectangular-prism metrics define cell width, layer height, and length. Hex-prism metrics define horizontal radius, layer height, and orientation.
[JsonInclude]
[MemoryPackInclude]
public readonly GridTopologyMetrics TopologyMetrics
Field Value
Properties
GridCenter
The center point of the grid's bounding volume.
[JsonIgnore]
[MemoryPackIgnore]
public Vector3d GridCenter { get; }
Property Value
- Vector3d
Methods
GetHashCode()
public override int GetHashCode()
Returns
ToBoundsKey()
Creates an exact identity key for this configuration's snapped bounds.
public BoundsKey ToBoundsKey()
Returns
ToGridKey()
Creates an exact identity key for this configuration's snapped bounds and topology.
public GridConfigurationKey ToGridKey()