diff --git a/src/AcDream.App/Rendering/GameWindow.cs b/src/AcDream.App/Rendering/GameWindow.cs index e132c65..32540b4 100644 --- a/src/AcDream.App/Rendering/GameWindow.cs +++ b/src/AcDream.App/Rendering/GameWindow.cs @@ -7011,6 +7011,44 @@ public sealed class GameWindow : IDisposable var visibility = _cellVisibility.ComputeVisibility(camPos); bool cameraInsideCell = visibility?.CameraCell is not null; + // SPIKE 2026-05-26: A8 transition investigation. Lights up the + // dormant RenderingDiagnostics.ProbeVisibilityEnabled flag (added + // by Task 6 of the original A8 plan). Per-frame state captures: + // camera position, lenient + strict inside flags side-by-side, + // CameraCell id, VisibleCellIds list. Branch markers inside + // indoor + outdoor branches complete the trace. + // Enable via ACDREAM_PROBE_VIS=1. + if (AcDream.Core.Rendering.RenderingDiagnostics.ProbeVisibilityEnabled) + { + bool reallyInsideProbe = visibility?.CameraCell is not null + && CellVisibility.PointInCell(camPos, visibility.CameraCell); + int visCount = visibility?.VisibleCellIds?.Count ?? 0; + string visList; + if (visibility?.VisibleCellIds is null || visCount == 0) + { + visList = "[]"; + } + else + { + var sb = new System.Text.StringBuilder("["); + int shown = 0; + foreach (var id in visibility.VisibleCellIds) + { + if (shown >= 8) { sb.Append(",..."); break; } + if (shown > 0) sb.Append(','); + sb.Append($"0x{id:X8}"); + shown++; + } + sb.Append(']'); + visList = sb.ToString(); + } + string cellId = visibility?.CameraCell?.CellId.ToString("X8") ?? "null"; + Console.WriteLine( + $"[vis] pos=({camPos.X:F2},{camPos.Y:F2},{camPos.Z:F2}) " + + $"inside={cameraInsideCell} really={reallyInsideProbe} " + + $"cell=0x{cellId} visN={visCount} {visList}"); + } + // Lighting decisions (sun zeroed, indoor ambient applied) must // track the PLAYER's cell, not the camera's. In third-person // chase mode the camera enters interiors before the player body @@ -7174,6 +7212,8 @@ public sealed class GameWindow : IDisposable if (cameraReallyInside && _indoorStencilPipeline is not null && visibility?.CameraCell is not null) { + if (AcDream.Core.Rendering.RenderingDiagnostics.ProbeVisibilityEnabled) + Console.WriteLine("[vis] branch=indoor"); // Phase A8 R3 — WB RenderInsideOut order. // // 1. Terrain has already drawn (color + depth) at line ~7104. @@ -7233,6 +7273,8 @@ public sealed class GameWindow : IDisposable } else { + if (AcDream.Core.Rendering.RenderingDiagnostics.ProbeVisibilityEnabled) + Console.WriteLine("[vis] branch=outdoor"); // Outdoor path — unchanged from pre-A8: single dispatcher call // walks every entity with default EntitySet.All partition. _wbDrawDispatcher!.Draw(camera, _worldState.LandblockEntries, frustum,