using Echovoid.Runtime.Behavior.Rendering; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; namespace SLSFramework.Rendering.PostProcessing { [System.Serializable, VolumeComponentMenu("Custom/Speed Lines")] public class SpeedLines : ScriptablePostProcessorVolume { public override CustomPostProcessInjectionPoint InjectionPoint => CustomPostProcessInjectionPoint.AfterPostProcess; public override int OrderInInjectionPoint => 20; [Header("Effect Color & Intensity")] public ColorParameter color = new(new Color(1f, 1f, 1f, 0.5f), true, true, true); [Header("Lines")] public FloatParameter speedLinesTiling = new(200f); public ClampedFloatParameter speedLinesRadialScale = new(0.1f, 0f, 10f); public FloatParameter speedLinesPower = new(0f); public ClampedFloatParameter speedLinesRemap = new(1f, 0f, 1f); public FloatParameter speedLinesAnimation = new(3f); [Header("Radial Mask")] public ClampedFloatParameter maskScale = new(1f, 0f, 2f); public ClampedFloatParameter maskHardness = new(0f, 0f, 1f); public FloatParameter maskPower = new(5f); protected override string GetShaderName() => "Hidden/Custom/SpeedLines"; public override bool IsActive() => speedLinesRemap.value < 1f || color.value.a > 0f; public override void Render(CommandBuffer cmd, ref RenderingData renderingData, RTHandle source, RTHandle target) { if (material == null) return; material.SetColor(InternalShaderHelpers.ID._SpeedLinesColour, color.value); material.SetFloat(InternalShaderHelpers.ID._SpeedLinesTiling, speedLinesTiling.value); material.SetFloat(InternalShaderHelpers.ID._SpeedLinesRadialScale, speedLinesRadialScale.value); material.SetFloat(InternalShaderHelpers.ID._SpeedLinesPower, speedLinesPower.value); material.SetFloat(InternalShaderHelpers.ID._SpeedLinesRemap, speedLinesRemap.value); material.SetFloat(InternalShaderHelpers.ID._SpeedLinesAnimation, speedLinesAnimation.value); material.SetFloat(InternalShaderHelpers.ID._MaskScale, maskScale.value); material.SetFloat(InternalShaderHelpers.ID._MaskHardness, maskHardness.value); material.SetFloat(InternalShaderHelpers.ID._MaskPower, maskPower.value); Blitter.BlitCameraTexture(cmd, source, target, material, 0); } } }