refactor(physics): remove parsed collision graphs

Publish prepared GfxObj, Setup, CellStruct, and EnvCell collision records without retaining their parsed DAT BSP, polygon, vertex, or shape graphs. Strip temporary physics bundles at stable world commit, keep graph traversal only as an explicit test/tooling oracle, and report graph residency from actual retained fields.

Validated by 115 focused collision/streaming tests, a zero-warning Release build, and 8,413 passing Release tests with five pre-existing skips.

Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-25 18:21:19 +02:00
parent feb80a67d9
commit 82f8d4f82e
18 changed files with 923 additions and 104 deletions

View file

@ -0,0 +1,39 @@
using AcDream.App.Streaming;
using AcDream.Core.World;
using DatReaderWriter.DBObjs;
namespace AcDream.App.Tests.Streaming;
public sealed class GpuWorldStateCollisionResidencyTests
{
[Fact]
public void StableSpatialState_DropsPublicationDatBundle()
{
const uint landblockId = 0xA9B4_FFFFu;
var bundle = new PhysicsDatBundle(
new LandBlockInfo(),
new Dictionary<uint, EnvCell>
{
[0xA9B4_0100u] = new EnvCell(),
},
new Dictionary<uint, DatReaderWriter.DBObjs.Environment>(),
new Dictionary<uint, Setup>
{
[0x0200_0001u] = new Setup(),
},
new Dictionary<uint, GfxObj>());
var state = new GpuWorldState();
state.AddLandblock(new LoadedLandblock(
landblockId,
new LandBlock(),
Array.Empty<WorldEntity>(),
bundle));
Assert.True(state.TryGetLandblock(
landblockId,
out LoadedLandblock? retained));
Assert.NotNull(retained);
Assert.Same(PhysicsDatBundle.Empty, retained.PhysicsDats);
}
}

View file

@ -244,7 +244,9 @@ public sealed class LandblockBuildFactoryTests
Assert.Empty(envCells.Shells);
Assert.NotNull(physics.Info);
Assert.Equal(2, physics.EnvCells.Count);
Assert.Single(physics.Environments);
Assert.Empty(physics.Environments);
Assert.Equal(2, result.Collisions!.CellStructures.Count);
Assert.Equal(2, result.Collisions.EnvCells.Count);
}
[Fact]
@ -385,13 +387,23 @@ public sealed class LandblockBuildFactoryTests
physics.EnvCells.Keys.Order(),
first.Collisions.CellStructures.Keys.Order());
Assert.Equal(physics.Setups.Keys.Order(), first.Collisions.Setups.Keys.Order());
Assert.Equal(physics.GfxObjs.Keys.Order(), first.Collisions.GfxObjs.Keys.Order());
Assert.Empty(physics.Environments);
Assert.Empty(physics.GfxObjs);
uint[] expectedGfxObjIds = first.Landblock.Entities
.SelectMany(static entity => entity.MeshRefs)
.Select(static mesh => mesh.GfxObjId)
.Distinct()
.Order()
.ToArray();
Assert.Equal(
expectedGfxObjIds,
first.Collisions.GfxObjs.Keys.Order());
foreach (WorldEntity entity in first.Landblock.Entities)
{
if ((entity.SourceGfxObjOrSetupId & 0xFF000000u) == 0x02000000u)
Assert.Contains(entity.SourceGfxObjOrSetupId, physics.Setups.Keys);
foreach (MeshRef mesh in entity.MeshRefs)
Assert.Contains(mesh.GfxObjId, physics.GfxObjs.Keys);
Assert.Contains(mesh.GfxObjId, first.Collisions.GfxObjs.Keys);
}
}