fix #124: interior-root building look-ins as a landscape-stage sub-pass
From inside a building, looking out at ANOTHER building with an opening showed its back walls missing (see-through to the world): per-building look-in floods only ran for outdoor roots; under an interior root the far building's interior never flooded. Decomp anchor (named-retail, this session's read): retail runs the look-in INSIDE the landscape stage for ANY root - LScape::draw is the FIRST call of PView::DrawCells' outside-view branch (pc:432719), strictly BEFORE the depth clear (pc:432732) and the exit-portal seals (pc:432785). ConstructView(CBldPortal) (0x005a59a0) clips each aperture via GetClip against the INSTALLED view - the accumulated doorway region when looked into from inside - and build_draw_portals_only pass 1 far-Z punches ALL apertures before pass 2 floods + draws any interior cell. The nested DrawCells has an empty outside view (PView ctor draw_landscape=0): no recursive landscape/clear/seal. Port: - GameWindow's per-building gather (frustum pre-gate on Building.PortalBounds) now runs for interior roots too; the root's own doorway self-excludes via the seed eye-side test (the eye is on its interior side). - PortalVisibilityBuilder.BuildFromExterior/ConstructViewBuilding gain seedRegion - the installed-view clip: interior-root look-ins seed against the OutsideView polygons (a building not visible through the doorway never floods); null = full screen (outdoor roots unchanged). - RetailPViewRenderer.DrawBuildingLookIns: a landscape-stage sub-pass (before ClearDepthForInterior + seals) - per building, punch ALL apertures (new DrawLookInPortalPunch callback, always forceFarZ=true, closing the ISSUES "forceFarZ keys on root kind, under-punches" gap), then draw the flooded cells' shells + statics far->near. Look-in frames are NEVER merged into the main frame: a merged cell would draw post-clear and z-fail against the root's seal (the old ledger portShape sketch was wrong on this point). - Look-in cells join the Prepare + partition set so shells have batches and statics route to ByCell (consumed only by the sub-pass; the main cell-object pass iterates the main flood's cells). Register: AP-33 added in the same commit - look-in statics draw WHOLE (no per-part viewcone; over-include is the safe direction) and look-in DYNAMICS are deferred (an NPC inside a far building stays invisible - retail draws objects per overlapped cell in the landscape stage). Pins: Issue124LookInSeedRegionTests on the real corner-building door - a seed region containing the aperture floods (and never more than the full-screen seed), a disjoint region floods NOTHING, and an interior-side eye never seeds its own exit portal. Suites: App 259+1skip / Core 1439+2skip / UI 420 / Net 294 green. Awaiting the user gate: far-building interiors visible through their apertures from inside; #130 re-gate (top-edge strip) rides the same launch. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
5135066733
commit
77cef4cd86
6 changed files with 379 additions and 32 deletions
|
|
@ -7628,9 +7628,9 @@ public sealed class GameWindow : IDisposable
|
|||
// OutdoorCellNode.Build filters to exit portals internally. The clipRoot flip +
|
||||
// OutsideView terrain integration that consumes this is the next (cutover) step.
|
||||
_outdoorNode = null;
|
||||
if (viewerRoot is null && viewerCellId != 0u)
|
||||
_outdoorNodeBuildingCells.Clear();
|
||||
if (viewerRoot is not null || viewerCellId != 0u)
|
||||
{
|
||||
_outdoorNodeBuildingCells.Clear();
|
||||
// T2 (BR-4): draw-driven flood gating. Retail floods a building's
|
||||
// interior exactly when its shell DRAWS and an aperture survives
|
||||
// the view (DrawBuilding Ghidra 0x0059f2a0: per-view viewconeCheck
|
||||
|
|
@ -7645,6 +7645,12 @@ public sealed class GameWindow : IDisposable
|
|||
// Per-building iteration is also the FPS fix the 2026-06-07
|
||||
// Chebyshev hack approximated: dozens of AABB tests instead of an
|
||||
// O(all loaded cells) portal sweep.
|
||||
// #124: the gather now runs for INTERIOR roots too — retail's
|
||||
// look-in executes inside LScape::draw for ANY root with a
|
||||
// non-empty outside view (DrawCells pc:432719). The renderer
|
||||
// routes interior-root look-ins to its landscape-stage sub-pass
|
||||
// (DrawBuildingLookIns); the root's own building self-excludes
|
||||
// via the seed eye-side test.
|
||||
foreach (var registry in _buildingRegistries.Values)
|
||||
{
|
||||
foreach (var b in registry.All())
|
||||
|
|
@ -7659,10 +7665,11 @@ public sealed class GameWindow : IDisposable
|
|||
_outdoorNodeBuildingCells.Add(bc);
|
||||
}
|
||||
}
|
||||
_outdoorNode = AcDream.App.Rendering.OutdoorCellNode.Build(viewerCellId);
|
||||
if (viewerRoot is null)
|
||||
_outdoorNode = AcDream.App.Rendering.OutdoorCellNode.Build(viewerCellId);
|
||||
if (AcDream.Core.Rendering.RenderingDiagnostics.ProbeFlapEnabled)
|
||||
Console.WriteLine(System.FormattableString.Invariant(
|
||||
$"[outdoor-node] cell=0x{viewerCellId:X8} nearbyCells={_outdoorNodeBuildingCells.Count} (T2 frustum-gated per-building floods)"));
|
||||
$"[outdoor-node] cell=0x{viewerCellId:X8} root={(viewerRoot is null ? "OUT" : "IN")} nearbyCells={_outdoorNodeBuildingCells.Count} (T2 frustum-gated per-building floods)"));
|
||||
}
|
||||
|
||||
uint playerCellId = _physicsEngine.DataCache?.CellGraph.CurrCell?.Id ?? 0u;
|
||||
|
|
@ -7788,10 +7795,10 @@ public sealed class GameWindow : IDisposable
|
|||
var pviewResult = _retailPViewRenderer.DrawInside(new AcDream.App.Rendering.RetailPViewDrawContext
|
||||
{
|
||||
RootCell = clipRoot,
|
||||
// R-A2: outdoor root floods each nearby building per-building (not via the root). The
|
||||
// gather above populates _outdoorNodeBuildingCells only on outdoor-node frames, so it
|
||||
// is fresh here exactly when clipRoot.IsOutdoorNode; null for interior roots.
|
||||
NearbyBuildingCells = clipRoot.IsOutdoorNode ? _outdoorNodeBuildingCells : null,
|
||||
// R-A2: outdoor root floods each nearby building per-building (not via the root).
|
||||
// #124: interior roots get the gather too — the renderer routes them to the
|
||||
// landscape-stage look-in sub-pass instead of the merge.
|
||||
NearbyBuildingCells = _outdoorNodeBuildingCells,
|
||||
ViewerEyePos = viewerEyePos,
|
||||
ViewProjection = envCellViewProj,
|
||||
CellLookup = id => _cellVisibility.TryGetCell(id, out var c) ? c : null,
|
||||
|
|
@ -7837,6 +7844,11 @@ public sealed class GameWindow : IDisposable
|
|||
DrawExitPortalMasks = sliceCtx =>
|
||||
DrawRetailPViewPortalDepthWrite(sliceCtx, envCellViewProj,
|
||||
forceFarZ: clipRoot.IsOutdoorNode),
|
||||
// #124: look-in apertures are ALWAYS the punch (retail
|
||||
// maxZ1), independent of the root-keyed selector above.
|
||||
DrawLookInPortalPunch = sliceCtx =>
|
||||
DrawRetailPViewPortalDepthWrite(sliceCtx, envCellViewProj,
|
||||
forceFarZ: true),
|
||||
DrawCellParticles = sliceCtx =>
|
||||
DrawRetailPViewCellParticles(sliceCtx, camera, camPos),
|
||||
DrawDynamicsParticles = survivors =>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue