Radial Blur
This commit is contained in:
@@ -141,6 +141,7 @@ namespace Ichni.RhythmGame
|
||||
{ "CameraZoom", new CameraZoomEffect(0.2f, 5f,CustomCurvePresets.Parabolic(1,0,1))},
|
||||
{ "CameraTilt", new CameraTiltEffect(0.2f, new Vector3(0, 0, 5), CustomCurvePresets.CustomPeakTimeParabolic(1, 0, 1, 0.3f)) },
|
||||
{ "ChromaticAberration", new ChromaticAberrationEffect(1, 1, CustomCurvePresets.Parabolic(1, 0, 1)) },
|
||||
{ "RadialBlur", new RadialBlurEffect(1,4,0.5f,0.5f, 1, CustomCurvePresets.Parabolic(1,0,1))},
|
||||
{ "Vignette", new VignetteEffect(1, 1, 0.4f, Color.black, CustomCurvePresets.Parabolic(1, 0, 1)) },
|
||||
{ "SetInteger", new SetIntegerEffect("New Variable", 0, false, 0, 1) },
|
||||
{ "EnableControl", new EnableControlEffect(null, "New Variable", 0, false, "") },
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.Editor;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public class RadialBlurEffect : EffectBase
|
||||
{
|
||||
private readonly NBPostProcessingController nbController;
|
||||
|
||||
public float duration;
|
||||
public int sampleLevel;
|
||||
public float position;
|
||||
public float fadeRange;
|
||||
public float peakIntensity;
|
||||
public AnimationCurve intensityCurve;
|
||||
|
||||
public RadialBlurEffect(float duration, int sampleLevel, float position, float fadeRange, float peakIntensity, AnimationCurve intensityCurve)
|
||||
{
|
||||
this.effectTime = duration;
|
||||
this.duration = duration;
|
||||
this.sampleLevel = sampleLevel;
|
||||
this.position = position;
|
||||
this.fadeRange = fadeRange;
|
||||
this.peakIntensity = peakIntensity;
|
||||
this.intensityCurve = intensityCurve;
|
||||
this.nbController = EditorManager.instance.postProcessingManager.nbController;
|
||||
}
|
||||
|
||||
public override void Recover()
|
||||
{
|
||||
nbController.radialBlurToggle = false;
|
||||
}
|
||||
|
||||
public override void Disrupt()
|
||||
{
|
||||
nbController.radialBlurToggle = false;
|
||||
}
|
||||
|
||||
public override void PreExecute()
|
||||
{
|
||||
nbController.radialBlurToggle = true;
|
||||
nbController.radialBlurSampleCount = sampleLevel;
|
||||
nbController.radialBlurPos = position;
|
||||
nbController.radialBlurRange = fadeRange;
|
||||
}
|
||||
|
||||
public override void Execute()
|
||||
{
|
||||
float intensity = Mathf.Lerp(0, peakIntensity, intensityCurve.Evaluate(effectProgressPercent));
|
||||
nbController.radialBlurIntensity = intensity;
|
||||
}
|
||||
|
||||
public override void Adjust()
|
||||
{
|
||||
nbController.radialBlurToggle = false;
|
||||
}
|
||||
|
||||
public override EffectBase_BM ConvertToBM()
|
||||
{
|
||||
return new RadialBlurEffect_BM(duration, sampleLevel, position, fadeRange, peakIntensity, intensityCurve);
|
||||
}
|
||||
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
var container = inspector.GenerateContainer("Radial Blur Effect");
|
||||
var effectSettings = container.GenerateSubcontainer(3);
|
||||
var effectTimeField = inspector.GenerateInputField(this, effectSettings, "Effect Time", nameof(duration));
|
||||
var sampleLevelField = inspector.GenerateInputField(this, effectSettings, "Sample Level", nameof(sampleLevel));
|
||||
var positionField = inspector.GenerateInputField(this, effectSettings, "Position", nameof(position));
|
||||
var fadeRangeField = inspector.GenerateInputField(this, effectSettings, "Fade Range", nameof(fadeRange));
|
||||
var peakIntensityField = inspector.GenerateInputField(this, effectSettings, "Peak Intensity", nameof(peakIntensity));
|
||||
var intensityCurveButton = inspector.GenerateButton(this, effectSettings, "Intensity Curve", () =>
|
||||
{
|
||||
var intensityCurveWindow =
|
||||
inspector.GenerateCompositeParameterWindow(this, "Intensity Curve", nameof(intensityCurve)).SetAsCustomCurve();
|
||||
});
|
||||
SetRemove(effectSettings);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class RadialBlurEffect_BM : EffectBase_BM
|
||||
{
|
||||
public float duration;
|
||||
public int sampleLevel;
|
||||
public float position;
|
||||
public float fadeRange;
|
||||
public float peakIntensity;
|
||||
public AnimationCurve intensityCurve;
|
||||
|
||||
public RadialBlurEffect_BM(float duration, int sampleLevel, float position, float fadeRange, float peakIntensity, AnimationCurve intensityCurve)
|
||||
{
|
||||
this.effectTime = duration;
|
||||
this.duration = duration;
|
||||
this.sampleLevel = sampleLevel;
|
||||
this.position = position;
|
||||
this.fadeRange = fadeRange;
|
||||
this.peakIntensity = peakIntensity;
|
||||
this.intensityCurve = intensityCurve;
|
||||
}
|
||||
|
||||
public override EffectBase ConvertToGameType(GameElement attachedGameElement)
|
||||
{
|
||||
return new RadialBlurEffect(duration, sampleLevel, position, fadeRange, peakIntensity, intensityCurve)
|
||||
{
|
||||
attachedGameElement = attachedGameElement,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e69c790f6593ebd408c705cffeb3fc26
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -12,6 +12,7 @@ namespace Ichni.Editor
|
||||
public class PostProcessingManager : MonoBehaviour
|
||||
{
|
||||
public Volume globalVolume;
|
||||
public NBPostProcessingController nbController;
|
||||
public PixelateFeature pixelateFeature;
|
||||
|
||||
void Awake()
|
||||
@@ -65,7 +66,6 @@ namespace Ichni.Editor
|
||||
}
|
||||
}
|
||||
|
||||
[Button]
|
||||
public void SetFeatureActive(bool enable)
|
||||
{
|
||||
if (pixelateFeature != null)
|
||||
@@ -73,8 +73,7 @@ namespace Ichni.Editor
|
||||
pixelateFeature.SetActive(enable);
|
||||
}
|
||||
}
|
||||
|
||||
[Button]
|
||||
|
||||
public void SetPixelateStrength(float strengthX, float strengthY)
|
||||
{
|
||||
if (pixelateFeature != null)
|
||||
|
||||
Reference in New Issue
Block a user