From 89a2032c8e9d70bbaaaddb963aca826ac1e0e312 Mon Sep 17 00:00:00 2001 From: Erik Date: Tue, 9 Jun 2026 12:46:14 +0200 Subject: [PATCH] =?UTF-8?q?diag(render):=20[pv-trace]=20sidechk=20?= =?UTF-8?q?=E2=80=94=20pin=20back-portal=20traversal=20(B1=20bypass=20vs?= =?UTF-8?q?=20B2=20side-test)=20for=20R-A2b?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Logs camInterior/eyeIn/D per portal under the existing PortalBuildTrace so the 0173->0171 back-portal traversal can be attributed to B1 (EyeInsidePortalOpening bypass) or B2 (CameraOnInteriorSide convention). Throwaway; stripped in Phase 4. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../Rendering/PortalVisibilityBuilder.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/AcDream.App/Rendering/PortalVisibilityBuilder.cs b/src/AcDream.App/Rendering/PortalVisibilityBuilder.cs index f828abfb..ebf70c94 100644 --- a/src/AcDream.App/Rendering/PortalVisibilityBuilder.cs +++ b/src/AcDream.App/Rendering/PortalVisibilityBuilder.cs @@ -200,6 +200,20 @@ public static class PortalVisibilityBuilder bool dx = pvDump && cell.Portals[i].OtherCellId == 0xFFFF; bool eyeInsideOpening = EyeInsidePortalOpening(poly, cell.WorldTransform, cameraPos); + + // (R-A2b Phase 1 pin, throwaway) Log the side-test inputs for EVERY portal so a back-portal + // traversal (cell=0x..0173 p->0x0171) can be attributed to B1 (eyeInsideOpening bypasses the + // side-cull) vs B2 (CameraOnInteriorSide returns interior where retail's InitCell culls). + // |D|<=1.75 means eyeInsideOpening is in range. Strip with the rest of the [pv-trace] apparatus. + if (trace != null) + { + bool camInterior = i >= cell.ClipPlanes.Count || CameraOnInteriorSide(cell, i, cameraPos); + float sideD = (i < cell.ClipPlanes.Count && cell.ClipPlanes[i].Normal.LengthSquared() >= 1e-8f) + ? Vector3.Dot(cell.ClipPlanes[i].Normal, Vector3.Transform(cameraPos, cell.InverseWorldTransform)) + cell.ClipPlanes[i].D + : float.NaN; + trace.Add($"sidechk cell=0x{cell.CellId:X8} p{i}->0x{portal.OtherCellId:X4} camInterior={camInterior} eyeIn={eyeInsideOpening} D={(float.IsNaN(sideD) ? "na" : sideD.ToString("F2"))}"); + } + bool sideAllowed = true; // Portal-side test: only traverse a portal the camera is on the interior side of