feat(render) Campaign FW1: port the exact retail degrade selection

UpdateViewerDistance @0x0050e030 + get_degrade @0x0051e4b0 ported with
live-pinned globals: distance measured to the part SCALED SORT CENTER,
effective = max(0, dist - s_rDegradeDistance [live 100]), level = first
with effective < IdealDist (the live auto_update_deg_mul<=0 arm), else
the last level. WalkBuildingDegradeLevel carries the full authored
bands; the adapter fills sort centers; the replay context measures to
the transformed sort center. Sweep state after the rule: the level-0
building set is now correct; the residual divergence is the per-portal
side/clip gate (my arms punch a near-complement of retail two) - the
sweep driver carries the next instrument in its Skip note.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-30 10:55:19 +02:00
parent 844a6c097d
commit e23a589a6b
4 changed files with 41 additions and 17 deletions

View file

@ -24,12 +24,14 @@ public sealed class WalkLookInGateSweepTests
public void Emit(in WalkEvent walkEvent) => Events.Add(walkEvent);
}
[Fact(Skip = "FW1 adjudication driver (2026-08-30 state): the degrade-level "
+ "BSP gate killed every wrong punch — remaining deltas are the near "
+ "buildings 001a/0022 (50/28 m center distance vs the 48 m level-0 "
+ "band: port UpdateViewerDistance's sphere-adjusted distance + "
+ "hysteresis) and the ring-1 frustum boundary pair "
+ "(aab50002 extra / a9b3003c missing). Re-enable to re-adjudicate.")]
[Fact(Skip = "FW1 adjudication driver (2026-08-30 final state): with the "
+ "exact get_degrade rule (slack 100, ideal thresholds, sort-center "
+ "distance) the level-0 set is correct — the residual divergence is "
+ "the per-portal side/clip gate: my arms punch {0017,001e,0026,0036}, "
+ "retail punched exactly {001a,0022} — a near-complement suggesting "
+ "one more polarity at the building-portal gate. Next instrument: "
+ "per-portal dump for 001a (retail punches) vs 001e (retail doesn't): "
+ "side values, plane orientation, eye side, clip result per arm.")]
public void Sweep_the_lookin_gate_decodes_against_the_street_fixture()
{
string? datDir = CornerFloodReplayTests.ResolveDatDir();

View file

@ -114,7 +114,8 @@ public sealed class WalkTraceReplayContext : IWalkFrameContext, IRetailFrameWalk
public float ViewerDistanceTo(WalkBuilding building)
=> Vector3.Distance(
WorldViewpoint, Buildings[building].WorldTransform.Translation);
WorldViewpoint,
Vector3.Transform(building.SortCenter, Buildings[building].WorldTransform));
public int ClipBuildingPolygon(
WalkBuilding building, WalkPolygon polygon, int side, Span<WalkScreenPoint> output)

View file

@ -148,10 +148,12 @@ public static class WalkWorldDatAdapter
}
WalkBspNode? bsp = null;
Vector3 sortCenter = Vector3.Zero;
var degradeLevels = new List<WalkBuildingDegradeLevel>();
if (dats.Get<GfxObj>(buildingInfo.ModelId) is GfxObj gfxObj)
{
bsp = ConvertDrawingBsp(gfxObj, gfxObj.DrawingBSP?.Root);
sortCenter = new Vector3(gfxObj.SortCenter.X, gfxObj.SortCenter.Y, gfxObj.SortCenter.Z);
if (gfxObj.DIDDegrade != 0
&& dats.Get<GfxObjDegradeInfo>(gfxObj.DIDDegrade)
is GfxObjDegradeInfo degradeInfo)
@ -164,7 +166,7 @@ public static class WalkWorldDatAdapter
{
levelBsp = ConvertDrawingBsp(levelGfx, levelGfx.DrawingBSP?.Root);
}
degradeLevels.Add(new WalkBuildingDegradeLevel(level.MaxDist, levelBsp));
degradeLevels.Add(new WalkBuildingDegradeLevel(level.MinDist, level.IdealDist, level.MaxDist, levelBsp));
}
}
}
@ -180,6 +182,7 @@ public static class WalkWorldDatAdapter
Portals = portals,
DrawingBsp = bsp,
DegradeLevels = degradeLevels.ToArray(),
SortCenter = sortCenter,
},
worldTransform,
inverse));