fix(physics): restore retail cell availability semantics
This commit is contained in:
parent
d3c0d9ec0e
commit
7716c2ee89
14 changed files with 393 additions and 62 deletions
|
|
@ -8,8 +8,8 @@ namespace AcDream.Core.World.Cells;
|
|||
/// <summary>
|
||||
/// The unified cell graph: the active, authoritative id->cell resolver and registry.
|
||||
/// Populated unconditionally from
|
||||
/// <see cref="AcDream.Core.Physics.PhysicsDataCache.CacheCellStruct"/> (before its
|
||||
/// idempotency + null-BSP guards, so BSP-less cells are included) and consumed across
|
||||
/// <see cref="AcDream.Core.Physics.PhysicsDataCache.CacheCellStruct"/> (including
|
||||
/// authored cells with null physics or containment roots) and consumed across
|
||||
/// the engine: <see cref="GetVisible"/> resolves any cell id, <see cref="CurrCell"/> is
|
||||
/// the player render/lighting root, <see cref="FindVisibleChildCell"/> resolves the
|
||||
/// 3rd-person camera cell, and <see cref="TryGetTerrainOrigin"/> supplies the block-local
|
||||
|
|
|
|||
|
|
@ -10,7 +10,11 @@ namespace AcDream.Core.World.Cells;
|
|||
/// <summary>Indoor room cell. Retail anchor: CEnvCell (acclient.h:32072).</summary>
|
||||
public sealed class EnvCell : ObjCell
|
||||
{
|
||||
/// <summary>Cell-containment BSP (retail CellStruct.CellBSP). Null => AABB fallback.</summary>
|
||||
/// <summary>
|
||||
/// Cell-containment BSP (retail CellStruct.CellBSP). A present tree with a
|
||||
/// null root is universally inside; an absent test/tooling payload uses the
|
||||
/// legacy AABB fallback.
|
||||
/// </summary>
|
||||
public CellBSPTree? ContainmentBsp { get; }
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -37,7 +41,7 @@ public sealed class EnvCell : ObjCell
|
|||
var local = Vector3.Transform(worldPoint, InverseWorldTransform);
|
||||
if (FlatContainmentBsp is not null)
|
||||
return FlatBspQuery.PointInsideCellBsp(FlatContainmentBsp, local);
|
||||
if (ContainmentBsp?.Root is not null)
|
||||
if (ContainmentBsp is not null)
|
||||
return BSPQuery.PointInsideCellBsp(ContainmentBsp.Root, local); // BSPQuery.cs:1034
|
||||
return local.X >= LocalBoundsMin.X && local.X <= LocalBoundsMax.X
|
||||
&& local.Y >= LocalBoundsMin.Y && local.Y <= LocalBoundsMax.Y
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue