mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-01-05 04:48:19 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
35 lines
788 B
C#
35 lines
788 B
C#
using Sandbox.Rendering;
|
|
|
|
namespace Sandbox;
|
|
|
|
/// <summary>
|
|
/// Applies a sharpen effect to the camera
|
|
/// </summary>
|
|
[Title( "Sharpen" )]
|
|
[Category( "Post Processing" )]
|
|
[Icon( "deblur" )]
|
|
public sealed class Sharpen : BasePostProcess<Sharpen>
|
|
{
|
|
[Range( 0, 5 )]
|
|
[Property] public float Scale { get; set; } = 2;
|
|
|
|
[Range( 0, 5 )]
|
|
[Property] public float TexelSize { get; set; } = 1;
|
|
|
|
public override void Render()
|
|
{
|
|
var shader = Material.FromShader( "shaders/postprocess/pp_sharpen.shader" );
|
|
|
|
float scale = GetWeighted( x => x.Scale );
|
|
|
|
if ( scale <= 0f )
|
|
return;
|
|
|
|
Attributes.Set( "strength", scale );
|
|
Attributes.Set( "size", GetWeighted( x => x.TexelSize ) );
|
|
|
|
var blit = BlitMode.WithBackbuffer( shader, Stage.AfterPostProcess, 1 );
|
|
Blit( blit, "Sharpen" );
|
|
}
|
|
}
|