using Sandbox.Rendering; namespace Sandbox; /// /// Holds a list of post processing layers for a camera /// internal class PostProcessLayers { public Dictionary> Layers = new(); public void Clear() { Layers.Clear(); } /// /// Add a new post process layer to a specific stage /// public PostProcessLayer CreateLayer( Stage stage ) { PostProcessLayer layer = new(); if ( !Layers.TryGetValue( stage, out var list ) ) { list = []; Layers[stage] = list; } list.Add( layer ); return layer; } /// /// Called for each stage during this camera's render. This is called on the render thread. /// public void OnRenderStage( Stage stage ) { if ( !Layers.TryGetValue( stage, out var list ) ) return; foreach ( var entry in list.OrderBy( x => x.Order ) ) { entry.Render(); } } } internal record struct WeightedEffect { public BasePostProcess Effect; public float Weight; } /// /// A layer is placed on a specific Render Stage is ordered relative to other layers on that stage /// internal class PostProcessLayer { public CommandList CommandList; public int Order; public string Name; /// /// Render this layer /// public void Render() { CommandList.ExecuteOnRenderThread(); } }