Table of Contents

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

boundsMin Vector3d

The minimum boundary of the grid.

boundsMax Vector3d

The maximum boundary of the grid.

scanCellSize int

The size of scan cells within the grid. Default is 8.

topologyKind GridTopologyKind

The topology kind used by the grid. Defaults to rectangular-prism.

topologyMetrics GridTopologyMetrics

Deterministic topology metrics. Defaults to 1x1x1 rectangular-prism cells.

storageKind GridStorageKind

The 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

int

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

int

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

GridStorageKind

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

GridTopologyKind

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

GridTopologyMetrics

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

int

ToBoundsKey()

Creates an exact identity key for this configuration's snapped bounds.

public BoundsKey ToBoundsKey()

Returns

BoundsKey

ToGridKey()

Creates an exact identity key for this configuration's snapped bounds and topology.

public GridConfigurationKey ToGridKey()

Returns

GridConfigurationKey