From 76745de7a04e46d18319c734067fa49641370014 Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 30 Sep 2021 09:39:47 +0800 Subject: *Unit Preprocessing --- Assets/Scripts/Unit/LensEffect/LensEffect_Buzz.cs | 41 +++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Assets/Scripts/Unit/LensEffect/LensEffect_Buzz.cs (limited to 'Assets/Scripts/Unit/LensEffect/LensEffect_Buzz.cs') diff --git a/Assets/Scripts/Unit/LensEffect/LensEffect_Buzz.cs b/Assets/Scripts/Unit/LensEffect/LensEffect_Buzz.cs new file mode 100644 index 00000000..55e8c772 --- /dev/null +++ b/Assets/Scripts/Unit/LensEffect/LensEffect_Buzz.cs @@ -0,0 +1,41 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Rendering; + +// 蜂鸣 +public class LensEffect_Buzz : LensEffectBase +{ + public override ERenderingEvent renderingEvents => ERenderingEvent.AfterForwardAlpha; + + public LensEffect_Buzz() : base() + { + + } + + public override void AfterForwardAlpha(EStage stage, CommandBuffer cb) + { + if(stage == EStage.Before) + { + Before(cb); + } + else if(stage == EStage.After) + { + After(cb); + } + } + + void Before(CommandBuffer cb) + { + MaterialEntry buzz = ClaimMaterial(StaticDefine.shaders[EShader.Buzz].name); + + cb.SetGlobalTexture("_UnitDepthTexture", owner.unitPreprocessing.unitDepthTexture); + cb.Blit(BuiltinRenderTextureType.CameraTarget, BuiltinRenderTextureType.CameraTarget, buzz.material); + } + + void After(CommandBuffer cb) + { + + } + +} \ No newline at end of file -- cgit v1.1-26-g67d0