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

@ -325,25 +325,32 @@ public sealed class WorldRenderFrameBuilderTests
}
[Fact]
public void Game_window_uses_the_typed_builder_and_releases_it_before_render_owners()
public void World_scene_uses_the_typed_builder_and_game_window_releases_it_before_render_owners()
{
string source = GameWindowSource();
string gameWindow = GameWindowSource();
string worldScene = File.ReadAllText(Path.Combine(
FindRepoRoot(),
"src",
"AcDream.App",
"Rendering",
"WorldSceneRenderer.cs"));
Assert.Equal(
1,
CountOccurrences(source, "_worldRenderFrameBuilder!.Build("));
Assert.DoesNotContain("private void UpdateSunFromSky(", source, StringComparison.Ordinal);
Assert.DoesNotContain("private void UpdateSkyPes(", source, StringComparison.Ordinal);
Assert.DoesNotContain("private static float ParseEnvFloat(", source, StringComparison.Ordinal);
CountOccurrences(worldScene, "_frames.Build("));
Assert.DoesNotContain("private void UpdateSunFromSky(", gameWindow, StringComparison.Ordinal);
Assert.DoesNotContain("private void UpdateSkyPes(", gameWindow, StringComparison.Ordinal);
Assert.DoesNotContain("private static float ParseEnvFloat(", gameWindow, StringComparison.Ordinal);
AssertAppearsInOrder(
source,
"if (_cameraController is not null && !portalViewportVisible)",
"_retailAlphaQueue.BeginFrame();",
"_worldRenderFrameBuilder!.Build(",
"if (IsLiveModeWaitingForLogin)",
"normalWorldDrawn = true;");
worldScene,
"_alpha.BeginFrame();",
"_frames.Build(",
"if (_login.IsWaitingForLogin)",
"_passes.DrawFlatTerrain(",
"NormalWorldDrawn: true");
AssertAppearsInOrder(
source,
gameWindow,
"_worldSceneRenderer = null;",
"_worldRenderFrameBuilder = null;",
"_skyPesFrame = null;",
"new(\"equipped children\"",