Camera/RetroScreenPostProcess.cs
using Opium;
using Sandbox;
using Sandbox.Rendering;
[Title( "Retro Camera Post Process" )]
[Category( "Post Processing" )]
[Icon( "apps" )]
public class RetroScreenPostProcess : BasePostProcess
{
[ConVar( "op_postprocess" )]
public static bool PostProcessEnabled { get; set; } = true;
static Material effectMaterial = Material.Load( "materials/postprocessing/post_processing.vmat" );
public override void Render()
{
if ( !PostProcessEnabled && !GameSettingsSystem.Current.EnablePostProcessing )
return;
var cl = new CommandList( "DDDownscaler" );
cl.Attributes.Set( "Dithered", GameSettingsSystem.Current.EnableDitheringShader );
cl.Attributes.SetCombo( "D_VERTEX_SNAP", GameSettingsSystem.Current.EnableVertexSnapping );
cl.Attributes.GrabFrameTexture( "ColorBuffer" );
cl.Attributes.GrabDepthTexture( "DepthBuffer" );
cl.Blit( effectMaterial, Attributes );
InsertCommandList( cl, Stage.AfterPostProcess, 500, "DDDownscaler" );
}
}