using Sandbox.Rendering; namespace Sandbox; /// /// Adds an effect to the camera /// [Obsolete( "Switch to use BasePostProcess<>" )] public abstract class PostProcess : Component, Component.DontExecuteOnServer { [RequireComponent] public CameraComponent Camera { get; set; } /// /// The stage in the render pipeline that we'll get rendered in /// protected virtual Stage RenderStage => Stage.AfterPostProcess; /// /// Lower numbers get renderered first /// protected virtual int RenderOrder => 200; protected CommandList CommandList { get; private set; } protected override void OnEnabled() { CommandList = new CommandList( GetType().Name ); Camera.AddCommandList( CommandList, RenderStage, RenderOrder ); } protected override void OnDisabled() { Camera.RemoveCommandList( CommandList ); CommandList = null; } protected override void OnUpdate() { if ( CommandList is null ) return; CommandList.Reset(); UpdateCommandList(); } /// /// You should implement this method and fill the CommandList with the actions /// that you want to do for this post process. /// protected virtual void UpdateCommandList() { } }