checkpoint(render): preserve pre-overhaul investigation state

This commit is contained in:
Erik 2026-09-01 18:04:24 +02:00
parent e880860291
commit b3b7d922f1
45 changed files with 3168 additions and 619 deletions

View file

@ -99,6 +99,106 @@ public static class RenderingDiagnostics
public static bool ProbeVisibilityEnabled { get; set; } =
Environment.GetEnvironmentVariable("ACDREAM_PROBE_VIS") == "1";
/// <summary>
/// Temporary Facility Hub staircase discriminator. The frame walk emits
/// camera/root/flood facts and the leaf classifier emits change-only
/// decisions for the authored stair GfxObj (0x010000DE) and local-player
/// setup parts in cells 0x8A02015E/015F/01C1. Output-only; it must never
/// influence admission. Initial state from
/// <c>ACDREAM_PROBE_FACILITY_STAIRS=1</c>.
/// </summary>
public static bool ProbeFacilityStairsEnabled { get; set; } =
Environment.GetEnvironmentVariable("ACDREAM_PROBE_FACILITY_STAIRS") == "1";
/// <summary>
/// Temporary cathedral discriminator: suppresses only the far-Z portal
/// punch for the authored building whose look-in owns cell 0xF4180112.
/// This is a binary visual experiment for the moving transparent seam at
/// the 0xF4180107/0112 floating stairs, never a production admission rule.
/// </summary>
public static bool ProbeCathedralSkipStairBuildingPunch { get; set; } =
Environment.GetEnvironmentVariable("ACDREAM_PROBE_CATHEDRAL_SKIP_PUNCH") == "1";
/// <summary>
/// Temporary cathedral discriminator: suppresses only the true-depth exit
/// seals authored by the two cells that meet at the floating-stair seam.
/// Both portal polygons lie on world Y ~= 24 and span the reported moving
/// triangle. This is a binary visual experiment only; normal production
/// behavior is unchanged while the flag is unset.
/// </summary>
public static bool ProbeCathedralSkipFloatingStairSeals { get; set; } =
Environment.GetEnvironmentVariable("ACDREAM_PROBE_CATHEDRAL_SKIP_SEALS") == "1";
/// <summary>
/// Temporary cathedral carrier discriminator: suppresses only the visible
/// EnvCell shells for cells 0xF4180107 and 0xF4180112. This deliberately
/// removes their authored walls so a visual A/B can prove whether the
/// moving wall-textured triangles at the floating stairs come from either
/// cell shell. It is never a production visibility rule.
/// </summary>
public static bool ProbeCathedralSkipFloatingStairCellShells { get; set; } =
Environment.GetEnvironmentVariable("ACDREAM_PROBE_CATHEDRAL_SKIP_CELL_SHELLS") == "1";
/// <summary>
/// Temporary cathedral carrier discriminator: suppresses the visible
/// EnvCell shells for 0xF4180112/0113/0114 only while they are reached by
/// a building look-in. Their ordinary interior-root repaint remains
/// untouched. This separates a pre-clear look-in cell shell from the
/// south building's own exterior shell; it is never a production rule.
/// </summary>
public static bool ProbeCathedralSkipSouthLookInCellShells { get; set; } =
Environment.GetEnvironmentVariable(
"ACDREAM_PROBE_CATHEDRAL_SKIP_SOUTH_LOOKIN_SHELLS") == "1";
/// <summary>
/// Narrow form of <see cref="ProbeCathedralSkipSouthLookInCellShells"/>:
/// suppresses one exact EnvCell shell only during a building look-in.
/// Accepts a full hexadecimal cell id, with or without a <c>0x</c>
/// prefix, through <c>ACDREAM_PROBE_CATHEDRAL_SKIP_LOOKIN_SHELL</c>.
/// Zero means disabled. Behavior-changing diagnostic only.
/// </summary>
public static uint ProbeCathedralSkipLookInShellCellId { get; set; } =
ParseHexCellId(
Environment.GetEnvironmentVariable(
"ACDREAM_PROBE_CATHEDRAL_SKIP_LOOKIN_SHELL"));
/// <summary>
/// Temporary cathedral carrier discriminator: suppresses only the own
/// exterior shell of the south cathedral building (authored anchor cell
/// 0xF4180112). Its portal walk, look-in cells, and particles remain live.
/// This is a binary visual experiment, never a production rule.
/// </summary>
public static bool ProbeCathedralSkipSouthBuildingShell { get; set; } =
Environment.GetEnvironmentVariable(
"ACDREAM_PROBE_CATHEDRAL_SKIP_SOUTH_BUILDING_SHELL") == "1";
/// <summary>
/// Output-only cathedral floating-stair trace. Samples the ONE frame
/// walk's recorded clear/seal/punch/shell replay order and reports the
/// render-stamp-deduplicated whole-shell turns for cells 0xF4180104/0106/0107
/// and 0xF4180112/0113/0114. It never changes admission, depth state, or
/// draw order. Initial state from
/// <c>ACDREAM_PROBE_CATHEDRAL_SHELL_ORDER=1</c>.
/// </summary>
public static bool ProbeCathedralShellOrderEnabled { get; set; } =
Environment.GetEnvironmentVariable("ACDREAM_PROBE_CATHEDRAL_SHELL_ORDER") == "1";
private static uint ParseHexCellId(string? raw)
{
if (string.IsNullOrWhiteSpace(raw))
return 0;
ReadOnlySpan<char> value = raw.AsSpan().Trim();
if (value.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
value = value[2..];
return uint.TryParse(
value,
NumberStyles.HexNumber,
CultureInfo.InvariantCulture,
out uint cellId)
? cellId
: 0;
}
/// <summary>
/// Phase U.4c (2026-05-31) flap-convergence probe. When true, the portal
/// visibility pass emits, EVERY frame the camera root is an indoor cell, a
@ -186,15 +286,11 @@ public static class RenderingDiagnostics
/// collection capped nearest-the-PLAYER — the earlier gaze-coupled scoping
/// (rebuilding the pool from a freshly re-flooded CAMERA-seeded set,
/// <c>c500912b</c>) was the #176 flicker mechanism and was deleted.
/// A7.L1 (2026-07-09): visible-cell scoping is BACK, but sourced differently —
/// <c>LightManager.BuildPointLightSnapshot</c> now takes an optional
/// <c>visibleCells</c> filter that <c>GameWindow</c> feeds from LAST FRAME's
/// already-rendered <c>RetailPViewFrameResult.DrawableCells</c> (one frame of
/// latency, no independent re-flood, no callback threaded into DrawInside) —
/// fixes the Town Network starvation case (463 fixtures, a wall-adjacent
/// corridor's fixtures out-ranking the player's own room in raw Euclidean
/// distance) without reproducing the #176 mechanism. <c>byCell</c> shows which
/// cells' lights are pooled; <c>cellLess==pool</c> in a fixture-rich room still
/// A7.L1 later added last-frame drawable-cell scoping, but the Facility Hub
/// zoom trace proved that it also couples pool membership to the camera root
/// (five lights became one while the player stood still), so it was removed.
/// <c>byCell</c> now describes the resident pool; <c>cellLess==pool</c> in a
/// fixture-rich room still
/// means cell tagging FAILED (ParentCellId not flowing).
/// Output-only, inert when off. Initial state from <c>ACDREAM_PROBE_INDOOR_LIGHT=1</c>.
/// </summary>
@ -403,14 +499,14 @@ public static class RenderingDiagnostics
/// point-light pool: the SET COMPOSITION the <c>[light]</c> counts can't show.
/// Cheap no-op when <see cref="ProbeIndoorLightEnabled"/> is false; otherwise
/// fires at most once per second. Called from
/// <c>LightManager.BuildPointLightSnapshot</c> — <paramref name="scopedSnapshot"/>
/// already reflects any last-frame visible-cell scoping (A7.L1, 2026-07-09).
/// <c>LightManager.BuildPointLightSnapshot</c> after resident collection and
/// the bounded player-nearest selection.
/// </summary>
/// <param name="allRegistered">Every registered light (<c>LightManager._all</c>).</param>
/// <param name="scopedSnapshot">The point-light pool just built.</param>
/// <param name="pointSnapshot">The point-light pool just built.</param>
public static void EmitIndoorLight(
IReadOnlyList<AcDream.Core.Lighting.LightSource> allRegistered,
IReadOnlyList<AcDream.Core.Lighting.LightSource> scopedSnapshot)
IReadOnlyList<AcDream.Core.Lighting.LightSource> pointSnapshot)
{
if (!ProbeIndoorLightEnabled) return;
@ -423,10 +519,10 @@ public static class RenderingDiagnostics
foreach (var l in allRegistered)
if (l.IsLit && l.Kind != AcDream.Core.Lighting.LightKind.Directional) registeredLitPoints++;
int pool = scopedSnapshot.Count;
int pool = pointSnapshot.Count;
int cellLess = 0;
var hist = new Dictionary<uint, int>();
foreach (var l in scopedSnapshot)
foreach (var l in pointSnapshot)
{
if (l.CellId == 0) cellLess++;
hist.TryGetValue(l.CellId, out var c);