feat(render): indoor render WORKS — terminating portal flood + every-cell seal + look-in FPS

Checkpoint of the unified retail-faithful indoor render. The two-week HANG/grey is fixed and the
interior seals (live-verified by the user). Commits the session render-rewrite foundation together
with the fixes that made it functional.

- HANG fix: PortalVisibilityBuilder.Build portal flood did not terminate (the faithful ProjectToClip
  near-side clip drifts per round, defeating the CellView dedup; the BFS had no bound after U.2a removed
  MaxReprocessPerCell). Fix = drift-tolerant snapped/canonical CellView.Add dedup (PortalView.cs) plus
  restored MaxReprocessPerCell=16 bounded re-enqueue (PortalVisibilityBuilder.cs). Re-enqueue is kept
  (load-bearing for late-slice propagation, Build_ViewGrowthAfterDoneCell_PropagatesNewSlicesToExit);
  only its count is capped. CellViewDedupTests added.
- Seal (DrawCells Task 2): RetailPViewRenderer.DrawEnvCellShells draws EVERY visible cell via
  IndoorDrawPlan.ShellPass (was gated on the ClipFrameAssembler slot filter, leaving slot-less cells grey).
- Look-in FPS: GameWindow exterior look-in candidates limited to the player landblock +-1 (was all ~81
  loaded LBs iterated every outdoor frame). No behaviour change (far cells were >48m, already culled).

Remaining dominant issue = the FLAP at transitions: viewer-cell metastability (render roots at the
camera-eye cell, which oscillates outdoor-indoor as the 3rd-person boom drifts across the doorway,
confirmed in render-sig). SEPARATE fix, NOT the DrawCells port. Full handoff + flap fix plan + tracked
follow-ups (#78 terrain, look-in-from-inside, look-in FPS, L-spotlight):
docs/research/2026-06-07-indoor-render-session-handoff.md.

Baselines: build 0 err; App.Tests 210/210; Core.Tests 1331 pass / 4 fail (pre-existing) / 1 skip.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-06-07 10:14:43 +02:00
parent bff1955066
commit 1405dd8e90
27 changed files with 3635 additions and 814 deletions

View file

@ -21,11 +21,19 @@ string outDir = Path.Combine(AppContext.BaseDirectory, "out");
Directory.CreateDirectory(outDir);
Console.WriteLine($"outDir = {outDir}");
// Original ask: 0x050016A4..0x050016A8. A4/A5/A7/A8 don't exist as files; widen
// to 0x050016A0..0x050016AF to catch any related precip textures.
var idList = new System.Collections.Generic.List<uint>();
for (uint i = 0x050016A0; i <= 0x050016AF; i++) idList.Add(i);
uint[] ids = idList.ToArray();
uint[] ids;
if (args.Length > 0)
{
ids = args.Select(ParseId).ToArray();
}
else
{
// Original ask: 0x050016A4..0x050016A8. A4/A5/A7/A8 don't exist as files; widen
// to 0x050016A0..0x050016AF to catch any related precip textures.
var idList = new System.Collections.Generic.List<uint>();
for (uint i = 0x050016A0; i <= 0x050016AF; i++) idList.Add(i);
ids = idList.ToArray();
}
(uint id, double densityFraction)? best = null;
@ -35,15 +43,25 @@ foreach (var id in ids)
Console.WriteLine($"=== 0x{id:X8} ===");
RenderSurface? rs = null;
uint lookupId = id;
if (dats.TryGet<Surface>(id, out var surface) && surface is not null)
{
lookupId = (uint)surface.OrigTextureId;
var color = surface.ColorValue is null
? "null"
: $"0x{surface.ColorValue.Alpha:X2}{surface.ColorValue.Red:X2}{surface.ColorValue.Green:X2}{surface.ColorValue.Blue:X2}";
Console.WriteLine($" Surface descriptor, type={surface.Type}, color={color}, origTexture=0x{lookupId:X8}");
}
// SurfaceTexture wrapper (0x05xxxxxx) → first inner RenderSurface (0x06xxxxxx).
if (dats.TryGet<SurfaceTexture>(id, out var st) && st is not null && st.Textures.Count > 0)
if (dats.TryGet<SurfaceTexture>(lookupId, out var st) && st is not null && st.Textures.Count > 0)
{
uint rsid = (uint)st.Textures[0];
Console.WriteLine($" SurfaceTexture wrapper, {st.Textures.Count} mip(s), first = 0x{rsid:X8}");
if (dats.TryGet<RenderSurface>(rsid, out var inner) && inner is not null)
rs = inner;
}
else if (dats.TryGet<RenderSurface>(id, out var direct) && direct is not null)
else if (dats.TryGet<RenderSurface>(lookupId, out var direct) && direct is not null)
{
rs = direct;
}
@ -226,3 +244,11 @@ static uint Adler32(byte[] data)
}
return (b << 16) | a;
}
static uint ParseId(string text)
{
text = text.Trim();
if (text.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
return Convert.ToUInt32(text[2..], 16);
return Convert.ToUInt32(text, 16);
}