fix(portal): synchronize destination presentation state
This commit is contained in:
parent
4b1bceefbb
commit
e95f55f25b
42 changed files with 2815 additions and 288 deletions
|
|
@ -121,6 +121,7 @@ public sealed class PhysicsEngine
|
|||
public void RemoveLandblock(uint landblockId)
|
||||
{
|
||||
_landblocks.Remove(landblockId);
|
||||
ShadowObjects.DeregisterStaticOwnersForLandblock(landblockId);
|
||||
ShadowObjects.RemoveLandblock(landblockId);
|
||||
DataCache?.RemoveCellsForLandblock(landblockId); // D8: rebase cell BSP transforms on next apply
|
||||
|
||||
|
|
@ -141,6 +142,41 @@ public sealed class PhysicsEngine
|
|||
DataCache?.CellGraph.RemoveLandblock(landblockId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retire a Near landblock's indoor-cell and static-object collision layer
|
||||
/// while preserving its terrain surface and world offset for Far-tier use.
|
||||
/// The corresponding render-side demotion preserves the terrain slot too.
|
||||
/// </summary>
|
||||
public void DemoteLandblockToTerrain(uint landblockId)
|
||||
{
|
||||
uint canonical = (landblockId & 0xFFFF0000u) | 0xFFFFu;
|
||||
if (_landblocks.TryGetValue(canonical, out var landblock))
|
||||
{
|
||||
_landblocks[canonical] = landblock with
|
||||
{
|
||||
Cells = Array.Empty<CellSurface>(),
|
||||
Portals = Array.Empty<PortalPlane>(),
|
||||
};
|
||||
}
|
||||
|
||||
// Static footprints can flood into adjacent landblocks. Retire them by
|
||||
// logical owner before removing rows by cell prefix, otherwise a mesh
|
||||
// demoted out of view can remain as invisible collision across a seam.
|
||||
ShadowObjects.DeregisterStaticOwnersForLandblock(canonical);
|
||||
ShadowObjects.RemoveLandblock(canonical);
|
||||
DataCache?.RemoveCellsForLandblock(canonical);
|
||||
DataCache?.RemoveBuildingsForLandblock(canonical);
|
||||
DataCache?.CellGraph.RemoveEnvCellsForLandblock(canonical);
|
||||
|
||||
if (DataCache?.CellGraph is { } graph
|
||||
&& graph.CurrCell is { } current
|
||||
&& (current.Id & 0xFFFF0000u) == (canonical & 0xFFFF0000u)
|
||||
&& (current.Id & 0xFFFFu) >= 0x0100u)
|
||||
{
|
||||
graph.CurrCell = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find the landblock that contains the given world-space XY position and
|
||||
/// return its ID plus world-space origin offsets. Returns false when no
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue