Revert "fix(render): Phase A8 RR7.1 — stamp BuildingId on cells loaded across multiple frames"
This reverts commit a1a3e0ee3e.
This commit is contained in:
parent
9aaae02610
commit
21dc72b010
2 changed files with 11 additions and 34 deletions
|
|
@ -176,18 +176,6 @@ public sealed class CellVisibility
|
||||||
/// <summary>Full-ID lookup for O(1) neighbour resolution during BFS.</summary>
|
/// <summary>Full-ID lookup for O(1) neighbour resolution during BFS.</summary>
|
||||||
private readonly Dictionary<uint, LoadedCell> _cellLookup = new();
|
private readonly Dictionary<uint, LoadedCell> _cellLookup = new();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Phase A8 RR7.1 (2026-05-27): read-only view of every loaded cell, keyed
|
|
||||||
/// by full 32-bit cell id. Used by <see cref="Wb.BuildingLoader"/> at
|
|
||||||
/// landblock-info-arrival time so its BFS can reach cells that streamed
|
|
||||||
/// in on earlier frames (not just the per-frame drain). Without this view
|
|
||||||
/// the registry's <c>EnvCellIds</c> set was systematically short, leaving
|
|
||||||
/// <see cref="LoadedCell.BuildingId"/> unset on the cells the camera
|
|
||||||
/// actually enters — which silently routed indoor frames through the
|
|
||||||
/// outdoor branch.
|
|
||||||
/// </summary>
|
|
||||||
public IReadOnlyDictionary<uint, LoadedCell> AllLoadedCells => _cellLookup;
|
|
||||||
|
|
||||||
/// <summary>The cell the camera was in during the last <see cref="ComputeVisibility"/> call.</summary>
|
/// <summary>The cell the camera was in during the last <see cref="ComputeVisibility"/> call.</summary>
|
||||||
private LoadedCell? _lastCameraCell;
|
private LoadedCell? _lastCameraCell;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5696,21 +5696,12 @@ public sealed class GameWindow : IDisposable
|
||||||
_terrain.AddLandblockWithMesh(lb.LandblockId, meshData, origin);
|
_terrain.AddLandblockWithMesh(lb.LandblockId, meshData, origin);
|
||||||
|
|
||||||
// Step 4: drain pending LoadedCells from the worker thread.
|
// Step 4: drain pending LoadedCells from the worker thread.
|
||||||
// Phase A8 RR7.1 (2026-05-27): also late-stamp BuildingId on each
|
// Also collect into a local dict for the BuildingLoader stamping pass below.
|
||||||
// arriving cell if the landblock's BuildingRegistry already exists
|
var drainedCells = new System.Collections.Generic.Dictionary<uint, LoadedCell>();
|
||||||
// (cells loaded after the registry-build pass at line ~5876). Cells
|
|
||||||
// arriving BEFORE the registry are stamped by BuildingLoader.Build
|
|
||||||
// itself via the AllLoadedCells dict.
|
|
||||||
while (_pendingCells.TryTake(out var cell))
|
while (_pendingCells.TryTake(out var cell))
|
||||||
{
|
{
|
||||||
_cellVisibility.AddCell(cell);
|
_cellVisibility.AddCell(cell);
|
||||||
uint cellLbId = cell.CellId & 0xFFFF0000u;
|
drainedCells[cell.CellId] = cell;
|
||||||
if (_buildingRegistries.TryGetValue(cellLbId, out var existingReg))
|
|
||||||
{
|
|
||||||
var bs = existingReg.GetBuildingsContainingCell(cell.CellId);
|
|
||||||
if (bs.Count > 0)
|
|
||||||
cell.BuildingId = bs[0].BuildingId;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute the per-landblock AABB for frustum culling. XY from the
|
// Compute the per-landblock AABB for frustum culling. XY from the
|
||||||
|
|
@ -5872,20 +5863,18 @@ public sealed class GameWindow : IDisposable
|
||||||
_physicsEngine.AddLandblock(lb.LandblockId, terrainSurface, cellSurfaces,
|
_physicsEngine.AddLandblock(lb.LandblockId, terrainSurface, cellSurfaces,
|
||||||
portalPlanes, origin.X, origin.Y);
|
portalPlanes, origin.X, origin.Y);
|
||||||
|
|
||||||
// Phase A8 (2026-05-26, fixed 2026-05-27 RR7.1): build per-landblock
|
// Phase A8 (2026-05-26): build per-landblock BuildingRegistry from
|
||||||
// BuildingRegistry from LandBlockInfo.Buildings, stamping
|
// LandBlockInfo.Buildings, stamping LoadedCell.BuildingId for each cell
|
||||||
// LoadedCell.BuildingId for each cell in a building's cell set.
|
// in a building's cell set. Uses the already-drained drainedCells dict
|
||||||
// Uses _cellVisibility.AllLoadedCells (every cell loaded so far,
|
// (LoadedCells registered this frame) so stamping and registry build
|
||||||
// not just the per-frame drain) so the BFS can reach cells that
|
// happen in the same render-thread pass — no extra dat reads required.
|
||||||
// streamed in on earlier frames. Cells arriving AFTER this build
|
// Cells without a building stay at BuildingId == null (outdoor surface
|
||||||
// pass get stamped at drain time (see _pendingCells loop above).
|
// cells; dungeon cells not enumerated in LandBlockInfo.Buildings).
|
||||||
// Cells without a building stay at BuildingId == null (outdoor
|
|
||||||
// surface cells; dungeon cells not in LandBlockInfo.Buildings).
|
|
||||||
if (lbInfo is not null)
|
if (lbInfo is not null)
|
||||||
{
|
{
|
||||||
_buildingRegistries[lb.LandblockId] =
|
_buildingRegistries[lb.LandblockId] =
|
||||||
AcDream.App.Rendering.Wb.BuildingLoader.Build(
|
AcDream.App.Rendering.Wb.BuildingLoader.Build(
|
||||||
lbInfo, lb.LandblockId, _cellVisibility.AllLoadedCells);
|
lbInfo, lb.LandblockId, drainedCells);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue