Table of Contents

Struct SpatialFieldInfo

Namespace
Typhon.Engine
Assembly
Typhon.Engine.dll

Describes the spatial index field on a component: its layout within the component data, the type of spatial bounds, and the index parameters (margin, cell size). Stored in SpatialIndexState and set at component registration time.

public readonly struct SpatialFieldInfo
Inherited Members

Constructors

SpatialFieldInfo(int, int, SpatialFieldType, float, float, SpatialMode, uint)

Describe a component's spatial bounds field and its index parameters.

public SpatialFieldInfo(int fieldOffset, int fieldSize, SpatialFieldType fieldType, float margin, float cellSize, SpatialMode mode = SpatialMode.Dynamic, uint category = 4294967295)

Parameters

fieldOffset int

Byte offset of the bounds field within the component data.

fieldSize int

Size, in bytes, of the bounds field.

fieldType SpatialFieldType

Kind of bounds stored (dimensionality + precision).

margin float

Fat-AABB margin in world units added around tight bounds.

cellSize float

Grid cell size in world units; InverseCellSize is derived from it.

mode SpatialMode

Index mode: Dynamic (default) or Static.

category uint

Archetype-level category bitmask; defaults to MaxValue (matches any query mask).

Fields

Category

Archetype-level category bitmask from Category. Used by the per-cell cluster spatial broadphase to skip clusters whose category does not intersect the query's category mask. Defaults to MaxValue so archetypes without an explicit category remain queryable with any mask. Issue #230 Phase 3.

public readonly uint Category

Field Value

uint

CellSize

Grid cell size, in world units, used to bucket this field's entities.

public readonly float CellSize

Field Value

float

FieldOffset

Byte offset of the spatial bounds field within the component's data.

public readonly int FieldOffset

Field Value

int

FieldSize

Size, in bytes, of the spatial bounds field.

public readonly int FieldSize

Field Value

int

FieldType

Kind of spatial bounds stored in the field (dimensionality + precision).

public readonly SpatialFieldType FieldType

Field Value

SpatialFieldType

InverseCellSize

Precomputed 1 / CellSize, or 0 when CellSize is not positive.

public readonly float InverseCellSize

Field Value

float

Margin

Fat-AABB margin, in world units, added around an entity's tight bounds so small movements don't force an index update.

public readonly float Margin

Field Value

float

Mode

Whether the field is indexed as Dynamic (moving entities) or Static.

public readonly SpatialMode Mode

Field Value

SpatialMode

Properties

IsSphere

Returns true if this field type stores a bounding sphere (requires AABB conversion at tree update time).

public bool IsSphere { get; }

Property Value

bool

Methods

ToVariant()

Map this field type to the corresponding R-Tree variant (dimensionality + precision).

public SpatialVariant ToVariant()

Returns

SpatialVariant