feat(A.5 T18): use cached WorldEntity AABB in dispatcher; populate at register
Per Phase A.5 spec §4.6 Change #2: WalkEntities's per-entity AABB frustum cull was recomputing Position±5 per frame per entity. With ~10.7K entities (N1=4) at 240 FPS that is ~2.5M wasted Vector3 ops/sec. Read the AABB from the WorldEntity cache (T8 schema) instead. RefreshAabb runs lazily on AabbDirty=true. Populate at register time: - LandblockLoader.BuildEntitiesFromInfo: RefreshAabb after each new WorldEntity construction (stabs + buildings). Refactored from inline object-initializer to named variable to enable the call. - EntitySpawnAdapter.OnCreate: RefreshAabb after entity state init (position/rotation already set via the WorldEntity passed in). Dynamic entities (NPCs, players) move every frame via direct Position writes in GameWindow.cs. Migrated all three per-frame write sites to SetPosition() (T8 mutator) so AabbDirty propagates: - line 5942: player entity render position update - line 6951: remote animated entity interpolated path - line 7279: remote animated entity landing/movement path The lazy RefreshAabb in WalkEntities catches up on the next frame after any SetPosition call — render thread only, no races. Build green, 986 passed / 8 pre-existing failures unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
003443cd1a
commit
0afd741ea7
3 changed files with 17 additions and 7 deletions
|
|
@ -42,28 +42,32 @@ public static class LandblockLoader
|
|||
{
|
||||
if (!IsSupported(stab.Id))
|
||||
continue;
|
||||
result.Add(new WorldEntity
|
||||
var stabEntity = new WorldEntity
|
||||
{
|
||||
Id = nextId++,
|
||||
SourceGfxObjOrSetupId = stab.Id,
|
||||
Position = stab.Frame.Origin,
|
||||
Rotation = stab.Frame.Orientation,
|
||||
MeshRefs = Array.Empty<MeshRef>(),
|
||||
});
|
||||
};
|
||||
stabEntity.RefreshAabb(); // A.5 T18: populate cached AABB at construction
|
||||
result.Add(stabEntity);
|
||||
}
|
||||
|
||||
foreach (var building in info.Buildings)
|
||||
{
|
||||
if (!IsSupported(building.ModelId))
|
||||
continue;
|
||||
result.Add(new WorldEntity
|
||||
var buildingEntity = new WorldEntity
|
||||
{
|
||||
Id = nextId++,
|
||||
SourceGfxObjOrSetupId = building.ModelId,
|
||||
Position = building.Frame.Origin,
|
||||
Rotation = building.Frame.Orientation,
|
||||
MeshRefs = Array.Empty<MeshRef>(),
|
||||
});
|
||||
};
|
||||
buildingEntity.RefreshAabb(); // A.5 T18: populate cached AABB at construction
|
||||
result.Add(buildingEntity);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue