refactor(streaming): extract landblock physics publisher
Move streamed terrain/cell/building and static collision publication behind a focused update-thread owner. Preserve retail publication order while making replacement and retirement exact by logical landblock ownership, including current-cell rebasing and adjacent-seam isolation. Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
parent
acb6b34d01
commit
3613d393e6
7 changed files with 1538 additions and 546 deletions
|
|
@ -151,4 +151,36 @@ public class PhysicsEngineResidencyTests
|
|||
entry => entry.EntityId == dynamicId);
|
||||
Assert.Equal(1, engine.ShadowObjects.RetainedRegistrationCount);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RemoveLandblock_RemovesOnlyItsCachedBuildings()
|
||||
{
|
||||
const uint landblockId = 0xA9B4FFFFu;
|
||||
const uint retiredBuildingCell = 0xA9B40001u;
|
||||
const uint adjacentBuildingCell = 0xAAB40001u;
|
||||
var cache = new PhysicsDataCache();
|
||||
var engine = new PhysicsEngine { DataCache = cache };
|
||||
cache.RegisterBuildingForTest(
|
||||
retiredBuildingCell,
|
||||
Building(Matrix4x4.Identity));
|
||||
cache.RegisterBuildingForTest(
|
||||
adjacentBuildingCell,
|
||||
Building(Matrix4x4.CreateTranslation(192f, 0f, 0f)));
|
||||
|
||||
engine.RemoveLandblock(landblockId);
|
||||
|
||||
Assert.Null(cache.GetBuilding(retiredBuildingCell));
|
||||
Assert.NotNull(cache.GetBuilding(adjacentBuildingCell));
|
||||
}
|
||||
|
||||
private static BuildingPhysics Building(Matrix4x4 transform)
|
||||
{
|
||||
Matrix4x4.Invert(transform, out Matrix4x4 inverse);
|
||||
return new BuildingPhysics
|
||||
{
|
||||
WorldTransform = transform,
|
||||
InverseWorldTransform = inverse,
|
||||
Portals = Array.Empty<BldPortalInfo>(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue