2023-11-23 21:31:23 +00:00
|
|
|
using Jukebox;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.Rendering.PostProcessing;
|
2024-03-11 21:21:51 +00:00
|
|
|
using XPostProcessing;
|
2023-11-23 21:31:23 +00:00
|
|
|
|
|
|
|
namespace HeavenStudio
|
|
|
|
{
|
|
|
|
public class PostProcessingVFX : MonoBehaviour
|
|
|
|
{
|
|
|
|
private PostProcessVolume _volume;
|
|
|
|
|
|
|
|
// events
|
|
|
|
private List<RiqEntity> _vignettes = new();
|
|
|
|
private List<RiqEntity> _cabbs = new();
|
|
|
|
private List<RiqEntity> _blooms = new();
|
|
|
|
private List<RiqEntity> _lensDs = new();
|
|
|
|
private List<RiqEntity> _grains = new();
|
|
|
|
private List<RiqEntity> _colorGradings = new();
|
2024-03-11 21:21:51 +00:00
|
|
|
private List<RiqEntity> _retroTvs = new();
|
|
|
|
private List<RiqEntity> _scanJitters = new();
|
|
|
|
private List<RiqEntity> _gaussBlurs = new();
|
|
|
|
private List<RiqEntity> _analogNoises = new();
|
|
|
|
private List<RiqEntity> _screenJumps = new();
|
|
|
|
private List<RiqEntity> _sobelNeons = new();
|
2024-04-28 02:45:33 +00:00
|
|
|
private List<RiqEntity> _pixelizeQuads = new();
|
|
|
|
|
2023-11-23 21:31:23 +00:00
|
|
|
private void Awake()
|
|
|
|
{
|
|
|
|
_volume = GetComponent<PostProcessVolume>();
|
2024-03-11 21:21:51 +00:00
|
|
|
UpdateRetroTV();
|
|
|
|
UpdateAnalogNoise();
|
|
|
|
UpdateSobelNeons();
|
2024-04-28 02:45:33 +00:00
|
|
|
UpdatePixelizes();
|
2024-03-11 21:21:51 +00:00
|
|
|
|
2023-11-23 21:31:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void Start()
|
|
|
|
{
|
|
|
|
GameManager.instance.onBeatChanged += OnBeatChanged;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void OnBeatChanged(double beat)
|
|
|
|
{
|
|
|
|
_vignettes = EventCaller.GetAllInGameManagerList("vfx", new string[] { "vignette" });
|
|
|
|
_cabbs = EventCaller.GetAllInGameManagerList("vfx", new string[] { "cabb" });
|
|
|
|
_blooms = EventCaller.GetAllInGameManagerList("vfx", new string[] { "bloom" });
|
|
|
|
_lensDs = EventCaller.GetAllInGameManagerList("vfx", new string[] { "lensD" });
|
|
|
|
_grains = EventCaller.GetAllInGameManagerList("vfx", new string[] { "grain" });
|
|
|
|
_colorGradings = EventCaller.GetAllInGameManagerList("vfx", new string[] { "colorGrading" });
|
2024-03-11 21:21:51 +00:00
|
|
|
_retroTvs = EventCaller.GetAllInGameManagerList("vfx", new string[] { "retroTv" });
|
|
|
|
_scanJitters = EventCaller.GetAllInGameManagerList("vfx", new string[] {"scanJitter"});
|
|
|
|
_gaussBlurs = EventCaller.GetAllInGameManagerList("vfx", new string[] {"gaussBlur"});
|
|
|
|
_analogNoises = EventCaller.GetAllInGameManagerList("vfx", new string[] {"analogNoise"});
|
|
|
|
_screenJumps = EventCaller.GetAllInGameManagerList("vfx", new string[] {"screenJump"});
|
|
|
|
_sobelNeons = EventCaller.GetAllInGameManagerList("vfx", new string[] {"sobelNeon"});
|
2024-04-28 02:45:33 +00:00
|
|
|
_pixelizeQuads = EventCaller.GetAllInGameManagerList("vfx", new string [] {"pixelQuad"});
|
2023-11-23 21:31:23 +00:00
|
|
|
|
|
|
|
UpdateVignette();
|
|
|
|
UpdateChromaticAbberations();
|
|
|
|
UpdateBlooms();
|
|
|
|
UpdateLensDistortions();
|
|
|
|
UpdateGrain();
|
|
|
|
UpdateColorGrading();
|
2024-03-11 21:21:51 +00:00
|
|
|
UpdateRetroTV();
|
|
|
|
UpdateScanJitter();
|
|
|
|
UpdateGaussBlur();
|
|
|
|
UpdateAnalogNoise();
|
|
|
|
UpdateScreenJumps();
|
|
|
|
UpdateSobelNeons();
|
2024-04-28 02:45:33 +00:00
|
|
|
UpdatePixelizes();
|
2024-03-11 21:21:51 +00:00
|
|
|
|
2023-11-23 21:31:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void Update()
|
|
|
|
{
|
|
|
|
UpdateVignette();
|
|
|
|
UpdateChromaticAbberations();
|
|
|
|
UpdateBlooms();
|
|
|
|
UpdateLensDistortions();
|
|
|
|
UpdateGrain();
|
|
|
|
UpdateColorGrading();
|
2024-03-11 21:21:51 +00:00
|
|
|
UpdateRetroTV();
|
|
|
|
UpdateScanJitter();
|
|
|
|
UpdateGaussBlur();
|
|
|
|
UpdateAnalogNoise();
|
|
|
|
UpdateScreenJumps();
|
|
|
|
UpdateSobelNeons();
|
2024-04-28 02:45:33 +00:00
|
|
|
UpdatePixelizes();
|
2024-03-11 21:21:51 +00:00
|
|
|
|
2023-11-23 21:31:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void UpdateVignette()
|
|
|
|
{
|
|
|
|
if (!_volume.profile.TryGetSettings<Vignette>(out var v)) return;
|
|
|
|
|
|
|
|
v.enabled.Override(false);
|
|
|
|
foreach (var e in _vignettes)
|
|
|
|
{
|
|
|
|
float normalized = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
|
|
|
if (normalized < 0) break;
|
|
|
|
|
|
|
|
float clampNormal = Mathf.Clamp01(normalized);
|
|
|
|
var func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease)e["ease"]);
|
|
|
|
|
|
|
|
float newIntensity = func(e["intenStart"], e["intenEnd"], clampNormal);
|
|
|
|
|
|
|
|
v.enabled.Override(newIntensity != 0);
|
|
|
|
if (!v.enabled) continue;
|
|
|
|
v.rounded.Override(e["rounded"]);
|
|
|
|
|
|
|
|
Color newColor = ColorEase(e["colorStart"], e["colorEnd"], clampNormal, func);
|
|
|
|
|
|
|
|
v.color.Override(newColor);
|
|
|
|
|
|
|
|
v.intensity.Override(newIntensity);
|
|
|
|
|
|
|
|
float newSmoothness = func(e["smoothStart"], e["smoothEnd"], clampNormal);
|
|
|
|
v.smoothness.Override(newSmoothness);
|
|
|
|
|
|
|
|
float newRoundness = func(e["roundStart"], e["roundEnd"], clampNormal);
|
|
|
|
v.roundness.Override(newRoundness);
|
2024-04-17 22:01:46 +00:00
|
|
|
|
|
|
|
float newXPos = func(e["xLocStart"], e["xLocEnd"], clampNormal);
|
|
|
|
float newYPos = func(e["yLocStart"], e["yLocEnd"], clampNormal);
|
|
|
|
v.center.Override( new Vector2Parameter { value = new Vector2(newXPos, newYPos) });
|
2023-11-23 21:31:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void UpdateChromaticAbberations()
|
|
|
|
{
|
|
|
|
if (!_volume.profile.TryGetSettings<ChromaticAberration>(out var c)) return;
|
|
|
|
c.enabled.Override(false);
|
|
|
|
foreach (var e in _cabbs)
|
|
|
|
{
|
|
|
|
float normalized = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
|
|
|
if (normalized < 0) break;
|
|
|
|
|
|
|
|
float clampNormal = Mathf.Clamp01(normalized);
|
|
|
|
var func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease)e["ease"]);
|
|
|
|
|
|
|
|
float newIntensity = func(e["intenStart"], e["intenEnd"], clampNormal);
|
|
|
|
c.enabled.Override(newIntensity != 0);
|
|
|
|
if (!c.enabled) continue;
|
|
|
|
c.intensity.Override(newIntensity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void UpdateBlooms()
|
|
|
|
{
|
|
|
|
if (!_volume.profile.TryGetSettings<Bloom>(out var b)) return;
|
|
|
|
b.enabled.Override(false);
|
|
|
|
foreach (var e in _blooms)
|
|
|
|
{
|
|
|
|
float normalized = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
|
|
|
if (normalized < 0) break;
|
|
|
|
|
|
|
|
float clampNormal = Mathf.Clamp01(normalized);
|
|
|
|
var func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease)e["ease"]);
|
|
|
|
|
|
|
|
float newIntensity = func(e["intenStart"], e["intenEnd"], clampNormal);
|
|
|
|
b.enabled.Override(newIntensity != 0);
|
|
|
|
if (!b.enabled) continue;
|
|
|
|
b.intensity.Override(newIntensity);
|
|
|
|
|
|
|
|
Color newColor = ColorEase(e["colorStart"], e["colorEnd"], clampNormal, func);
|
|
|
|
|
|
|
|
b.color.Override(newColor);
|
|
|
|
|
|
|
|
float newThreshold = func(e["thresholdStart"], e["thresholdEnd"], clampNormal);
|
|
|
|
b.threshold.Override(newThreshold);
|
|
|
|
|
|
|
|
float newSoftKnee = func(e["softKneeStart"], e["softKneeEnd"], clampNormal);
|
|
|
|
b.softKnee.Override(newSoftKnee);
|
|
|
|
|
|
|
|
float newAna = func(e["anaStart"], e["anaEnd"], clampNormal);
|
|
|
|
b.anamorphicRatio.Override(newAna);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void UpdateLensDistortions()
|
|
|
|
{
|
|
|
|
if (!_volume.profile.TryGetSettings<LensDistortion>(out var l)) return;
|
|
|
|
l.enabled.Override(false);
|
|
|
|
foreach (var e in _lensDs)
|
|
|
|
{
|
|
|
|
float normalized = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
|
|
|
if (normalized < 0) break;
|
|
|
|
|
|
|
|
float clampNormal = Mathf.Clamp01(normalized);
|
|
|
|
var func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease)e["ease"]);
|
|
|
|
|
|
|
|
float newIntensity = func(e["intenStart"], e["intenEnd"], clampNormal);
|
|
|
|
l.enabled.Override(newIntensity != 0);
|
|
|
|
if (!l.enabled) continue;
|
|
|
|
l.intensity.Override(newIntensity);
|
|
|
|
|
|
|
|
float newX = func(e["xStart"], e["xEnd"], clampNormal);
|
|
|
|
l.intensityX.Override(newX);
|
|
|
|
|
|
|
|
float newY = func(e["yStart"], e["yEnd"], clampNormal);
|
|
|
|
l.intensityY.Override(newY);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void UpdateGrain()
|
|
|
|
{
|
|
|
|
if (!_volume.profile.TryGetSettings<Grain>(out var g)) return;
|
|
|
|
g.enabled.Override(false);
|
|
|
|
foreach (var e in _grains)
|
|
|
|
{
|
|
|
|
float normalized = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
|
|
|
if (normalized < 0) break;
|
|
|
|
|
|
|
|
float clampNormal = Mathf.Clamp01(normalized);
|
|
|
|
var func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease)e["ease"]);
|
|
|
|
|
|
|
|
float newIntensity = func(e["intenStart"], e["intenEnd"], clampNormal);
|
|
|
|
g.enabled.Override(newIntensity != 0);
|
|
|
|
if (!g.enabled) continue;
|
|
|
|
g.intensity.Override(newIntensity);
|
|
|
|
g.colored.Override(e["colored"]);
|
|
|
|
|
|
|
|
float newSize = func(e["sizeStart"], e["sizeEnd"], clampNormal);
|
|
|
|
g.size.Override(newSize);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void UpdateColorGrading()
|
|
|
|
{
|
|
|
|
if (!_volume.profile.TryGetSettings<ColorGrading>(out var c)) return;
|
|
|
|
c.enabled.Override(false);
|
|
|
|
foreach (var e in _colorGradings)
|
|
|
|
{
|
|
|
|
c.enabled.Override(true);
|
|
|
|
float normalized = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
|
|
|
if (normalized < 0) break;
|
|
|
|
|
|
|
|
float clampNormal = Mathf.Clamp01(normalized);
|
|
|
|
var func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease)e["ease"]);
|
|
|
|
|
|
|
|
float newTemp = func(e["tempStart"], e["tempEnd"], clampNormal);
|
|
|
|
c.temperature.Override(newTemp);
|
|
|
|
|
|
|
|
float newTint = func(e["tintStart"], e["tintEnd"], clampNormal);
|
|
|
|
c.tint.Override(newTint);
|
|
|
|
|
|
|
|
Color newColor = ColorEase(e["colorStart"], e["colorEnd"], clampNormal, func);
|
|
|
|
c.colorFilter.Override(newColor);
|
|
|
|
|
|
|
|
float newHue = func(e["hueShiftStart"], e["hueShiftEnd"], clampNormal);
|
|
|
|
c.hueShift.Override(newHue);
|
|
|
|
|
|
|
|
float newSat = func(e["satStart"], e["satEnd"], clampNormal);
|
|
|
|
c.saturation.Override(newSat);
|
|
|
|
|
|
|
|
float newBright = func(e["brightStart"], e["brightEnd"], clampNormal);
|
|
|
|
c.brightness.Override(newBright);
|
|
|
|
|
|
|
|
float newCon = func(e["conStart"], e["conEnd"], clampNormal);
|
|
|
|
c.contrast.Override(newCon);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-11 21:21:51 +00:00
|
|
|
private void UpdateRetroTV()
|
|
|
|
{
|
2024-08-29 18:45:21 +00:00
|
|
|
UpdateVHS();
|
2024-03-11 21:21:51 +00:00
|
|
|
if (!_volume.profile.TryGetSettings<CRT>(out var t)) return;
|
|
|
|
t.enabled.Override(false);
|
|
|
|
foreach (var e in _retroTvs)
|
|
|
|
{
|
|
|
|
float normalized = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
|
|
|
if (normalized < 0) break;
|
|
|
|
|
|
|
|
float clampNormal = Mathf.Clamp01(normalized);
|
|
|
|
var func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease)e["ease"]);
|
|
|
|
|
|
|
|
float newIntensity = func(e["intenStart"], e["intenEnd"], clampNormal);
|
|
|
|
t.enabled.Override(newIntensity != 0);
|
|
|
|
if (!t.enabled) continue;
|
|
|
|
t.distort.Override(newIntensity);
|
|
|
|
|
|
|
|
float newRGBBlend = func(e["rgbStart"], e["rgbEnd"], clampNormal);
|
|
|
|
t.RGBBlend.Override(newRGBBlend);
|
|
|
|
|
|
|
|
float newBottomCollapse = func(e["bottomStart"], e["bottomEnd"], clampNormal);
|
|
|
|
t.BottomCollapse.Override(newBottomCollapse);
|
|
|
|
|
|
|
|
float newNoiseAmount = func(e["noiseStart"], e["noiseEnd"], clampNormal);
|
|
|
|
t.NoiseAmount.Override(newNoiseAmount);
|
|
|
|
}
|
2024-08-29 18:45:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void UpdateVHS()
|
|
|
|
{
|
|
|
|
if (!_volume.profile.TryGetSettings<VHS>(out var tb)) return;
|
|
|
|
tb.enabled.Override(false);
|
|
|
|
foreach (var e in _retroTvs)
|
|
|
|
{
|
|
|
|
|
|
|
|
float normalized = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
|
|
|
if (normalized < 0) break;
|
|
|
|
|
|
|
|
tb.enabled.Override(e["HSonVHS"]);
|
|
|
|
if (!tb.enabled) return;
|
|
|
|
|
|
|
|
float clampNormal = Mathf.Clamp01(normalized);
|
|
|
|
var func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease)e["ease"]);
|
|
|
|
|
|
|
|
float newBleedIntensity = func(e["bleedIntStart"], e["bleedIntEnd"], clampNormal);
|
|
|
|
tb.colorBleedingIntensity.Override(newBleedIntensity);
|
|
|
|
|
|
|
|
tb.colorBleedIterations.Override(e["bleedIteration"]) ;
|
|
|
|
|
|
|
|
float newGrainIntensity = func(e["vhsGrainStart"], e["vhsGrainEnd"], clampNormal);
|
|
|
|
tb.grainIntensity.Override(newGrainIntensity);
|
|
|
|
|
|
|
|
float newGrainScale = func(e["grainScaleStart"], e["grainScaleEnd"], clampNormal);
|
|
|
|
tb.grainScale.Override(newGrainScale);
|
|
|
|
|
|
|
|
float newStripeDensity = func(e["stripeDenStart"], e["stripeDenEnd"], clampNormal);
|
|
|
|
tb.stripeNoiseDensity.Override(newStripeDensity);
|
|
|
|
|
|
|
|
float newStripeOpacity = func(e["stripeOpacStart"], e["stripeOpacEnd"], clampNormal);
|
|
|
|
tb.stripeNoiseOpacity.Override(newStripeOpacity);
|
|
|
|
|
|
|
|
float newEdgeSharpness = func(e["edgeIntStart"], e["edgeIntEnd"], clampNormal);
|
|
|
|
tb.edgeIntensity.Override(newEdgeSharpness);
|
|
|
|
|
|
|
|
float newEdgeDistance = func(e["edgeDistStart"], e["edgeDistEnd"], clampNormal);
|
|
|
|
tb.edgeDistance.Override(newEdgeDistance);
|
|
|
|
|
|
|
|
}
|
2024-03-11 21:21:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void UpdateScanJitter()
|
|
|
|
{
|
|
|
|
if (!_volume.profile.TryGetSettings<GlitchScanLineJitter>(out var j)) return;
|
|
|
|
j.enabled.Override(false);
|
|
|
|
foreach (var e in _scanJitters)
|
|
|
|
{
|
|
|
|
float normalized = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
|
|
|
if (normalized < 0) break;
|
|
|
|
|
|
|
|
float clampNormal = Mathf.Clamp01(normalized);
|
|
|
|
var func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease)e["ease"]);
|
|
|
|
|
|
|
|
float newIntensity = func(e["intenStart"], e["intenEnd"], clampNormal);
|
|
|
|
j.enabled.Override(newIntensity != 0);
|
|
|
|
if (!j.enabled) continue;
|
|
|
|
j.JitterIndensity.Override(newIntensity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void UpdateGaussBlur()
|
|
|
|
{
|
|
|
|
if (!_volume.profile.TryGetSettings<GaussianBlur>(out var g)) return;
|
|
|
|
g.enabled.Override(false);
|
|
|
|
foreach (var e in _gaussBlurs)
|
|
|
|
{
|
|
|
|
float normalized = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
|
|
|
if (normalized < 0) break;
|
|
|
|
|
|
|
|
float clampNormal = Mathf.Clamp01(normalized);
|
|
|
|
var func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease)e["ease"]);
|
|
|
|
|
|
|
|
float newIntensity = func(e["intenStart"], e["intenEnd"], clampNormal);
|
|
|
|
g.enabled.Override(newIntensity != 0);
|
|
|
|
if (!g.enabled) continue;
|
|
|
|
g.BlurRadius.Override(newIntensity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void UpdateAnalogNoise()
|
|
|
|
{
|
|
|
|
if (!_volume.profile.TryGetSettings<GlitchAnalogNoise>(out var n)) return;
|
|
|
|
n.enabled.Override(false);
|
|
|
|
foreach (var e in _analogNoises)
|
|
|
|
{
|
|
|
|
float normalized = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
|
|
|
if (normalized < 0) break;
|
|
|
|
|
|
|
|
float clampNormal = Mathf.Clamp01(normalized);
|
|
|
|
var func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease)e["ease"]);
|
|
|
|
|
|
|
|
float newIntensity = func(e["intenStart"], e["intenEnd"], clampNormal);
|
|
|
|
n.enabled.Override(newIntensity != 0);
|
|
|
|
if (!n.enabled) continue;
|
|
|
|
n.NoiseSpeed.Override(newIntensity);
|
|
|
|
|
|
|
|
float newFading = func(e["fadingStart"], e["fadingEnd"], clampNormal);
|
|
|
|
n.NoiseFading.Override(newFading);
|
|
|
|
|
|
|
|
float newThreshold = func(e["thresholdStart"], e["thresholdEnd"], clampNormal);
|
|
|
|
n.LuminanceJitterThreshold.Override(newThreshold);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void UpdateScreenJumps()
|
|
|
|
{
|
|
|
|
if (!_volume.profile.TryGetSettings<GlitchScreenJump>(out var sj)) return;
|
|
|
|
sj.enabled.Override(false);
|
|
|
|
foreach (var e in _screenJumps)
|
|
|
|
{
|
|
|
|
float normalized = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
|
|
|
if (normalized < 0) break;
|
|
|
|
|
|
|
|
float clampNormal = Mathf.Clamp01(normalized);
|
|
|
|
var func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease)e["ease"]);
|
|
|
|
|
|
|
|
float newIntensity = func(e["intenStart"], e["intenEnd"], clampNormal);
|
|
|
|
sj.enabled.Override(newIntensity != 0);
|
|
|
|
if (!sj.enabled) continue;
|
|
|
|
sj.ScreenJumpIndensity.Override(newIntensity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void UpdateSobelNeons()
|
|
|
|
{
|
|
|
|
if (!_volume.profile.TryGetSettings<EdgeDetectionSobelNeonV2>(out var sn)) return;
|
|
|
|
sn.enabled.Override(false);
|
|
|
|
foreach (var e in _sobelNeons)
|
|
|
|
{
|
|
|
|
float normalized = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
|
|
|
if (normalized < 0) break;
|
|
|
|
|
|
|
|
float clampNormal = Mathf.Clamp01(normalized);
|
|
|
|
var func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease)e["ease"]);
|
|
|
|
|
|
|
|
float newIntensity = func(e["intenStart"], e["intenEnd"], clampNormal);
|
|
|
|
sn.enabled.Override(newIntensity != 0.1);
|
|
|
|
if (!sn.enabled) continue;
|
|
|
|
sn.EdgeNeonFade.Override(newIntensity);
|
|
|
|
|
|
|
|
float newEdgeWidth = func(e["edgeWidthStart"], e["edgeWidthEnd"], clampNormal);
|
|
|
|
sn.EdgeWidth.Override(newEdgeWidth);
|
|
|
|
|
|
|
|
float newBgFade = func(e["bgFadeStart"], e["bgFadeEnd"], clampNormal);
|
|
|
|
sn.BackgroundFade.Override(newBgFade);
|
|
|
|
|
|
|
|
float newBrightness = func(e["brightnessStart"], e["brightnessEnd"], clampNormal);
|
|
|
|
sn.Brigtness.Override(newBrightness);
|
2024-04-17 22:01:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-11 21:21:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-04-28 02:45:33 +00:00
|
|
|
private void UpdatePixelizes()
|
|
|
|
{
|
|
|
|
if (!_volume.profile.TryGetSettings<PixelizeQuad>(out var pq)) return;
|
|
|
|
pq.enabled.Override(false);
|
|
|
|
foreach (var e in _pixelizeQuads)
|
|
|
|
{
|
|
|
|
float normalized = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
|
|
|
if (normalized < 0) break;
|
|
|
|
|
|
|
|
float clampNormal = Mathf.Clamp01(normalized);
|
|
|
|
var func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease)e["ease"]);
|
|
|
|
|
|
|
|
float newPixelSize = func(e["pixelSizeStart"], e["pixelSizeEnd"], clampNormal);
|
|
|
|
pq.enabled.Override(newPixelSize != 0);
|
|
|
|
if (!pq.enabled) continue;
|
|
|
|
pq.pixelSize.Override(newPixelSize);
|
|
|
|
|
|
|
|
float newPixelRatio = func(e["ratioStart"], e["ratioEnd"], clampNormal);
|
|
|
|
if (!pq.enabled) continue;
|
|
|
|
pq.pixelRatio.Override(newPixelRatio);
|
|
|
|
|
|
|
|
float newPixelXScale = func(e["xScaleStart"], e["xScaleEnd"], clampNormal);
|
|
|
|
if (!pq.enabled) continue;
|
|
|
|
pq.pixelScaleX.Override(newPixelXScale);
|
|
|
|
|
|
|
|
float newPixelYScale = func(e["yScaleStart"], e["yScaleEnd"], clampNormal);
|
|
|
|
if (!pq.enabled) continue;
|
|
|
|
pq.pixelScaleY.Override(newPixelYScale);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-23 21:31:23 +00:00
|
|
|
private Color ColorEase(Color start, Color end, float time, Util.EasingFunction.Function func)
|
|
|
|
{
|
|
|
|
float newR = func(start.r, end.r, time);
|
|
|
|
float newG = func(start.g, end.g, time);
|
|
|
|
float newB = func(start.b, end.b, time);
|
|
|
|
|
|
|
|
return new Color(newR, newG, newB, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|