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:
parent
85239fb373
commit
28e1cf8029
25 changed files with 2679 additions and 844 deletions
|
|
@ -33,6 +33,11 @@ internal interface IRenderFrameClearPhase
|
|||
RenderFrameFoundation Clear();
|
||||
}
|
||||
|
||||
internal interface IRenderFrameFoundationSource
|
||||
{
|
||||
RenderFrameFoundation Foundation { get; }
|
||||
}
|
||||
|
||||
internal interface IRenderFrameLivePreparation
|
||||
{
|
||||
void Prepare(int gpuSlot);
|
||||
|
|
@ -43,7 +48,9 @@ internal interface IRenderFrameLivePreparation
|
|||
/// typed phases preserve resource begin, clear/state, then live publication
|
||||
/// order without exposing a renderer service bag.
|
||||
/// </summary>
|
||||
internal sealed class RenderFrameResourceController : IRenderFrameResourcePhase
|
||||
internal sealed class RenderFrameResourceController :
|
||||
IRenderFrameResourcePhase,
|
||||
IRenderFrameFoundationSource
|
||||
{
|
||||
private readonly IRenderFrameSlotSource _frameSlots;
|
||||
private readonly IRenderFrameBeginResources _resources;
|
||||
|
|
@ -162,6 +169,7 @@ internal sealed class RuntimeRenderFrameClearPhase : IRenderFrameClearPhase
|
|||
private readonly IRenderFramePortalStateSource _portal;
|
||||
private readonly ParticleVisibilityController _particleVisibility;
|
||||
private readonly WorldRenderDiagnostics _diagnostics;
|
||||
private readonly IRenderFrameGlState _frameGlState;
|
||||
|
||||
public RuntimeRenderFrameClearPhase(
|
||||
GL gl,
|
||||
|
|
@ -169,7 +177,8 @@ internal sealed class RuntimeRenderFrameClearPhase : IRenderFrameClearPhase
|
|||
WeatherSystem weather,
|
||||
IRenderFramePortalStateSource portal,
|
||||
ParticleVisibilityController particleVisibility,
|
||||
WorldRenderDiagnostics diagnostics)
|
||||
WorldRenderDiagnostics diagnostics,
|
||||
IRenderFrameGlState frameGlState)
|
||||
{
|
||||
_gl = gl ?? throw new ArgumentNullException(nameof(gl));
|
||||
_worldTime = worldTime ?? throw new ArgumentNullException(nameof(worldTime));
|
||||
|
|
@ -178,6 +187,8 @@ internal sealed class RuntimeRenderFrameClearPhase : IRenderFrameClearPhase
|
|||
_particleVisibility = particleVisibility
|
||||
?? throw new ArgumentNullException(nameof(particleVisibility));
|
||||
_diagnostics = diagnostics ?? throw new ArgumentNullException(nameof(diagnostics));
|
||||
_frameGlState = frameGlState
|
||||
?? throw new ArgumentNullException(nameof(frameGlState));
|
||||
}
|
||||
|
||||
public RenderFrameFoundation Clear()
|
||||
|
|
@ -203,13 +214,11 @@ internal sealed class RuntimeRenderFrameClearPhase : IRenderFrameClearPhase
|
|||
1f);
|
||||
}
|
||||
|
||||
_gl.DepthMask(true);
|
||||
_frameGlState.RestoreFrameDefaults();
|
||||
_gl.Clear(
|
||||
ClearBufferMask.ColorBufferBit
|
||||
| ClearBufferMask.DepthBufferBit
|
||||
| ClearBufferMask.StencilBufferBit);
|
||||
_gl.CullFace(TriangleFace.Back);
|
||||
_gl.FrontFace(FrontFaceDirection.CW);
|
||||
_diagnostics.EmitGlStateTripwireIfChanged(
|
||||
AcDream.Core.Rendering.RenderingDiagnostics.ProbeGlStateEnabled);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue