Struct ClusterSpatialAabb
Per-cluster tight AABB plus category mask, used by the per-cell cluster spatial index (issue #230).
One instance per spatially-active cluster, indexed by clusterChunkId. Stored in-memory only on
Typhon.Engine.Internals.ArchetypeClusterState and rebuilt at startup via RebuildClusterAabbs from
entity positions (Q2/Q6 transient-state decision).
public struct ClusterSpatialAabb
- Inherited Members
Remarks
Storage shape. 28 bytes: six f32 bounds components (XYZ min/max) plus a 4-byte category mask. 2D archetypes leave MinZ/MaxZ at the Empty sentinel (+inf/-inf); 2D queries use an infinite Z range which trivially passes the Z overlap test, so 2D clusters match correctly. 3D archetypes populate all six bounds. The unified 3D storage adds ~8 bytes per cluster versus a 2D-only design, in exchange for a single cluster-index code path that handles both tiers. f64 variants (AABB2D/AABB3D) are deferred to a follow-up sub-issue of #228.
The CategoryMask is the OR of all entity category masks in the cluster — it lets the per-cell broadphase skip entire clusters when the query's category mask does not intersect. Maintained incrementally on spawn; tightened on the next full recompute pass at the tick fence.
Fields
CategoryMask
OR of every entity category mask in the cluster. Lets the per-cell broadphase skip the whole cluster when the query's category mask does not intersect.
public uint CategoryMask
Field Value
MaxX
Maximum X bound of the cluster's tight AABB, in world units.
public float MaxX
Field Value
MaxY
Maximum Y bound of the cluster's tight AABB, in world units.
public float MaxY
Field Value
MaxZ
Maximum Z bound of the cluster's tight AABB, in world units. Left at the Empty sentinel (-inf) for 2D archetypes.
public float MaxZ
Field Value
MinX
Minimum X bound of the cluster's tight AABB, in world units.
public float MinX
Field Value
MinY
Minimum Y bound of the cluster's tight AABB, in world units.
public float MinY
Field Value
MinZ
Minimum Z bound of the cluster's tight AABB, in world units. Left at the Empty sentinel (+inf) for 2D archetypes.
public float MinZ
Field Value
Properties
Empty
Create an empty AABB suitable as the seed for incremental unions (min = +inf, max = -inf on all axes).
public static ClusterSpatialAabb Empty { get; }
Property Value
Methods
Union2F(float, float, float, float, uint)
Union a 2D entity's tight AABB + category mask into this cluster AABB in place. Leaves MinZ/MaxZ at their initial values; 2D cluster archetypes never populate Z bounds, and 2D queries against those clusters use an infinite Z range that trivially passes the Z overlap test regardless of the stored Z values.
public void Union2F(float entityMinX, float entityMinY, float entityMaxX, float entityMaxY, uint entityCategoryMask)
Parameters
Union3F(float, float, float, float, float, float, uint)
Union a 3D entity's tight AABB + category mask into this cluster AABB in place. Updates all six bounds components.
public void Union3F(float entityMinX, float entityMinY, float entityMinZ, float entityMaxX, float entityMaxY, float entityMaxZ, uint entityCategoryMask)