Files
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

40 lines
920 B
C#

using Sandbox.Rendering;
namespace Sandbox;
/// <summary>
/// Draw a material over the screen
/// </summary>
[Title( "Blit Overlay" )]
[Category( "Post Processing" )]
[Icon( "grain" )]
public sealed class BlitOverlay : BasePostProcess<BlitOverlay>
{
[Range( 0, 1 )]
[Property] public float Blend { get; set; } = 0.1f;
[Range( 0, 1 )]
[Property] public BlendMode BlendMode { get; set; } = BlendMode.Normal;
[Range( 0, 1 )]
[Property] public Material Material { get; set; }
[Property] public int Order { get; set; }
public override void Render()
{
if ( !Material.IsValid() ) return;
float blend = GetWeighted( x => x.Blend );
if ( blend.AlmostEqual( 0.0f ) ) return;
Attributes.Set( "blend", blend );
Attributes.SetComboEnum( "D_BLENDMODE", BlendMode );
var blit = BlitMode.WithBackbuffer( Material, Stage.AfterPostProcess, Order, true );
Blit( blit, $"Overlay ({Material.Name})" );
}
}