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

@ -3,13 +3,22 @@ using AcDream.Core.Vfx;
namespace AcDream.App.Rendering.Vfx;
internal interface IWorldSceneParticleVisibility
{
void MarkVisibleCells(HashSet<uint> cellIds);
void CompleteFrame();
void AbortFrame();
}
/// <summary>
/// Bridges the retained retail PView result into the next physics update's
/// <c>CObjCell::IsInView</c> particle gate. The controller owns only immutable
/// frame meaning: one completed viewer position plus the AC cells admitted by
/// that completed view. It neither creates emitters nor performs rendering.
/// </summary>
public sealed class ParticleVisibilityController
public sealed class ParticleVisibilityController : IWorldSceneParticleVisibility
{
public const float ExtendedRangeMultiplier = 2f;
@ -70,6 +79,15 @@ public sealed class ParticleVisibilityController
_hasCompletedWorldView = true;
}
/// <summary>Discards the in-progress visibility product while preserving
/// the last completed view consumed by the update thread.</summary>
public void AbortFrame()
{
_buildingCellIds.Clear();
_frameUsesWorldView = false;
_frameOpen = false;
}
public void Apply(ParticleSystem particles, float rangeMultiplier)
{
ArgumentNullException.ThrowIfNull(particles);