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

@ -64,4 +64,35 @@ public sealed class ParticleVisibilityControllerTests
controller.Apply(particles, 1f);
Assert.False(Assert.Single(particles.EnumerateEmitters()).ViewEligible);
}
[Fact]
public void AbortedFrame_PreservesTheLastCompletedWorldView()
{
var particles = new ParticleSystem(new EmitterDescRegistry(), new Random(1));
int handle = particles.SpawnEmitter(
new EmitterDesc
{
DatId = 0x32000003u,
Type = ParticleType.Still,
MaxDegradeDistance = 100f,
MaxParticles = 1,
},
Vector3.Zero,
attachedObjectId: 42u);
particles.UpdateEmitterOwnerCell(handle, 0x01010001u);
var controller = new ParticleVisibilityController();
controller.BeginFrame(Vector3.Zero);
controller.UseWorldView();
controller.MarkVisibleCells([0x01010001u]);
controller.CompleteFrame();
controller.BeginFrame(new Vector3(1000f, 1000f, 0f));
controller.UseWorldView();
controller.MarkVisibleCells([0x02020001u]);
controller.AbortFrame();
controller.Apply(particles, 1f);
Assert.True(Assert.Single(particles.EnumerateEmitters()).ViewEligible);
}
}