feat(render): Campaign OVERHAUL S2 chunk 5 + closeout — registry is the only render membership owner

Chunk 5 (consumer cutover): WalkProductionWorldData's per-cell views are
borrowed from ShadowObjectRegistry.GetRetailPartEntriesInCell and resolved
through RenderSceneQuery.TryGetByLocalEntityId; every render-side sweep,
bucket, parent-cell and root-position fallback is deleted (AD-116 for the
one-frame registry→scene window, counted in UnregisteredRenderMembershipCount).
A live entity with visual parts but no collision geometry registers
render-only (LiveEntityCollisionBuilder computes the part array before the
empty-shapes gate).

Closeout fixes found while landing it:
- RefloodOwnerForLandblock forwards the retained part array — a reflood is
  retail's recalc_cross_cells over the SAME CPartArray; without it every owner
  touched by a landblock replacement commit lost its render membership.
- Non-colliding DAT statics register render-only from BOTH publishers
  (LandblockPhysicsPublisher.PublishStaticEntity,
  LandblockPhysicsContentBuilder.RegisterRenderOnlyStatic). The G2 self-gate
  pixel diff caught them vanishing (Facility Hub wall panels): retail floods
  every object regardless of collision (CEnvCell::init_static_objects
  0x0052c350, add_shadows_to_cells 0x00514ae0).
- S2 dual review fix batch (arch + retail lens, lead-verified):
  Suspend clears the retail product (remove_shadows_from_cells 0x00511230 is
  one transaction); AttachChild/DetachChild advance the mutation revision so
  a prepared SetPosition cannot clobber a child's rows; an attached child
  never floods on its own re-registration; RemoveLandblock and the non-rooted
  RetireOwnerFromLandblock prune retail rows (render-only statics end with
  their landblock); a render-only owner's no-cell-array commit republishes at
  its destination cell (AD-117); an empty non-null part array is treated as
  null; per-move closures/LINQ replaced by index loops; EnvCell shells stay
  out of the scene's LocalEntityId index (payload-less records); the index
  predicate compares the id; the dead per-cell scene indices are deleted.

Register: AD-116 (chunk 5), AD-117 (four residual Contract A/B readings).
Evidence: s2-membership-ownership-map.md §8 (chunk 5) and §9 (closeout).

Gates (Release): Core 4,984/4,984; Content 214/214; Runtime 1,884/1,884;
App hermetic lane 6,760/6,760; App InstalledDat lane 217 pass / 1 skip /
2 pre-existing #383 layout-fixture failures; App Windows lane 1/1.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-09-03 01:01:47 +02:00
parent f30039d3d9
commit c94a1a407e
20 changed files with 2141 additions and 1026 deletions

View file

@ -1333,6 +1333,73 @@ public sealed class LandblockPhysicsPublisherTests
Resolved = new Dictionary<ushort, ResolvedPolygon>(),
};
/// <summary>
/// Campaign OVERHAUL S2 chunk 5 closeout (G2 self-gate finding): a DAT
/// static with visual parts but no collision geometry is still flooded
/// into its cells by retail (calc_cross_cells_static 0x00515160 bbox route
/// + add_shadows_to_cells 0x00514ae0 AddPartsShadow rows), so the static
/// publisher registers it render-only — retail cell array + part entries,
/// zero collision rows. Before this pin the publisher skipped it outright
/// and, with the walk's parent-cell fallback deleted, the Facility Hub's
/// decorative wall panels vanished.
/// </summary>
[Fact]
public void CompletePublication_NonCollidingStaticRegistersRenderOnly()
{
const uint gfxObjId = 0x01000079u;
var fixture = Fixture();
fixture.Cache.RegisterGfxObjForTest(gfxObjId, RenderOnlyGfx(radius: 0.8f));
WorldEntity entity = new()
{
Id = 0x80A9B402u,
SourceGfxObjOrSetupId = gfxObjId,
Position = new Vector3(12f, 12f, 0f),
Rotation = Quaternion.Identity,
MeshRefs = [new MeshRef(gfxObjId, Matrix4x4.Identity)],
};
Publish(fixture.Publisher, Build(FirstLandblock, [entity]));
ShadowObjectRegistry shadows = fixture.Engine.ShadowObjects;
// No collision row anywhere (Contract B: nothing to contribute).
Assert.Empty(shadows.AllEntriesForDebug());
// But the retail render product exists: cell array + one part entry.
Assert.True(shadows.TryGetRetailCellArray(entity.Id, out var cells));
Assert.NotEmpty(cells);
Assert.Equal(RetailCellArrayRoute.BoundingBox, shadows.GetRetailCellArrayRoute(entity.Id));
int matching = 0;
foreach (RetailPartEntry part in shadows.GetRetailPartEntriesInCell(cells[0]))
{
if (part.EntityId != entity.Id)
continue;
matching++;
Assert.Equal(gfxObjId, part.GfxObjId);
}
Assert.Equal(1, matching);
Assert.Equal(0, fixture.Publisher.Diagnostics.StaticBspOwnerCount);
Assert.Equal(0, fixture.Publisher.Diagnostics.StaticCylinderOwnerCount);
}
/// <summary>A GfxObj with visual bounds and NO physics BSP — a purely
/// decorative static part.</summary>
private static GfxObjPhysics RenderOnlyGfx(float radius) => new()
{
BoundingSphere = new Sphere
{
Origin = Vector3.Zero,
Radius = radius,
},
PhysicsPolygons = new Dictionary<ushort, Polygon>(),
Vertices = new VertexArray(),
Resolved = new Dictionary<ushort, ResolvedPolygon>(),
VisualBounds = new FlatGfxObjVisualBounds(
new Vector3(-radius),
new Vector3(radius),
Vector3.Zero,
radius,
new Vector3(radius)),
};
private static GfxObj PhysicsGfx() => new()
{
Flags = DatReaderWriter.Enums.GfxObjFlags.HasPhysics,