Files
sbox-public/engine/Sandbox.Engine/Scene/Components/PostProcessing/PostProcess.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

56 lines
1.2 KiB
C#

using Sandbox.Rendering;
namespace Sandbox;
/// <summary>
/// Adds an effect to the camera
/// </summary>
[Obsolete( "Switch to use BasePostProcess<>" )]
public abstract class PostProcess : Component, Component.DontExecuteOnServer
{
[RequireComponent]
public CameraComponent Camera { get; set; }
/// <summary>
/// The stage in the render pipeline that we'll get rendered in
/// </summary>
protected virtual Stage RenderStage => Stage.AfterPostProcess;
/// <summary>
/// Lower numbers get renderered first
/// </summary>
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();
}
/// <summary>
/// You should implement this method and fill the CommandList with the actions
/// that you want to do for this post process.
/// </summary>
protected virtual void UpdateCommandList()
{
}
}