大修
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using Echovoid.Runtime.Behavior.Rendering;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
|
||||
namespace SLSUtilities.Rendering.PostProcessing
|
||||
{
|
||||
[System.Serializable, VolumeComponentMenu("SLS/Postprocessing/RGBSplitGlitch")]
|
||||
public class RGBSplitGlitch : ScriptablePostProcessorVolume
|
||||
{
|
||||
public override CustomPostProcessInjectionPoint InjectionPoint => CustomPostProcessInjectionPoint.BeforePostProcess;
|
||||
public override int OrderInInjectionPoint => 0;
|
||||
|
||||
public ClampedFloatParameter intensity = new(0f, 0f, 1f);
|
||||
public ClampedFloatParameter speed = new(10f, 0f, 100f);
|
||||
public override string GetShaderName() => "SLS/Postprocessing/RGBSplitGlitch";
|
||||
|
||||
private float elapsedTime = 1.0f;
|
||||
|
||||
public override void Render(CommandBuffer cmd, ref RenderingData renderingData, RTHandle source, RTHandle destination)
|
||||
{
|
||||
if (material == null) return;
|
||||
elapsedTime += Time.unscaledDeltaTime;
|
||||
if (elapsedTime > 100)
|
||||
{
|
||||
elapsedTime = 0;
|
||||
}
|
||||
cmd.SetGlobalVector(InternalShaderHelpers.ID._RGBSplitGlitchParams,
|
||||
new Vector4(intensity.value * 0.01f, Mathf.Floor(elapsedTime * speed.value)));
|
||||
Blitter.BlitCameraTexture(cmd, source, destination, material, 0);
|
||||
}
|
||||
|
||||
public override bool IsActive() => intensity.value > 0f;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user