fix(physics): restore retail cell availability semantics
This commit is contained in:
parent
d3c0d9ec0e
commit
7716c2ee89
14 changed files with 393 additions and 62 deletions
|
|
@ -11,14 +11,14 @@ namespace AcDream.Core.Tests.Physics;
|
|||
public class CellGraphPopulationTests
|
||||
{
|
||||
[Fact]
|
||||
public void CacheCellStruct_AddsEnvCellToGraph_EvenWhenPhysicsBspIsNull()
|
||||
public void CacheCellStruct_PublishesLoadedCell_WhenPhysicsAndContainmentRootsAreNull()
|
||||
{
|
||||
var cache = new PhysicsDataCache();
|
||||
var cellStruct = new CellStruct
|
||||
{
|
||||
VertexArray = new VertexArray { Vertices = new Dictionary<ushort, SWVertex>() },
|
||||
Polygons = new Dictionary<ushort, Polygon>(),
|
||||
// PhysicsBSP omitted (defaults to null) — triggers the null-BSP drop from _cellStruct
|
||||
CellBSP = new CellBSPTree { Root = null },
|
||||
};
|
||||
var dat = new DatEnvCell
|
||||
{
|
||||
|
|
@ -29,8 +29,14 @@ public class CellGraphPopulationTests
|
|||
|
||||
cache.CacheCellStruct(0xA9B40174u, dat, cellStruct, Matrix4x4.Identity);
|
||||
|
||||
Assert.Null(cache.GetCellStruct(0xA9B40174u)); // dropped from physics cache
|
||||
Assert.NotNull(cache.CellGraph.GetVisible(0xA9B40174u)); // but present in the graph
|
||||
CellPhysics loaded = Assert.IsType<CellPhysics>(
|
||||
cache.GetCellStruct(0xA9B40174u));
|
||||
Assert.True(CollisionTraversal.HasCellContainment(cache, loaded));
|
||||
Assert.True(CollisionTraversal.PointInsideCell(
|
||||
cache,
|
||||
loaded,
|
||||
new Vector3(10_000f, -10_000f, 500f)));
|
||||
Assert.NotNull(cache.CellGraph.GetVisible(0xA9B40174u));
|
||||
Assert.IsType<EnvCell>(cache.CellGraph.GetVisible(0xA9B40174u));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue