refactor(render): extract world scene frame owner

Move fallback and PView world drawing, shared alpha, particles, visibility, selection, and diagnostics behind focused frame owners. Make exceptional frames failure-atomic by restoring the shared GL baseline and preserving primary alpha failures through cleanup.

Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-22 07:22:09 +02:00
parent 85239fb373
commit 28e1cf8029
25 changed files with 2679 additions and 844 deletions

View file

@ -45,6 +45,29 @@ public sealed class RetailSelectionSceneTests
Assert.False(scene.TryGetLighting(entity.ServerGuid, entity.Id, out _));
}
[Fact]
public void AbortFrame_DiscardsBuildingSelectionAndPreservesPublishedFrame()
{
var scene = CreateScene();
var published = Entity(localId: 46u, serverGuid: 0x5000_0046u);
Publish(scene, published);
var rejected = Entity(localId: 47u, serverGuid: 0x5000_0047u);
scene.BeginFrame();
(Matrix4x4 view, Matrix4x4 projection) = Camera();
scene.SetViewFrustum(FrustumPlanes.FromViewProjection(view * projection));
scene.AddVisiblePart(
rejected,
partIndex: 0,
gfxObjId: 0x0100_0001u,
Matrix4x4.CreateTranslation(0f, 0f, -5f));
scene.AbortFrame();
RetailSelectionHit? hit = PickCenter(scene);
Assert.NotNull(hit);
Assert.Equal(published.Id, hit.Value.LocalEntityId);
}
private static RetailSelectionScene CreateScene(
RetailSelectionLightingPulse? pulse = null)
{