fix(physics): Slice 1 — delete render-mesh-AABB synthetic collision; DAT-only shape authority

Retail oracle: CPartArray::InitParts@0x00517F40, CGfxObj::Serialize@0x00534970 (physics_bsp
gated on serialized-flags bit-0), CPhysicsPart::find_obj_collisions@0x0050D8D0 (returns OK /
passable when physics_bsp==null). Render-mesh bounds never enter collision.

Changes:
- GameWindow.cs: delete the ~200-line VISUAL mesh-bounds collision block (the
  isPhantomSetup / isPhantomGfxObj locals + the if-block computing worldMin/worldMax
  AABB + the ShadowObjects.Register call that capped and registered the synthetic
  cylinder). Also removes dead counter variables scHaveBounds/scRegistered/scNoBounds/
  scTooThin; trims the ProbeBuildingEnabled summary line accordingly.
- PhysicsDataCache.cs: delete IsPhantomGfxObjSource (the predicate that only existed
  to fence the mesh-AABB synthesis; the "phantom" concept is now the default — no DAT
  shape means no registration, verbatim with retail).
- PhysicsDataCachePhantomSourceTests.cs: deleted (tested the removed method).
- ShadowShapeBuilderShapeSourceTests.cs: new guard test — a Setup with parts but
  hasPhysicsBsp=false and no CylSpheres/Spheres yields an empty shape list, locking
  the DAT-only rule in the builder.
- retail-divergence-register.md: AP-2 row deleted (divergence retired).

Objects with no DAT physics shape (no CylSpheres, no Spheres, no part with a
PhysicsBSP) now register no collision shape and are passable, verbatim with retail.
Objects with real DAT shapes (BSP parts, CylSpheres) are unaffected.

dotnet build green, 22/22 tests passing (ShadowShapeBuilderShapeSourceTests +
CellarUpTrajectoryReplay + CornerFlood + Issue147ArwicBuildings replay harnesses).

Visual gate pending: walk Holtburg + open world; objects that become passable must
match retail (DAT has no physics shape — trees with real CylSpheres still solid).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-06-24 18:57:46 +02:00
parent 4f26067755
commit 79dee342f2
5 changed files with 44 additions and 297 deletions

View file

@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using AcDream.Core.Physics;
using DatReaderWriter.DBObjs;
using DatReaderWriter.Enums;
using DatReaderWriter.Types;
using Xunit;
namespace AcDream.Core.Tests.Physics;
/// <summary>
/// Guards the DAT-only shape-source rule (Slice 1 of the unified
/// collision-inclusion phase, 2026-06-24).
///
/// <para>
/// Retail oracle: <c>CPartArray::InitParts@0x00517F40</c> (parts come from
/// the Setup list only), <c>CGfxObj::Serialize@0x00534970</c> (physics_bsp
/// gated on serialized-flags bit-0), <c>CPhysicsPart::find_obj_collisions@0x0050D8D0</c>
/// (returns OK / passable when <c>physics_bsp == null</c>). Render-mesh bounds
/// never enter collision.
/// </para>
/// </summary>
public class ShadowShapeBuilderShapeSourceTests
{
// Retail: an object with no DAT physics shape (no CylSphere, no Sphere,
// no part with a PhysicsBSP) emits NO collision shape and is passable.
// CPhysicsPart::find_obj_collisions@0x0050D8D0 returns OK when physics_bsp==null.
[Fact]
public void Setup_WithNoCylSpheres_NoSpheres_NoPhysicsBspParts_YieldsEmptyShapeList()
{
var setup = new Setup
{
CylSpheres = new List<CylSphere>(),
Spheres = new List<Sphere>(),
Parts = { 0x01000ABCu },
PlacementFrames = new Dictionary<Placement, AnimationFrame>(),
};
var shapes = ShadowShapeBuilder.FromSetup(setup, entScale: 1f, hasPhysicsBsp: _ => false);
Assert.Empty(shapes);
}
}