From 5e3fe880c6d2b6b6dfae559a5062d21addb04ed1 Mon Sep 17 00:00:00 2001 From: Josef Date: Thu, 12 Feb 2026 10:48:23 +0100 Subject: [PATCH] Before adding custom inspectors --- Icons/FlareVFX.svg.import | 13 +- Runtime/Actions/Sequence/Parallel.cs | 7 + Runtime/Actions/Sequence/RepeatSequence.cs | 98 +++-- Runtime/Actions/SequenceAction.cs | 43 ++- Runtime/Actions/Time/Repeat.cs | 6 +- .../Visual/TweenFloatShaderProperty.cs | 28 +- Runtime/Animation/AnimationManager.cs | 38 +- Runtime/Animation/Flash/Flash.cs | 207 +++++++---- .../Flash/Presets/Blue Shield - Flash.tres | 1 - .../Flash/Presets/Red Hit - Flash.tres | 2 +- Runtime/Animation/Shake/Shake.cs | 3 + .../Animation/Transform/AnimateTransform.cs | 2 +- Runtime/Animation/Transform/TransformCurve.cs | 5 + .../Animation/Transform/TransformTarget.cs | 4 +- Runtime/Colors/ColorX.cs | 8 + Runtime/Colors/HSLColor.cs | 13 + Runtime/Events/EventSlot.cs | 43 ++- .../Godot/Extensions/GradientExtensions.cs | 51 +++ .../Extensions/GradientExtensions.cs.uid | 1 + Runtime/Godot/Extensions/Node3DExtensions.cs | 20 ++ Runtime/Godot/Nodes.cs | 1 + .../CompositorVFXPresets/Screen/Sketch.tres | 13 +- Runtime/Shading/Library/Time.gdshaderinc | 2 +- Runtime/Shading/Materials/Materials.cs | 5 + .../FresneOverlayBase.gdshaderinc | 36 ++ .../FresneOverlayBase.gdshaderinc.uid | 1 + .../FresnelOverlay/FresnelOverlay.gdshader | 30 +- .../FresnelOverlay/FresnelOverlayAdd.gdshader | 4 + .../FresnelOverlayAdd.gdshader.uid | 1 + .../FresnelOverlay/FresnelOverlayMaterial.cs | 55 ++- .../FresnelOverlayMultiply.gdshader | 4 + .../FresnelOverlayMultiply.gdshader.uid | 1 + .../FresnelOverlayPreMultiply.gdshader | 4 + .../FresnelOverlayPreMultiply.gdshader.uid | 1 + .../FresnelOverlaySubtract.gdshader | 4 + .../FresnelOverlaySubtract.gdshader.uid | 1 + .../Shaders/Effects/Impact/Impact.gdshader | 4 + .../Effects/Impact/Impact.gdshader.uid | 1 + .../Shaders/Effects/Impact/ImpactAdd.gdshader | 4 + .../Effects/Impact/ImpactAdd.gdshader.uid | 1 + .../Effects/Impact/ImpactBase.gdshaderinc | 66 ++++ .../Effects/Impact/ImpactBase.gdshaderinc.uid | 1 + .../ScanGradient/ScanGradient White.material | Bin 785 -> 811 bytes .../ScanGradient/ScanGradient.gdshader | 21 +- .../Shaders/Effects/Scanner/Scanner.gdshader | 4 + .../Effects/Scanner/Scanner.gdshader.uid | 1 + .../Effects/Scanner/ScannerBase.gdshaderinc | 83 +++++ .../Scanner/ScannerBase.gdshaderinc.uid | 1 + .../TriPlanarOverlay BlueShield.material | Bin 414 -> 431 bytes .../TriPlanarOverlay WhiteShield.material | Bin 982 -> 984 bytes .../TriPlanarOverlay.gdshader | 10 +- Runtime/Structures/MultiMap3.cs | 71 ++++ Runtime/Structures/MultiMap3.cs.uid | 1 + Runtime/Time/Duration/SecondsDuration.cs | 2 +- Runtime/Time/TimeLineSpan.cs | 4 +- Runtime/Tools/Lists.cs | 14 +- Runtime/Tools/ReflectionHelper.cs | 8 +- .../VFX/FlareVFX/FlareType/StarFlareType.cs | 56 +-- Runtime/VFX/FlareVFX/FlareVFX.cs | 2 +- .../FlareVFXPresets/Red Orange Classic.tres | 17 +- Runtime/VFX/FlashVFX/FlashPreset.cs | 57 +++ Runtime/VFX/FlashVFX/FlashPreset.cs.uid | 1 + .../CustomFlashType/CustomFlashPosition.cs | 19 + .../CustomFlashPosition.cs.uid | 1 + .../CustomFlashType/CustomFlashType.cs | 72 ++++ .../CustomFlashType/CustomFlashType.cs.uid | 1 + Runtime/VFX/FlashVFX/FlashTypes/FlashType.cs | 26 ++ .../VFX/FlashVFX/FlashTypes/FlashType.cs.uid | 1 + .../FlashTypes/FlatFlashType/FlatFlashType.cs | 44 +++ .../FlatFlashType/FlatFlashType.cs.uid | 1 + .../FresnelFlashType/FresnelFlashType.cs | 54 +++ .../FresnelFlashType/FresnelFlashType.cs.uid | 1 + Runtime/VFX/FlashVFX/FlashVFX.cs | 336 ++++++++++++++++++ Runtime/VFX/FlashVFX/FlashVFX.cs.uid | 1 + .../Blinking/Rainbow Blinking Flash.tres | 41 +++ .../Blinking/Red Blinking Flash.tres | 37 ++ .../Blinking/White Blinking Flash.tres | 37 ++ .../Fresnel/Blue Fresnel Flash.tres | 47 +++ .../Fresnel/Orange Fresnel Flash.tres | 47 +++ .../Scanner/Green Health Charge Flash.tres | 77 ++++ .../Scanner/Pink Mana Charge Flash.tres | 103 ++++++ .../Scanner/Rainbow Star Boost Flash.tres | 96 +++++ .../FlashVFXPresets/Scanner/Scanner.material | Bin 0 -> 800 bytes .../Blue Shield Load Flash.tres | 56 +++ .../Red Shield Defense Flash.tres | 89 +++++ .../VFX/GradientGenerator/CustomGradient.cs | 33 ++ .../GradientGenerator/CustomGradient.cs.uid | 1 + .../GradientGenerator/GradientGenerator.cs | 22 ++ .../GradientGenerator.cs.uid | 1 + .../VFX/GradientGenerator/RainbowGradient.cs | 68 ++++ .../GradientGenerator/RainbowGradient.cs.uid | 1 + .../GradientGenerator/TemperatureGradient.cs | 76 ++++ .../TemperatureGradient.cs.uid | 1 + Runtime/VFX/VFXTools.cs | 20 ++ Runtime/VFX/VFXTools.cs.uid | 1 + .../GodotEditorAttributeDrawer.cs | 55 +++ .../GodotEditorAttributeDrawer.cs.uid | 1 + .../GodotEditorInspector.cs | 13 + .../GodotEditorInspector.cs.uid | 1 + 99 files changed, 2426 insertions(+), 241 deletions(-) create mode 100644 Runtime/Godot/Extensions/GradientExtensions.cs create mode 100644 Runtime/Godot/Extensions/GradientExtensions.cs.uid create mode 100644 Runtime/Shading/Shaders/Effects/FresnelOverlay/FresneOverlayBase.gdshaderinc create mode 100644 Runtime/Shading/Shaders/Effects/FresnelOverlay/FresneOverlayBase.gdshaderinc.uid create mode 100644 Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayAdd.gdshader create mode 100644 Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayAdd.gdshader.uid create mode 100644 Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayMultiply.gdshader create mode 100644 Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayMultiply.gdshader.uid create mode 100644 Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayPreMultiply.gdshader create mode 100644 Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayPreMultiply.gdshader.uid create mode 100644 Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlaySubtract.gdshader create mode 100644 Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlaySubtract.gdshader.uid create mode 100644 Runtime/Shading/Shaders/Effects/Impact/Impact.gdshader create mode 100644 Runtime/Shading/Shaders/Effects/Impact/Impact.gdshader.uid create mode 100644 Runtime/Shading/Shaders/Effects/Impact/ImpactAdd.gdshader create mode 100644 Runtime/Shading/Shaders/Effects/Impact/ImpactAdd.gdshader.uid create mode 100644 Runtime/Shading/Shaders/Effects/Impact/ImpactBase.gdshaderinc create mode 100644 Runtime/Shading/Shaders/Effects/Impact/ImpactBase.gdshaderinc.uid create mode 100644 Runtime/Shading/Shaders/Effects/Scanner/Scanner.gdshader create mode 100644 Runtime/Shading/Shaders/Effects/Scanner/Scanner.gdshader.uid create mode 100644 Runtime/Shading/Shaders/Effects/Scanner/ScannerBase.gdshaderinc create mode 100644 Runtime/Shading/Shaders/Effects/Scanner/ScannerBase.gdshaderinc.uid create mode 100644 Runtime/Structures/MultiMap3.cs create mode 100644 Runtime/Structures/MultiMap3.cs.uid create mode 100644 Runtime/VFX/FlashVFX/FlashPreset.cs create mode 100644 Runtime/VFX/FlashVFX/FlashPreset.cs.uid create mode 100644 Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashPosition.cs create mode 100644 Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashPosition.cs.uid create mode 100644 Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashType.cs create mode 100644 Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashType.cs.uid create mode 100644 Runtime/VFX/FlashVFX/FlashTypes/FlashType.cs create mode 100644 Runtime/VFX/FlashVFX/FlashTypes/FlashType.cs.uid create mode 100644 Runtime/VFX/FlashVFX/FlashTypes/FlatFlashType/FlatFlashType.cs create mode 100644 Runtime/VFX/FlashVFX/FlashTypes/FlatFlashType/FlatFlashType.cs.uid create mode 100644 Runtime/VFX/FlashVFX/FlashTypes/FresnelFlashType/FresnelFlashType.cs create mode 100644 Runtime/VFX/FlashVFX/FlashTypes/FresnelFlashType/FresnelFlashType.cs.uid create mode 100644 Runtime/VFX/FlashVFX/FlashVFX.cs create mode 100644 Runtime/VFX/FlashVFX/FlashVFX.cs.uid create mode 100644 Runtime/VFX/FlashVFX/FlashVFXPresets/Blinking/Rainbow Blinking Flash.tres create mode 100644 Runtime/VFX/FlashVFX/FlashVFXPresets/Blinking/Red Blinking Flash.tres create mode 100644 Runtime/VFX/FlashVFX/FlashVFXPresets/Blinking/White Blinking Flash.tres create mode 100644 Runtime/VFX/FlashVFX/FlashVFXPresets/Fresnel/Blue Fresnel Flash.tres create mode 100644 Runtime/VFX/FlashVFX/FlashVFXPresets/Fresnel/Orange Fresnel Flash.tres create mode 100644 Runtime/VFX/FlashVFX/FlashVFXPresets/Scanner/Green Health Charge Flash.tres create mode 100644 Runtime/VFX/FlashVFX/FlashVFXPresets/Scanner/Pink Mana Charge Flash.tres create mode 100644 Runtime/VFX/FlashVFX/FlashVFXPresets/Scanner/Rainbow Star Boost Flash.tres create mode 100644 Runtime/VFX/FlashVFX/FlashVFXPresets/Scanner/Scanner.material create mode 100644 Runtime/VFX/FlashVFX/FlashVFXPresets/TriPlanar Overlay/Blue Shield Load Flash.tres create mode 100644 Runtime/VFX/FlashVFX/FlashVFXPresets/TriPlanar Overlay/Red Shield Defense Flash.tres create mode 100644 Runtime/VFX/GradientGenerator/CustomGradient.cs create mode 100644 Runtime/VFX/GradientGenerator/CustomGradient.cs.uid create mode 100644 Runtime/VFX/GradientGenerator/GradientGenerator.cs create mode 100644 Runtime/VFX/GradientGenerator/GradientGenerator.cs.uid create mode 100644 Runtime/VFX/GradientGenerator/RainbowGradient.cs create mode 100644 Runtime/VFX/GradientGenerator/RainbowGradient.cs.uid create mode 100644 Runtime/VFX/GradientGenerator/TemperatureGradient.cs create mode 100644 Runtime/VFX/GradientGenerator/TemperatureGradient.cs.uid create mode 100644 Runtime/VFX/VFXTools.cs create mode 100644 Runtime/VFX/VFXTools.cs.uid create mode 100644 Tools/godot-editor-inspector-tools/GodotEditorAttributeDrawer.cs create mode 100644 Tools/godot-editor-inspector-tools/GodotEditorAttributeDrawer.cs.uid create mode 100644 Tools/godot-editor-inspector-tools/GodotEditorInspector.cs create mode 100644 Tools/godot-editor-inspector-tools/GodotEditorInspector.cs.uid diff --git a/Icons/FlareVFX.svg.import b/Icons/FlareVFX.svg.import index 7377265..0db720c 100644 --- a/Icons/FlareVFX.svg.import +++ b/Icons/FlareVFX.svg.import @@ -3,19 +3,20 @@ importer="texture" type="CompressedTexture2D" uid="uid://b7u8spfui08e7" -path="res://.godot/imported/FlareVFX.svg-7c0691138c416c828300e95f7f8b3111.ctex" +path.s3tc="res://.godot/imported/FlareVFX.svg-7c0691138c416c828300e95f7f8b3111.s3tc.ctex" metadata={ -"vram_texture": false +"imported_formats": ["s3tc_bptc"], +"vram_texture": true } [deps] source_file="res://addons/rokojori_action_library/Icons/FlareVFX.svg" -dest_files=["res://.godot/imported/FlareVFX.svg-7c0691138c416c828300e95f7f8b3111.ctex"] +dest_files=["res://.godot/imported/FlareVFX.svg-7c0691138c416c828300e95f7f8b3111.s3tc.ctex"] [params] -compress/mode=0 +compress/mode=2 compress/high_quality=false compress/lossy_quality=0.7 compress/uastc_level=0 @@ -23,7 +24,7 @@ compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 -mipmaps/generate=false +mipmaps/generate=true mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" @@ -37,7 +38,7 @@ process/normal_map_invert_y=false process/hdr_as_srgb=false process/hdr_clamp_exposure=false process/size_limit=0 -detect_3d/compress_to=1 +detect_3d/compress_to=0 svg/scale=1.0 editor/scale_with_editor_scale=false editor/convert_colors_with_editor_theme=false diff --git a/Runtime/Actions/Sequence/Parallel.cs b/Runtime/Actions/Sequence/Parallel.cs index 0b49668..2c7f7cb 100644 --- a/Runtime/Actions/Sequence/Parallel.cs +++ b/Runtime/Actions/Sequence/Parallel.cs @@ -31,7 +31,9 @@ namespace Rokojori protected override void _OnTrigger() { + var actions = new List( this.actions ); + if ( triggerDirectChildren ) { @@ -59,6 +61,8 @@ namespace Rokojori sa.onSequenceDone.Once( ( fe )=> { + // this.LogInfo( "Sequence Action finished:", HierarchyName.Of( sa ) ); + if ( ! running ) { return; @@ -71,6 +75,7 @@ namespace Rokojori if ( Mode.First_Finishes_Sequence == mode ) { running = false; + // this.LogInfo( "DispatchEnd for First_Finishes_Sequence" ); DispatchEnd( sequenceID ); } @@ -79,6 +84,7 @@ namespace Rokojori if ( numFinished == sequenceActions.Count ) { running = false; + // this.LogInfo( "DispatchEnd for Wait_For_All_To_Finish" ); DispatchEnd( sequenceID ); } } @@ -86,6 +92,7 @@ namespace Rokojori else { running = false; + // this.LogInfo( "DispatchCancelled for Wait_For_All_To_Finish" ); DispatchCancelled( sequenceID ); } } diff --git a/Runtime/Actions/Sequence/RepeatSequence.cs b/Runtime/Actions/Sequence/RepeatSequence.cs index be00efa..5084821 100644 --- a/Runtime/Actions/Sequence/RepeatSequence.cs +++ b/Runtime/Actions/Sequence/RepeatSequence.cs @@ -4,6 +4,8 @@ using System.Collections.Generic; namespace Rokojori { + + [Tool][GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Parallel.svg") ] public partial class RepeatSequence : SequenceAction { @@ -32,6 +34,8 @@ namespace Rokojori { var id = DispatchStart(); + this.LogInfo( "Starting ID:", id ); + if ( ! ( action is SequenceAction ) ) { Trigger( action ); @@ -39,12 +43,6 @@ namespace Rokojori return; } - var sa = (SequenceAction) action; - - var executed = 0; - - System.Action callBack = null; - var tl = TimeLineManager.Ensure( timeLine ); if ( maxNumRepeats <= 0 && ( tl == null || maxRepeatDuration <= 0 ) ) @@ -52,44 +50,68 @@ namespace Rokojori return; } - var startTime = tl.position; - var endTime = tl.position + maxRepeatDuration; + var runner = new RepeatSequenceRunner(); + runner.Start( id, this ); - callBack = ( a )=> - { - if ( ! a.success ) - { - DispatchCancelled( id ); - sa.onSequenceDone.RemoveAction( callBack ); - return; - } + } - executed ++; + - var finished = ( maxNumRepeats > 0 && executed >= maxNumRepeats ) || - ( tl != null && tl.position >= endTime ); - - finished = stopSignal || finished; - - if ( finished ) - { - DispatchEnd( id ); - sa.onSequenceDone.RemoveAction( callBack ); - return; - } - else - { - Trigger( action ); - } - - }; - - - sa.onSequenceDone.AddAction( callBack ); + } - Trigger( action ); + public class RepeatSequenceRunner + { + public RepeatSequence repeatSequence; + public TimeLine timeLine; + public int sequenceID; + public int maxRepeats = 0; + public int started = 0; + public float startTime = 0; + public float endTime = 0; + + public void Start( int id, RepeatSequence repeatSequence ) + { + this.repeatSequence = repeatSequence; + this.sequenceID = id; + timeLine = TimeLineManager.Ensure( repeatSequence.timeLine ); + startTime = timeLine.position; + endTime = startTime + repeatSequence.maxRepeatDuration; + maxRepeats = repeatSequence.maxNumRepeats; + + Next(); } + + public void Next() + { + if ( started == maxRepeats ) + { + repeatSequence.DispatchEnd( sequenceID ); + repeatSequence.LogInfo( "Finished:", sequenceID ); + return; + } + + + started ++; + repeatSequence.LogInfo( "Next:", sequenceID, started ); + var sa = (SequenceAction) repeatSequence.action; + + + sa.onSequenceDone.Once( + async ( fe ) => + { + // repeatSequence.LogInfo( fe.success ); + await sa.RequestNextFrame(); + Next(); + } + ); + + sa.Trigger(); + + } + } + + } \ No newline at end of file diff --git a/Runtime/Actions/SequenceAction.cs b/Runtime/Actions/SequenceAction.cs index a79530d..3427ae1 100644 --- a/Runtime/Actions/SequenceAction.cs +++ b/Runtime/Actions/SequenceAction.cs @@ -1,6 +1,6 @@ using Godot; - +using System.Collections.Generic; namespace Rokojori { @@ -15,8 +15,23 @@ namespace Rokojori [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/SequenceAction.svg")] public abstract partial class SequenceAction : Action { - + + [ExportGroup("Debugging")] + [ExportToolButton("Clear Listeners")] + public Callable clearListeners => Callable.From( + ()=> + { + onSequenceDone.ResetAndClearAll(); + } + ); + [Export] + public bool showRunningSequences = false; + + [Export] + public int[] runningSequences = []; + + int _dispatchCounter = 0; public int GetLastSequenceActionID() @@ -29,22 +44,40 @@ namespace Rokojori public int DispatchStart() { _dispatchCounter ++; + + if ( showRunningSequences ) + { + runningSequences = runningSequences.Add( _dispatchCounter ); + } + return _dispatchCounter; } public void DispatchEnd( int id ) { - onSequenceDone.DispatchEvent( new SequenceActionFinishedEvent{ id = id, success = true } ); + var ev = new SequenceActionFinishedEvent{ id = id, success = true }; + onSequenceDone.DispatchEvent( ev ); + + if ( showRunningSequences ) + { + runningSequences = runningSequences.Remove( _dispatchCounter ); + } } public void DispatchCancelled( int id ) { - onSequenceDone.DispatchEvent( new SequenceActionFinishedEvent{ id = id, success = false } ); + var ev = new SequenceActionFinishedEvent{ id = id, success = true }; + onSequenceDone.DispatchEvent( ev ); + + if ( showRunningSequences ) + { + runningSequences = runningSequences.Remove( _dispatchCounter ); + } } public virtual void CancelAction( int id ) { - + } public int TriggerSequenceAndGetID() diff --git a/Runtime/Actions/Time/Repeat.cs b/Runtime/Actions/Time/Repeat.cs index 98c859d..68cacc9 100644 --- a/Runtime/Actions/Time/Repeat.cs +++ b/Runtime/Actions/Time/Repeat.cs @@ -46,10 +46,10 @@ namespace Rokojori { Action.Trigger( onAfterLast ); } - } - - ); + }, + this + ); } } diff --git a/Runtime/Actions/Visual/TweenFloatShaderProperty.cs b/Runtime/Actions/Visual/TweenFloatShaderProperty.cs index f873a24..667cb54 100644 --- a/Runtime/Actions/Visual/TweenFloatShaderProperty.cs +++ b/Runtime/Actions/Visual/TweenFloatShaderProperty.cs @@ -24,6 +24,14 @@ namespace Rokojori [Export] public Curve curve; + [ExportGroup( "Editor Testing")] + [Export] + public bool forceStartValue = false; + + [Export] + public float forcedStartValue = 0f; + + public void OnAnimatorStart(){} public void OnAnimatorEnd(){} public void OnAnimatorCancel(){} @@ -36,21 +44,10 @@ namespace Rokojori protected override void _OnTrigger() { - if ( ! interruptCurrent && _actionID != -1 ) { - // this.LogInfo( "Already running" ); return; } - - // this.LogInfo( "Started Float Tween" ); - - - if ( Engine.IsEditorHint() ) - { - return; - } - if ( _actionID != -1 ) @@ -61,6 +58,12 @@ namespace Rokojori _actionID = DispatchStart(); var startValue = propertyName.Get( material ); + + if ( forceStartValue && Engine.IsEditorHint() ) + { + startValue = forcedStartValue; + } + AnimationManager.StartAnimation( this, material, propertyName ); @@ -107,7 +110,8 @@ namespace Rokojori _actionID = -1; _timeID = -1; } - } + }, + this ).id; } diff --git a/Runtime/Animation/AnimationManager.cs b/Runtime/Animation/AnimationManager.cs index b2e746c..ab5043d 100644 --- a/Runtime/Animation/AnimationManager.cs +++ b/Runtime/Animation/AnimationManager.cs @@ -44,6 +44,12 @@ namespace Rokojori public class AnimationManager { static MultiMap _animatingObjects = new MultiMap(); + static MultiMap _animatingReferences = new MultiMap(); + + public static Animator GetAnimator( GodotObject go, string memberName, object obj ) + { + return _animatingReferences.Get( go, memberName, obj ); + } public static Animator GetAnimator( GodotObject go, string memberName ) { @@ -55,6 +61,11 @@ namespace Rokojori return GetAnimator( material, propertyName.propertyName ); } + public static bool IsAnimating( Animator animator, GodotObject go, string memberName, object obj ) + { + return GetAnimator( go, memberName, obj ) == animator; + } + public static bool IsAnimating( Animator animator, GodotObject go, string memberName ) { return GetAnimator( go, memberName ) == animator; @@ -103,6 +114,18 @@ namespace Rokojori _animatingObjects.Set( go, member, animator ); } + public static void StartAnimation( Animator animator, GodotObject go, string member, object obj ) + { + var activeAnimator = GetAnimator( go, member, obj ); + + if ( activeAnimator != null ) + { + activeAnimator.OnAnimatorCancel(); + } + + _animatingReferences.Set( go, member, obj, animator ); + } + public static void StartAnimation( Animator animator, Node node, AnimationMember member ) { var activeAnimator = GetAnimator( node, member.name ); @@ -142,9 +165,20 @@ namespace Rokojori { StartAnimation( animator, nodes[ i ], members ); } - } + } - public static void EndAnimation( Animator animator, GodotObject go, string member ) + + public static void EndAnimation( Animator animator, GodotObject go, string member, object obj ) + { + var activeAnimator = GetAnimator( go, member, obj ); + + if ( activeAnimator != null ) + { + activeAnimator.OnAnimatorCancel(); + } + } + + public static void EndAnimation( Animator animator, GodotObject go, string member ) { var activeAnimator = GetAnimator( go, member ); diff --git a/Runtime/Animation/Flash/Flash.cs b/Runtime/Animation/Flash/Flash.cs index 595b9d0..167e594 100644 --- a/Runtime/Animation/Flash/Flash.cs +++ b/Runtime/Animation/Flash/Flash.cs @@ -14,56 +14,58 @@ namespace Rokojori [Export] public FlashEffect flashEffect; - Node3D[] _targets = []; + // Node3D[] _targets = []; [Export] - public Node3D[] targets - { - get => _targets; - set - { - _targets = value; - _allTargets = null; - } - } + public Node3D[] targets; + // { + // get => _targets; + // set + // { + // _targets = value; + // _allTargets = null; + // } + // } [Export] public bool includeChildren = false; bool refresh = false; - Node3D[] _allTargets; - public Node3D[] allTargets - { - get - { - if ( _allTargets != null ) - { - return _allTargets; - } + // Node3D[] _allTargets; + // public Node3D[] allTargets + // { + // get + // { + // if ( _allTargets != null ) + // { + // return _allTargets; + // } - if ( includeChildren ) - { - _allTargets = Nodes.GetAnyChildren( _targets ).ToArray(); - } - else - { - _allTargets = _targets; - } + // if ( includeChildren ) + // { + // _allTargets = Nodes.GetAnyChildren( _targets ).ToArray(); + // } + // else + // { + // _allTargets = _targets; + // } - _allTargets = Lists.Filter( Lists.From( allTargets ), t => t as GeometryInstance3D != null ).ToArray(); + // _allTargets = Lists.Filter( Lists.From( allTargets ), t => t as GeometryInstance3D != null ).ToArray(); - return _allTargets; + // return _allTargets; - } - } - int animationID = -1; - int actionID = -1; + // } + // } - Vector3 randomization; - List _materials; - OmniLight3D light = null; + // int animationID = -1; + // int actionID = -1; + + // Vector3 randomization; + // List _materials; + + // OmniLight3D light = null; // [Export] // public Node3D debugProcessIndicator; @@ -112,6 +114,26 @@ namespace Rokojori return color; } + List GetAllTargets() + { + var allTargets = new List(); + + if ( includeChildren ) + { + allTargets = Nodes.GetAnyChildren( targets ); + } + else + { + allTargets.AddRange( targets ); + } + + allTargets = Lists.Filter( Lists.From( allTargets ), t => t as GeometryInstance3D != null ); + + return allTargets; + } + + int actionID = -1; + protected override void _OnTrigger() { if ( actionID != -1 ) @@ -122,16 +144,30 @@ namespace Rokojori actionID = DispatchStart(); + var currentTargets = GetAllTargets(); + + if ( currentTargets.Count == 0 ) + { + DispatchEnd( actionID ); + return; + } + + var runner = new FlashRunnerData(); + runner.targets = currentTargets; + + _runnerData[ actionID ] = runner; + + var random = LCG.WithSeed( networkSeed ); // RJLog.Log( "Setting actionID id", actionID, GetLastSequenceActionID() ); var flashCurve = flashEffect.flashCurve; var color = flashEffect.color.GetHDRColor(); - var timeline = flashEffect.timeline; + var timeline = TimeLineManager.Ensure( flashEffect.timeline ); - randomization = flashCurve.Randomize( random ); - var duration = flashCurve.GetRandomizedDuration( randomization ); + runner.randomization = flashCurve.Randomize( random ); + var duration = flashCurve.GetRandomizedDuration( runner.randomization ); var transparentColor = color; @@ -141,10 +177,18 @@ namespace Rokojori Material material = null; + + + + + this.LogInfo( "Applying Targets:", currentTargets ); + + OmniLight3D light; if ( FlashEffect.FlashLightMode.No_Light != flashEffect.lightMode ) { - light = allTargets[ 0 ].CreateChild(); + runner.light = currentTargets[ 0 ].CreateChild(); + light = runner.light; light.LightColor = ComputeLightColor( color, 0 ); light.LightEnergy = 0; light.OmniRange = flashEffect.lightRange; @@ -194,19 +238,14 @@ namespace Rokojori - _materials = new List(); + runner.materials = new List(); - if ( Engine.IsEditorHint() ) - { - _allTargets = null; - } - - Arrays.ForEach( allTargets, + currentTargets.ForEach( t => { var m = (Material) material.Duplicate( true ); - _materials.Add( m ); + runner.materials.Add( m ); Materials.AddOverlay( t, m ); @@ -218,13 +257,13 @@ namespace Rokojori - animationID = TimeLineManager.ScheduleSpanIn( timeline, 0, duration, + runner.animationID = TimeLineManager.ScheduleSpanIn( timeline, 0, duration, ( TimeLineSpan span, TimeLineSpanUpdateType type )=> { // debugProcessIndicator.Position = debugProcessIndicatorFull * span.phase; - if ( animationID != span.id ) + if ( runner.animationID != span.id ) { return; } @@ -234,21 +273,25 @@ namespace Rokojori var phase = span.phase; - var value = flashCurve.Sample( phase ); + var value = flashCurve.Sample( span.elapsed ); + + var phaseColor = color; phaseColor.A = value * initialAlpha; + this.LogInfo( phase, value ); + // debugMaterial.AlbedoColor = phaseColor; - if ( light != null ) + if ( runner.light != null ) { - light.LightEnergy = value * flashEffect.lightFlashCurveScale; - light.LightColor = ComputeLightColor( color, phase ); + runner.light.LightEnergy = value * flashEffect.lightFlashCurveScale; + runner.light.LightColor = ComputeLightColor( color, phase ); } - _materials.ForEach( + runner.materials.ForEach( ( m )=> { if ( FlashEffect.MaterialMode.Flat_Standard3D == flashEffect.materialMode ) @@ -265,7 +308,7 @@ namespace Rokojori { var sm = m as ScanGradientMaterial; sm.albedo.Set( phaseColor ); - sm.offset.Set( phase * 3 ); + sm.offset.Set( phase ); } else if ( FlashEffect.MaterialMode.Shield_TriPlanarOverlay == flashEffect.materialMode ) { @@ -284,10 +327,10 @@ namespace Rokojori if ( type == TimeLineSpanUpdateType.End ) { - if ( light != null ) + if ( runner.light != null ) { - light.LightEnergy = 0; - light.LightColor = new Color( 0, 0, 0, 0 ); + runner.light.LightEnergy = 0; + runner.light.LightColor = new Color( 0, 0, 0, 0 ); } CancelAction( actionID ); @@ -300,42 +343,52 @@ namespace Rokojori ).id; - } + } + + Dictionary _runnerData = new Dictionary(); public override void CancelAction( int id ) { + if ( ! _runnerData.ContainsKey( id )) + { + return; + } + + var data = _runnerData[ id ]; + var light = data.light; + var nodes = data.targets; + var materials = data.materials; if ( light != null ) { // RJLog.Log( "Removing Light", light.Name ); Nodes.RemoveAndDelete( light ); - - light = null; } + RemoveMaterials( nodes, materials ); - RemoveMaterials(); - - - - + _runnerData.Remove( id ); } - void RemoveMaterials() + void RemoveMaterials( List allTargets, List materials ) { - if ( _materials == null || allTargets == null || _materials.Count != allTargets.Length ) - { - return; - } - for ( int i = 0; i < allTargets.Length; i++ ) + for ( int i = 0; i < allTargets.Count ; i++ ) { - Materials.RemoveOverlay( allTargets[ i ], _materials[ i ] ); + Materials.RemoveOverlay( allTargets[ i ], materials[ i ] ); } - _materials.Clear(); + // _materials.Clear(); } - - } + public class FlashRunnerData + { + public List targets; + public List materials; + public OmniLight3D light; + public int animationID; + public int actionID; + public Vector3 randomization; + } + } } \ No newline at end of file diff --git a/Runtime/Animation/Flash/Presets/Blue Shield - Flash.tres b/Runtime/Animation/Flash/Presets/Blue Shield - Flash.tres index 66b08b1..8739126 100644 --- a/Runtime/Animation/Flash/Presets/Blue Shield - Flash.tres +++ b/Runtime/Animation/Flash/Presets/Blue Shield - Flash.tres @@ -26,5 +26,4 @@ color = SubResource("Resource_54hj8") lightMode = 1 lightRange = 5.0 lightFlashCurveScale = 5.0 -lightHasShadows = true materialMode = 3 diff --git a/Runtime/Animation/Flash/Presets/Red Hit - Flash.tres b/Runtime/Animation/Flash/Presets/Red Hit - Flash.tres index a99f1ff..d11bbc3 100644 --- a/Runtime/Animation/Flash/Presets/Red Hit - Flash.tres +++ b/Runtime/Animation/Flash/Presets/Red Hit - Flash.tres @@ -8,7 +8,7 @@ [sub_resource type="Resource" id="Resource_54hj8"] script = ExtResource("1_nmdum") color = Color(0.86, 0.12426996, 0.1118, 0.5254902) -colorMultiply = 3.0 +rgbMultiply = 3.0 [sub_resource type="Curve" id="Curve_tp3r5"] _data = [Vector2(0, 1), 0.0, -1.0, 0, 1, Vector2(1, 0), -1.0, 0.0, 1, 0] diff --git a/Runtime/Animation/Shake/Shake.cs b/Runtime/Animation/Shake/Shake.cs index f711056..844f811 100644 --- a/Runtime/Animation/Shake/Shake.cs +++ b/Runtime/Animation/Shake/Shake.cs @@ -173,8 +173,11 @@ namespace Rokojori combined.position = Smoother.SmoothTimeVariant( current.position, combined.position, delta, smoothStrength ); combined.rotation = Smoother.SmoothTimeVariant( current.rotation, combined.rotation, delta, smoothStrength ); combined.scale = Smoother.SmoothTimeVariant( current.scale, combined.scale, delta, smoothStrength ); + + } + // this.LogInfo( combined.rotation ); combined.Set( targets[ i ], shakeEffect.globalPosition, shakeEffect.globalRotation ); } diff --git a/Runtime/Animation/Transform/AnimateTransform.cs b/Runtime/Animation/Transform/AnimateTransform.cs index 30cde6e..d3dc2ab 100644 --- a/Runtime/Animation/Transform/AnimateTransform.cs +++ b/Runtime/Animation/Transform/AnimateTransform.cs @@ -45,7 +45,7 @@ namespace Rokojori _randomizations.Add( curve.Randomize() ); } - var timeline = animations.timeline; + var timeline = TimeLineManager.Ensure( animations.timeline ); var duration = animations.GetMaxDuration( _randomizations ); var start = timeline.position; diff --git a/Runtime/Animation/Transform/TransformCurve.cs b/Runtime/Animation/Transform/TransformCurve.cs index ae9f368..f7d8227 100644 --- a/Runtime/Animation/Transform/TransformCurve.cs +++ b/Runtime/Animation/Transform/TransformCurve.cs @@ -37,6 +37,11 @@ namespace Rokojori var animatedValue = Sample( time, randomization ); animatedValue = ApplyOperator( animatedValue, originalValue ); + if ( transformTarget == TransformTarget.Global_Rotation || transformTarget == TransformTarget.Local_Rotation ) + { + animatedValue = MathX.DegreesToRadians * animatedValue; + } + TransformTargets.Set( animatedValue, node, transformTarget ); } diff --git a/Runtime/Animation/Transform/TransformTarget.cs b/Runtime/Animation/Transform/TransformTarget.cs index baaef71..d18d793 100644 --- a/Runtime/Animation/Transform/TransformTarget.cs +++ b/Runtime/Animation/Transform/TransformTarget.cs @@ -91,7 +91,7 @@ namespace Rokojori else if ( TransformTarget.Global_Rotation == transformTarget ) { var rotation = target.GlobalRotation; - target.GlobalRotation = value * MathX.DegreesToRadians; + target.GlobalRotation = value;// * MathX.DegreesToRadians; // RJLog.Log( "GlobalRotation = ", rotation, ">>", value, target.GlobalRotation ); } else if ( TransformTarget.Local_Position == transformTarget ) @@ -101,7 +101,7 @@ namespace Rokojori else if ( TransformTarget.Local_Rotation == transformTarget ) { var rotation = target.Rotation; - target.Rotation = value * MathX.DegreesToRadians; + target.Rotation = value;// * MathX.DegreesToRadians; // RJLog.Log( "Rotation = ", rotation, ">>", value, target.Rotation ); } else if ( TransformTarget.Local_Scale == transformTarget ) diff --git a/Runtime/Colors/ColorX.cs b/Runtime/Colors/ColorX.cs index 8e36a6e..3966d2b 100644 --- a/Runtime/Colors/ColorX.cs +++ b/Runtime/Colors/ColorX.cs @@ -5,11 +5,19 @@ namespace Rokojori { public static class ColorX { + public static Color WithIntensity( this Color c, float intensity ) + { + var intensified = c.SrgbToLinear(); + intensified *= Mathf.Pow( 2f, intensity ); + return intensified.LinearToSRGB(); + } + public static float GetColorScale( this Color c ) { return Mathf.Max( 1f, Mathf.Max( c.R, Mathf.Max( c.G, c.B ) ) ); } + public static Color ScaleColor( this Color c, float scale ) { return new Color( c.R * scale, c.G * scale, c.B * scale, c.A ); diff --git a/Runtime/Colors/HSLColor.cs b/Runtime/Colors/HSLColor.cs index 4f1ecce..8093c2a 100644 --- a/Runtime/Colors/HSLColor.cs +++ b/Runtime/Colors/HSLColor.cs @@ -208,7 +208,20 @@ namespace Rokojori float distanceToBlue = Mathf.Min( 1.0f, Mathf.Abs( hue - 240.0f ) / blendRadius ); return changeHue360( hue, offset * distanceToYellow * distanceToBlue ); + } + + public HSLColor ShiftTemperature( float temperature, float saturation, float lightness, float blendRadius = 60 ) + { + var color = new HSLColor( + ShiftTemparatureOfHue( this.h, temperature, blendRadius ), + s + saturation, + l + lightness + ); + + color.ClampToLimits(); + + return color; } public static Color Lerp( Color x, Color y, float t ) diff --git a/Runtime/Events/EventSlot.cs b/Runtime/Events/EventSlot.cs index d9eed63..c879ce0 100644 --- a/Runtime/Events/EventSlot.cs +++ b/Runtime/Events/EventSlot.cs @@ -20,10 +20,23 @@ namespace Rokojori public bool hasListeners => _once.Count > 0 || _actions.Count > 0; + public void ResetAndClearAll() + { + _actions.Clear(); + _once.Clear(); + + _additions.Clear(); + _onceAdditions.Clear(); + + _removals.Clear(); + _canModify = true; + } + public void AddAction( Action action ) { - if ( _actions.IndexOf( action ) != - 1 || _additions.IndexOf( action ) != -1 ) + if ( HasAction( action ) ) { + RJLog.Error( this, "This action already exists", action ); return; } @@ -42,7 +55,9 @@ namespace Rokojori { if ( _canModify ) { - _actions.Remove( action ); + var removed = _actions.Remove( action ); + + // RJLog.Log( "Removed:", action, removed ); } else { @@ -50,8 +65,19 @@ namespace Rokojori } } + public bool HasAction( Action action ) + { + return _actions.Has( action ) || _additions.Has( action ) || _onceAdditions.Has( action ); + } + public void Once( Action action ) { + if ( HasAction( action ) ) + { + RJLog.Error( this, "This action already exists", action ); + return; + } + if ( _canModify ) { _actions.Add( action ); @@ -60,9 +86,7 @@ namespace Rokojori else { _onceAdditions.Add( action ); - } - - + } } protected void _UpdateLists() @@ -73,6 +97,15 @@ namespace Rokojori if ( _removals.Count > 0 ) { Lists.RemoveRange( _actions, _removals ); + + // _removals.ForEach( + // r => + // { + // var removed = _actions.Remove( r ); + // RJLog.Log( "Removed:", r, removed ); + // } + // ); + _removals.Clear(); } diff --git a/Runtime/Godot/Extensions/GradientExtensions.cs b/Runtime/Godot/Extensions/GradientExtensions.cs new file mode 100644 index 0000000..a3aace7 --- /dev/null +++ b/Runtime/Godot/Extensions/GradientExtensions.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; +using Godot; +namespace Rokojori +{ + public static class GradientExtensions + { + public enum GradientRepeatMode + { + Clamp, + Repeat, + MirrorRepeat + } + + public static Gradient Create( IEnumerable colors ) + { + var g = new Gradient(); + g.Colors = Lists.FromAny( colors ).ToArray(); + + var offsets = new List(); + for ( int i = 0; i < g.Colors.Length; i++ ) + { + offsets.Add( i / (float) ( g.Colors.Length - 1f ) ); + } + + g.Offsets = offsets.ToArray(); + + return g; + } + + public static Color SampleRepeated( this Gradient gradient, float t, GradientRepeatMode repeatMode ) + { + var repeatedT = t; + + if ( GradientRepeatMode.Repeat == repeatMode ) + { + repeatedT = MathX.Repeat( t, 1f ); + } + else if ( GradientRepeatMode.MirrorRepeat == repeatMode ) + { + repeatedT = MathX.Repeat( t, 2f ); + + if ( repeatedT > 1f ) + { + repeatedT = 2f - 1f; + } + } + + return gradient.Sample( repeatedT ); + } + } +} \ No newline at end of file diff --git a/Runtime/Godot/Extensions/GradientExtensions.cs.uid b/Runtime/Godot/Extensions/GradientExtensions.cs.uid new file mode 100644 index 0000000..ff96bc3 --- /dev/null +++ b/Runtime/Godot/Extensions/GradientExtensions.cs.uid @@ -0,0 +1 @@ +uid://cajsf1ang6ls2 diff --git a/Runtime/Godot/Extensions/Node3DExtensions.cs b/Runtime/Godot/Extensions/Node3DExtensions.cs index 5abb57e..023fdb4 100644 --- a/Runtime/Godot/Extensions/Node3DExtensions.cs +++ b/Runtime/Godot/Extensions/Node3DExtensions.cs @@ -7,6 +7,26 @@ namespace Rokojori { public static class Node3DExtensions { + public static Vector3 GetCenter( IEnumerable node3D) + { + var center = Vector3.Zero; + var num = 0; + + foreach ( var n in node3D ) + { + center += n.GlobalPosition; + } + + if ( num == 0 ) + { + return center; + } + + center /= num; + + return center; + } + public static Vector3? GetBoundsCenter( this Node3D self, bool onlyVisisble = true ) { var optionalBounds = self.GetWorldBounds(); diff --git a/Runtime/Godot/Nodes.cs b/Runtime/Godot/Nodes.cs index 33a7490..876c14b 100644 --- a/Runtime/Godot/Nodes.cs +++ b/Runtime/Godot/Nodes.cs @@ -193,6 +193,7 @@ namespace Rokojori return list; } + public static List GetAll( this Node root, Func filter = null, bool includeRoot = true) where T:class { var list = new List(); diff --git a/Runtime/Rendering/Compositor/CompositorVFXPresets/Screen/Sketch.tres b/Runtime/Rendering/Compositor/CompositorVFXPresets/Screen/Sketch.tres index aeeb691..853563b 100644 --- a/Runtime/Rendering/Compositor/CompositorVFXPresets/Screen/Sketch.tres +++ b/Runtime/Rendering/Compositor/CompositorVFXPresets/Screen/Sketch.tres @@ -20,12 +20,12 @@ member = "amount" curve = SubResource("Curve_btbfg") metadata/_custom_type_script = "uid://dvvfvlutisecy" -[sub_resource type="Resource" id="Resource_ie6m2"] +[sub_resource type="Resource" id="Resource_4xviq"] script = ExtResource("1_0ail8") [sub_resource type="Resource" id="Resource_p64cs"] script = ExtResource("2_tc21q") -owner = SubResource("Resource_ie6m2") +owner = SubResource("Resource_4xviq") layer = ExtResource("2_4xviq") [sub_resource type="Curve" id="Curve_7axlu"] @@ -58,7 +58,6 @@ effect_callback_type = 4 needs_motion_vectors = false needs_normal_roughness = false script = ExtResource("3_dryyw") -amount = 0.0 outlineWidth = -0.0516 outlineWidthCurve = SubResource("CurveTexture_p64cs") edgeColor = Color(0.14817011, 0.21073082, 0.29634023, 1) @@ -91,7 +90,7 @@ metadata/_custom_type_script = "uid://dvvfvlutisecy" [sub_resource type="Resource" id="Resource_hpfyh"] script = ExtResource("2_tc21q") -owner = SubResource("Resource_ie6m2") +owner = SubResource("Resource_4xviq") layer = ExtResource("2_4xviq") [sub_resource type="Gradient" id="Gradient_frwbc"] @@ -110,7 +109,6 @@ needs_motion_vectors = false needs_normal_roughness = false script = ExtResource("6_hdnet") distortionAmount = 0.0049 -blendAmount = 0.0 smearingSteps = 1 smearing = 1.0 redShift = 0.0 @@ -136,7 +134,7 @@ metadata/_custom_type_script = "uid://dvvfvlutisecy" [sub_resource type="Resource" id="Resource_gxlxg"] script = ExtResource("2_tc21q") -owner = SubResource("Resource_ie6m2") +owner = SubResource("Resource_4xviq") layer = ExtResource("2_4xviq") [sub_resource type="CompressedTexture2D" id="CompressedTexture2D_4n83u"] @@ -158,7 +156,6 @@ needs_motion_vectors = false needs_normal_roughness = false script = ExtResource("6_hdnet") distortionAmount = 0.0026 -blendAmount = 0.0 smearingSteps = 1 smearing = 1.0 redShift = 0.0 @@ -174,7 +171,7 @@ metadata/_custom_type_script = "uid://balixgskgouhm" [sub_resource type="Resource" id="Resource_3tnad"] script = ExtResource("2_tc21q") -owner = SubResource("Resource_ie6m2") +owner = SubResource("Resource_4xviq") layer = ExtResource("2_4xviq") [sub_resource type="CompositorEffect" id="CompositorEffect_hdnet"] diff --git a/Runtime/Shading/Library/Time.gdshaderinc b/Runtime/Shading/Library/Time.gdshaderinc index f79426f..4a684dc 100644 --- a/Runtime/Shading/Library/Time.gdshaderinc +++ b/Runtime/Shading/Library/Time.gdshaderinc @@ -3,7 +3,7 @@ float timeSine( float _TIME, float duration ) { - float t = TIME / duration * 2.0 * PI; + float t = _TIME / duration * 2.0 * PI; return sin( t ); } diff --git a/Runtime/Shading/Materials/Materials.cs b/Runtime/Shading/Materials/Materials.cs index 51e7b62..2958591 100644 --- a/Runtime/Shading/Materials/Materials.cs +++ b/Runtime/Shading/Materials/Materials.cs @@ -220,6 +220,11 @@ namespace Rokojori } + public static void AddToNextPass( Material material, Material nextPassMaterial ) + { + GetLastMaterial( material ).NextPass = nextPassMaterial; + } + public static void RemoveOverlay( Node node, Material material, bool forceTop = true ) { if ( node is GeometryInstance3D gi ) diff --git a/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresneOverlayBase.gdshaderinc b/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresneOverlayBase.gdshaderinc new file mode 100644 index 0000000..5fbd4a2 --- /dev/null +++ b/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresneOverlayBase.gdshaderinc @@ -0,0 +1,36 @@ + + +#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Light.gdshaderinc" +#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Transform.gdshaderinc" + +uniform vec4 albedo : source_color; +uniform sampler2D texture_albedo : source_color, filter_linear_mipmap, repeat_enable; + +uniform float grow : hint_range(-16.0, 16.0, 0.001); + +uniform float fresnelSharpness = 2; +uniform float fresnelMultiply = 1; +uniform float fresnelOffset = 0; + +uniform bool clampAlpha = false; + +void vertex() +{ + VERTEX += NORMAL * grow; +} + +void fragment() +{ + vec2 uv = UV; + float fresnelAmount = fresnel( NORMAL, VIEW, fresnelSharpness) * fresnelMultiply + fresnelOffset; + fresnelAmount = clamp( fresnelAmount, 0.0, 1.0 ); + vec4 albedo_tex = texture( texture_albedo, uv ); + + ALBEDO = albedo.rgb * albedo_tex.rgb; + ALPHA *= albedo.a * albedo_tex.a * fresnelAmount; + + if ( clampAlpha ) + { + ALPHA = clamp( ALPHA, 0.0, 1.0 ); + } +} diff --git a/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresneOverlayBase.gdshaderinc.uid b/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresneOverlayBase.gdshaderinc.uid new file mode 100644 index 0000000..bad2f30 --- /dev/null +++ b/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresneOverlayBase.gdshaderinc.uid @@ -0,0 +1 @@ +uid://dm8v3hgd0ac0c diff --git a/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlay.gdshader b/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlay.gdshader index 72c59fe..6bd70ff 100644 --- a/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlay.gdshader +++ b/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlay.gdshader @@ -1,31 +1,5 @@ -// NOTE: Shader automatically converted from Godot Engine 4.3.rc.mono's StandardMaterial3D. - shader_type spatial; -render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_burley, specular_schlick_ggx, unshaded, shadows_disabled; +render_mode blend_mix, depth_draw_opaque, cull_back, unshaded, shadows_disabled; -#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Light.gdshaderinc" -#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Transform.gdshaderinc" +#include "res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresneOverlayBase.gdshaderinc" -uniform vec4 albedo : source_color; -uniform sampler2D texture_albedo : source_color, filter_linear_mipmap, repeat_enable; -uniform float grow : hint_range(-16.0, 16.0, 0.001); - -uniform float fresnelSharpness = 2; -uniform float fresnelMultiply = 1; -uniform float fresnelOffset = 0; - -void vertex() -{ - VERTEX += NORMAL * grow; -} - -void fragment() -{ - vec2 uv = UV; - float fresnelAmount = fresnel( NORMAL, VIEW, fresnelSharpness) * fresnelMultiply + fresnelOffset; - fresnelAmount = clamp( fresnelAmount, 0.0, 1.0 ); - vec4 albedo_tex = texture( texture_albedo, uv ); - - ALBEDO = albedo.rgb * albedo_tex.rgb; - ALPHA *= albedo.a * albedo_tex.a * fresnelAmount; -} diff --git a/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayAdd.gdshader b/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayAdd.gdshader new file mode 100644 index 0000000..e95770e --- /dev/null +++ b/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayAdd.gdshader @@ -0,0 +1,4 @@ +shader_type spatial; +render_mode blend_add, depth_draw_opaque, cull_back, unshaded, shadows_disabled; + +#include "res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresneOverlayBase.gdshaderinc" diff --git a/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayAdd.gdshader.uid b/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayAdd.gdshader.uid new file mode 100644 index 0000000..1bd44d2 --- /dev/null +++ b/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayAdd.gdshader.uid @@ -0,0 +1 @@ +uid://c8wibq5djliwr diff --git a/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayMaterial.cs b/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayMaterial.cs index dd2d392..140ccf9 100644 --- a/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayMaterial.cs +++ b/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayMaterial.cs @@ -2,7 +2,6 @@ using Godot; namespace Rokojori { - // Generated by ShaderClassGenerator public class FresnelOverlayShader { @@ -10,6 +9,22 @@ namespace Rokojori "res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlay.gdshader" ); + public static readonly CachedResource addShader = new CachedResource( + "res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayAdd.gdshader" + ); + + public static readonly CachedResource subtractShader = new CachedResource( + "res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlaySubtract.gdshader" + ); + + public static readonly CachedResource multiplyShader = new CachedResource( + "res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayMultiply.gdshader" + ); + + public static readonly CachedResource preMultiplyShader = new CachedResource( + "res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayPreMultiply.gdshader" + ); + public static readonly ColorPropertyName albedo = ColorPropertyName.Create( "albedo" ); public static readonly FloatPropertyName grow = FloatPropertyName.Create( "grow" ); public static readonly FloatPropertyName fresnelSharpness = FloatPropertyName.Create( "fresnelSharpness" ); @@ -17,6 +32,39 @@ namespace Rokojori public static readonly FloatPropertyName fresnelOffset = FloatPropertyName.Create( "fresnelOffset" ); public static readonly Sampler2DPropertyName textureAlbedo = Sampler2DPropertyName.Create( "texture_albedo" ); + public static readonly BoolPropertyName clampAlpha = BoolPropertyName.Create( "clampAlpha" ); + + + public static Shader GetShaderWithBlendMode( BaseMaterial3D.BlendModeEnum blendMode ) + { + if ( BaseMaterial3D.BlendModeEnum.Mix == blendMode ) + { + return shader.Get(); + } + + if ( BaseMaterial3D.BlendModeEnum.Add == blendMode ) + { + return addShader.Get(); + } + + if ( BaseMaterial3D.BlendModeEnum.Mul == blendMode ) + { + return multiplyShader.Get(); + } + + if ( BaseMaterial3D.BlendModeEnum.Sub == blendMode ) + { + return subtractShader.Get(); + } + + if ( BaseMaterial3D.BlendModeEnum.PremultAlpha == blendMode ) + { + return preMultiplyShader.Get(); + } + + return null; + } + } [Tool] @@ -30,17 +78,22 @@ namespace Rokojori public readonly CustomMaterialProperty fresnelMultiply; public readonly CustomMaterialProperty fresnelOffset; public readonly CustomMaterialProperty textureAlbedo; + public readonly CustomMaterialProperty clampAlpha; public FresnelOverlayMaterial() { Shader = FresnelOverlayShader.shader.Get(); albedo = new CustomMaterialProperty( this, FresnelOverlayShader.albedo ); + grow = new CustomMaterialProperty( this, FresnelOverlayShader.grow ); fresnelSharpness = new CustomMaterialProperty( this, FresnelOverlayShader.fresnelSharpness ); fresnelMultiply = new CustomMaterialProperty( this, FresnelOverlayShader.fresnelMultiply ); fresnelOffset = new CustomMaterialProperty( this, FresnelOverlayShader.fresnelOffset ); + textureAlbedo = new CustomMaterialProperty( this, FresnelOverlayShader.textureAlbedo ); + + clampAlpha = new CustomMaterialProperty( this, FresnelOverlayShader.clampAlpha ); } } diff --git a/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayMultiply.gdshader b/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayMultiply.gdshader new file mode 100644 index 0000000..5bd4c2c --- /dev/null +++ b/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayMultiply.gdshader @@ -0,0 +1,4 @@ +shader_type spatial; +render_mode blend_mul, depth_draw_opaque, cull_back, unshaded, shadows_disabled; + +#include "res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresneOverlayBase.gdshaderinc" diff --git a/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayMultiply.gdshader.uid b/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayMultiply.gdshader.uid new file mode 100644 index 0000000..f11d51f --- /dev/null +++ b/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayMultiply.gdshader.uid @@ -0,0 +1 @@ +uid://bedxovddacc5w diff --git a/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayPreMultiply.gdshader b/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayPreMultiply.gdshader new file mode 100644 index 0000000..b6d937c --- /dev/null +++ b/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayPreMultiply.gdshader @@ -0,0 +1,4 @@ +shader_type spatial; +render_mode blend_premul_alpha, depth_draw_opaque, cull_back, unshaded, shadows_disabled; + +#include "res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresneOverlayBase.gdshaderinc" diff --git a/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayPreMultiply.gdshader.uid b/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayPreMultiply.gdshader.uid new file mode 100644 index 0000000..34577ec --- /dev/null +++ b/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayPreMultiply.gdshader.uid @@ -0,0 +1 @@ +uid://cg21q1crfjmwu diff --git a/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlaySubtract.gdshader b/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlaySubtract.gdshader new file mode 100644 index 0000000..580b271 --- /dev/null +++ b/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlaySubtract.gdshader @@ -0,0 +1,4 @@ +shader_type spatial; +render_mode blend_sub, depth_draw_opaque, cull_back, unshaded, shadows_disabled; + +#include "res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresneOverlayBase.gdshaderinc" diff --git a/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlaySubtract.gdshader.uid b/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlaySubtract.gdshader.uid new file mode 100644 index 0000000..7b001cb --- /dev/null +++ b/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlaySubtract.gdshader.uid @@ -0,0 +1 @@ +uid://dcje2exdw01o7 diff --git a/Runtime/Shading/Shaders/Effects/Impact/Impact.gdshader b/Runtime/Shading/Shaders/Effects/Impact/Impact.gdshader new file mode 100644 index 0000000..95ad7d2 --- /dev/null +++ b/Runtime/Shading/Shaders/Effects/Impact/Impact.gdshader @@ -0,0 +1,4 @@ +shader_type spatial; +render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_burley, specular_schlick_ggx, unshaded, shadows_disabled; + +#include "res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/Impact/ImpactBase.gdshaderinc" \ No newline at end of file diff --git a/Runtime/Shading/Shaders/Effects/Impact/Impact.gdshader.uid b/Runtime/Shading/Shaders/Effects/Impact/Impact.gdshader.uid new file mode 100644 index 0000000..6d5427a --- /dev/null +++ b/Runtime/Shading/Shaders/Effects/Impact/Impact.gdshader.uid @@ -0,0 +1 @@ +uid://bvu272trv53hw diff --git a/Runtime/Shading/Shaders/Effects/Impact/ImpactAdd.gdshader b/Runtime/Shading/Shaders/Effects/Impact/ImpactAdd.gdshader new file mode 100644 index 0000000..879986f --- /dev/null +++ b/Runtime/Shading/Shaders/Effects/Impact/ImpactAdd.gdshader @@ -0,0 +1,4 @@ +shader_type spatial; +render_mode blend_add, depth_draw_opaque, cull_back, diffuse_burley, specular_schlick_ggx, unshaded, shadows_disabled; + +#include "res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/Impact/ImpactBase.gdshaderinc" \ No newline at end of file diff --git a/Runtime/Shading/Shaders/Effects/Impact/ImpactAdd.gdshader.uid b/Runtime/Shading/Shaders/Effects/Impact/ImpactAdd.gdshader.uid new file mode 100644 index 0000000..a71d7fb --- /dev/null +++ b/Runtime/Shading/Shaders/Effects/Impact/ImpactAdd.gdshader.uid @@ -0,0 +1 @@ +uid://c5714xo0bl3cw diff --git a/Runtime/Shading/Shaders/Effects/Impact/ImpactBase.gdshaderinc b/Runtime/Shading/Shaders/Effects/Impact/ImpactBase.gdshaderinc new file mode 100644 index 0000000..f2d4422 --- /dev/null +++ b/Runtime/Shading/Shaders/Effects/Impact/ImpactBase.gdshaderinc @@ -0,0 +1,66 @@ + +#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Light.gdshaderinc" +#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Transform.gdshaderinc" +#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Math.gdshaderinc" +#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Time.gdshaderinc" +#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Noise.gdshaderinc" + +uniform vec4 albedo : source_color; + +uniform float driver:hint_range(0,1) = 0; + +group_uniforms Impact; +uniform vec3 impactPositionWorld; + +uniform sampler2D impactRadiusTexture : source_color, filter_linear_mipmap, repeat_disable; +uniform sampler2D impactRangeTexture : source_color, filter_linear_mipmap, repeat_disable; + +uniform sampler2D impactTexture : source_color, filter_linear_mipmap, repeat_enable; +group_uniforms; + +group_uniforms Noise; +uniform float noiseAmount: hint_range(0, 1) = 0.5; +uniform float noiseScale: hint_range(0, 100) = 1; +uniform vec3 noiseScroll = vec3( 1, 1, 1 ); +uniform vec2 noiseDriverScale = vec2( 1.0, 1.0 ); +group_uniforms; + +group_uniforms Noise2; +uniform float noiseAmount2: hint_range(0, 1) = 0.5; +uniform float noiseScale2: hint_range(0, 100) = 1; +uniform vec3 noiseScroll2 = vec3( 1, 1, 1 ); +uniform vec2 noiseDriverScale2 = vec2( 1.0, 1.0 ); +group_uniforms; + + +void fragment() +{ + vec2 uv = UV; + vec3 worldVertex = viewToWorld( VERTEX, INV_VIEW_MATRIX ); + vec3 relativeWorldVertex = worldVertex - NODE_POSITION_WORLD; + + float currentRadius = textureLod( impactRadiusTexture, vec2( driver, 0.0 ), 0 ).r; + float impactRange = textureLod( impactRangeTexture, vec2( driver, 0.0 ), 0 ).r; + + vec3 scanDir = worldVertex - impactPositionWorld; + vec3 normalizedScanDir = normalize( scanDir ); + float d = max( 0.0, length( scanDir ) - currentRadius ); + d /= impactRange; + d = clamp01( d ); + + + vec4 impactColor = texture( impactTexture, vec2( d, 0.0 ) ); + + float driverScale = mix( noiseDriverScale.x, noiseDriverScale.y, driver ); + float driverScale2 = mix( noiseDriverScale2.x, noiseDriverScale2.y, driver ); + + float noise = perlin3D( relativeWorldVertex * noiseScale * driverScale + noiseScroll * TIME ); + + noise = mix( 1, noise, noiseAmount ); + + float noise2 = perlin3D( relativeWorldVertex * noiseScale2 * driverScale2 + noiseScroll2 * TIME ); + + noise2 = mix( 1, noise2, noiseAmount2 ); + ALBEDO = albedo.rgb * impactColor.rgb; + ALPHA = clamp01( albedo.a * impactColor.a * noise * noise2 ); +} diff --git a/Runtime/Shading/Shaders/Effects/Impact/ImpactBase.gdshaderinc.uid b/Runtime/Shading/Shaders/Effects/Impact/ImpactBase.gdshaderinc.uid new file mode 100644 index 0000000..f5f6e1a --- /dev/null +++ b/Runtime/Shading/Shaders/Effects/Impact/ImpactBase.gdshaderinc.uid @@ -0,0 +1 @@ +uid://b1w62csgf0ijn diff --git a/Runtime/Shading/Shaders/Effects/ScanGradient/ScanGradient White.material b/Runtime/Shading/Shaders/Effects/ScanGradient/ScanGradient White.material index 74b0733eb03c1fce14afcbe7b9e13799577e712e..4ad1200e1bc927a60889eada2c7cfc45e5e3a6e0 100644 GIT binary patch literal 811 zcmV+`1JwLdQ$s@n000005C8zR1^@sP0{{RhwJ-f(wFONW0CpmKNbu4m9n|~})G#u3 zP+dT|-u0g6FfLB_h`EkfH3A~g_A-;bVT?^$lZ4z4Y&!d+tzC|xu??*k;3s;Bd39I; z0KgoHA}IvM6jlIU0Br!R+5aTBmo1A`|CgLK`PtaDtJ=zWt6rpaUfI>J`O^7c!P%44 ztv3a8>?~RLWUEJNK&!s#!*{%Nqe!m$gXfzZp%_Nl!&7@GO z00BoN$a~>Cxt<2)S;1t9Irj+W; z(Ge2NIYNRkE|O3pGC-me4eBtOk%63YAjOK{4;`0`!VaEHrh|tpMCBukiC`nk4gxoX z$bqLAL@x04(+pt&eyD*db7Ul-nV_gi+E4;9$jZh85&)D%4O*g%L^6S7U{EPd`vxY! zO2c(i$efVgWyDylsAX4lKzDb`eoX44V~ch%fr0gF?L-abiRbquQu^upzg`_=EtBCK z3M6X!THhFj=Z3_sCT%rV1d-|!iH%W0gEfPX6g1Y)e9F`dlXP3*ki<6$!>8oIxm%Fm zwFzr@V>Paf%Ew6r;(Op{8sx+`eXq3Egl$>0(T-melC`aVPdc{jO>0t#l~2BS+BO77 zFrL$9AP|9=0~p38SHIhXS+O6`*^yFV3*185#0z{91IMnq@hSn1=q!Byf5B^w?jAZ1 pDg2R^#g0hu%n6_m8o7Gmm7X1+{-;;}JQkh4n3IDF1WZy>Lqkt!hLZpQ literal 785 zcmV+s1Md7%Q$s@n000005C8y$1^@v00ssIgwJ-f(g#~>V0EVG?OEO{#Q~+E6W&n-Z{~@=RZ7Nm&i<~jp+1Pcf*n)Fbxk&50a;shQrSt#EnUj>{ zOc}GW-ndDuZjrHGRm=Tf<^KvuiA0M=5d-6!oXuC_G-pyf{WtI*Dh~MDz)L+W)+=}xq0a- z=l!&7)Z8!`XIGvoqV}`2W|@4iWVQbt*P#-#ERlN^8gfoK3?NIvb*VsBiV0}M1cU&x zP)tJP|`IPjOys9=3q@l*Iug7Uw>2!ZPd5Mn|yQ3INe>I@N45xgNPf-otJN+B*l zp%M(vi1Fg;Al*RvhTshxmrDW-olB;Jhs)z+qr9FhG&y#o z8`|+yy1Ml}WTAjnebI0>kDkw}$LE`G%Lk&obYRq1U$JNyNVs{QA>!qc^pfu Pfz^zcdp!arQd2`i+DCs6 diff --git a/Runtime/Shading/Shaders/Effects/ScanGradient/ScanGradient.gdshader b/Runtime/Shading/Shaders/Effects/ScanGradient/ScanGradient.gdshader index 9afe4ea..4e5f069 100644 --- a/Runtime/Shading/Shaders/Effects/ScanGradient/ScanGradient.gdshader +++ b/Runtime/Shading/Shaders/Effects/ScanGradient/ScanGradient.gdshader @@ -13,12 +13,15 @@ uniform vec4 albedo : source_color; uniform sampler2D texture_albedo : source_color, filter_linear_mipmap, repeat_enable; uniform float grow : hint_range(-16.0, 16.0, 0.001); +uniform float offset:hint_range(0,1) = 0; + uniform sampler2D scanTexture : source_color, filter_linear_mipmap, repeat_enable; -uniform float range; -uniform float offset; +uniform float rangeStart = 0.0; +uniform float rangeEnd = 1.0; uniform float rangeWobble = 0.1; uniform float rangeWobbleDuration = 1; + uniform float offsetWobble = 0.1; uniform float offsetWobbleDuration = 1; @@ -44,12 +47,18 @@ void fragment() float rangeWobbleValue = timeSine( TIME, rangeWobbleDuration ); float offsetWobbleValue = timeSine( TIME, offsetWobbleDuration ); - float animatedRange = range + rangeWobbleValue * rangeWobble; - float animatedOffset = - ( offset + offsetWobbleValue * offsetWobble ); - vec4 albedo_tex = texture( texture_albedo, uv ); - float scanUV = normalizeToRange01( localVertex.y, animatedOffset - animatedRange, animatedOffset + animatedRange ); + float currentRangeWobble = rangeWobbleValue * rangeWobble; + float currentOffsetWobble = offsetWobbleValue * offsetWobble; + + float minRange = rangeStart - currentRangeWobble; + float maxRange = rangeEnd + currentRangeWobble; + + float localYOffset = mix( minRange, maxRange, offset ); + + float scanUV = normalizeToRange01( localVertex.y + currentOffsetWobble + localYOffset, minRange, maxRange ); vec4 scanColor = texture( scanTexture, vec2( scanUV, 0 ) ); + vec4 albedo_tex = texture( texture_albedo, uv ); float noise = perlin3D( localVertex * noiseScale + noiseOffset * TIME ); noise = mix( 1, noise, noiseAmount ); ALBEDO = albedo.rgb * scanColor.rgb * rgbScale; diff --git a/Runtime/Shading/Shaders/Effects/Scanner/Scanner.gdshader b/Runtime/Shading/Shaders/Effects/Scanner/Scanner.gdshader new file mode 100644 index 0000000..0a17c56 --- /dev/null +++ b/Runtime/Shading/Shaders/Effects/Scanner/Scanner.gdshader @@ -0,0 +1,4 @@ +shader_type spatial; +render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_burley, specular_schlick_ggx, unshaded, shadows_disabled; + +#include "res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/Scanner/ScannerBase.gdshaderinc" \ No newline at end of file diff --git a/Runtime/Shading/Shaders/Effects/Scanner/Scanner.gdshader.uid b/Runtime/Shading/Shaders/Effects/Scanner/Scanner.gdshader.uid new file mode 100644 index 0000000..3408c37 --- /dev/null +++ b/Runtime/Shading/Shaders/Effects/Scanner/Scanner.gdshader.uid @@ -0,0 +1 @@ +uid://bdjl44rcb2la0 diff --git a/Runtime/Shading/Shaders/Effects/Scanner/ScannerBase.gdshaderinc b/Runtime/Shading/Shaders/Effects/Scanner/ScannerBase.gdshaderinc new file mode 100644 index 0000000..f8ecc0c --- /dev/null +++ b/Runtime/Shading/Shaders/Effects/Scanner/ScannerBase.gdshaderinc @@ -0,0 +1,83 @@ + +#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Light.gdshaderinc" +#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Transform.gdshaderinc" +#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Math.gdshaderinc" +#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Time.gdshaderinc" +#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Noise.gdshaderinc" + +uniform vec4 albedo : source_color; + +uniform float driver:hint_range(0,1) = 0; + +group_uniforms Scanner; +uniform vec3 position; +uniform vec3 direction; +uniform float scannerSize; +uniform sampler2D scanTexture : source_color, filter_linear_mipmap, repeat_enable; +group_uniforms; + +group_uniforms Noise; +uniform float noiseAmount: hint_range(0, 1) = 0.5; +uniform float noiseScale: hint_range(0.1, 100) = 1; +uniform vec3 noiseScroll = vec3( 1, 1, 1 ); +uniform float noiseScrollFromScanDirection = 0; +group_uniforms; + +group_uniforms Noise2; +uniform float noiseAmount2: hint_range(0, 1) = 0.5; +uniform float noiseScale2: hint_range(0.1, 100) = 1; +uniform vec3 noiseScroll2 = vec3( 1, 1, 1 ); +uniform float noiseScrollFromScanDirection2 = 0; +group_uniforms; + +float lineFactor( vec3 p, vec3 start, vec3 end ) +{ + vec3 dir = end - start; + float dotDir = dot( dir, dir ); + + if ( dotDir < 0.0000001 ) + { + return 0.0; + } + + float lineParameter = dot( p - start, dir ) / dotDir; + return clamp01( lineParameter ); +} + +void vertex() +{ + // localVertex = VERTEX * ( MODEL_NORMAL_MATRIX ); +} + +void fragment() +{ + vec2 uv = UV; + vec3 relativeWorldVertex = viewToWorld( VERTEX, INV_VIEW_MATRIX ); + + vec3 scanDir = ( direction ); + vec3 normalizedScanDir = normalize( scanDir ); + vec3 scanStart = position; + vec3 scanEnd = position + direction; + + vec3 currentScanPosition = mix( scanStart, scanEnd, driver ); + vec3 scannerDirection = normalizedScanDir * scannerSize * 0.5; + + vec3 scanGradientBegin = currentScanPosition - scannerDirection; + vec3 scanGradientEnd = currentScanPosition + scannerDirection; + + + float d = lineFactor( relativeWorldVertex, scanGradientBegin, scanGradientEnd ); + + vec4 scanColor = texture( scanTexture, vec2( d, 0.0 ) ); + + + float noise = perlin3D( relativeWorldVertex * noiseScale + ( noiseScroll + noiseScrollFromScanDirection * normalizedScanDir )* TIME ); + + noise = mix( 1, noise, noiseAmount ); + + float noise2 = perlin3D( relativeWorldVertex * noiseScale2 + ( noiseScroll2 + noiseScrollFromScanDirection2 * normalizedScanDir )* TIME ); + + noise2 = mix( 1, noise2, noiseAmount2 ); + ALBEDO = albedo.rgb * scanColor.rgb; + ALPHA = clamp01( albedo.a * scanColor.a * noise * noise2 ); +} diff --git a/Runtime/Shading/Shaders/Effects/Scanner/ScannerBase.gdshaderinc.uid b/Runtime/Shading/Shaders/Effects/Scanner/ScannerBase.gdshaderinc.uid new file mode 100644 index 0000000..2bd033c --- /dev/null +++ b/Runtime/Shading/Shaders/Effects/Scanner/ScannerBase.gdshaderinc.uid @@ -0,0 +1 @@ +uid://but35f3ivfkmd diff --git a/Runtime/Shading/Shaders/Effects/TriPlanarOverlay/TriPlanarOverlay BlueShield.material b/Runtime/Shading/Shaders/Effects/TriPlanarOverlay/TriPlanarOverlay BlueShield.material index 79c78bfc4b5bcc3cb8705427f82cbe9c13ae1b72..99b195cb4e3cbf4f99767b24217f72cb12d6d0eb 100644 GIT binary patch literal 431 zcmV;g0Z{%@Q$s@n000005C8yU0{{S*0RR9fwJ-f(V*+gq00tFEIbcwq>OQNAkP+22YB^!#A?LUr0bX{9F<>fbqX^8H2^jM z=W6A`S@J~PtS;^}qvNTsNxA=H{wo|L8*nKV&`|uRJT7dm+i89)`uxBAulz6gPw)rW z^>9jATD>Cbp5zE}*d^h(uR7wI`FsqD+nOs^+iN-c-{6$4&yXoHyHPpc+tx0q^?%^if<0Bq6=Sm#@ye88y#D>r(;{%EvLOi`Q`Dj-mTF~^2@7uj6Ti!g55J$bN8@~6XMJVv)!+?M?!vqqFr ziwoeWkQFvD0R{$0h&O{JbHtKMU=G5WCvn>f{b08f87p|t^nr^gJV1>+rP=fzUH+ej Z1I=R#QAu8Xl{~nIo4=pK3KmjRLqqT5#b*Ej literal 414 zcmV;P0b%}9Q$s@n000005C8yQ0{{Sq0RR9fwJ-f(UjpR|0QS>EHc-VT9WWF0Xc3v2 zSt6O48IWnVnUGB$vN!v&))Kjdd|bm-QNdV0L)}tjz3QR^o2yB2+C~a805JeF04^$g zCyfc;xKTGb8`Ma`wh>pdm;Yn_BYfimZ~+ORiTF=B)WdD!@D<9 zte|c#F7!03f@sUt4DHNZy7fS1ymKdIrCR?dc(+n*hBp4U{F;yDW2*56kL~nktT^mq zWzT~x$~Plzk0pofkjy$t=aeytrv3+fQjenl` zC_Wbc4`48qNywyea383%6|Bg3Fp!8$l#EQ`-A8jNB*dG+k~w0@ zC14JcnRjv95c&bP6F*jV&r|~!R(S9lc}jEXJ-hrj4I`RYEkw1v;#Kl;4{Uz&dbx`M IEK*ZLLlfq=?*IS* diff --git a/Runtime/Shading/Shaders/Effects/TriPlanarOverlay/TriPlanarOverlay WhiteShield.material b/Runtime/Shading/Shaders/Effects/TriPlanarOverlay/TriPlanarOverlay WhiteShield.material index d9f1e383a2049d9f9eeb0e0dd74d513d2068da6b..4204f654a554cb864c33e339385edcd19a841fa4 100644 GIT binary patch literal 984 zcmV;}11J1aQ$s@n000005C8y82mk=U0{{RhwJ-f(O$W6d0A?(ZMDVmE9n|-G;5w)I z!2_Gt&(_028+g$K2ynmYphy!)2;;0h^KWt#K zQ~@1r3UL5)0C)iP6uB#Hjw|Z)SV-pa?P*nCZ_KWR2~JtH^^z{2 z-4mj8<$Ud=ttFHfJBhW0ayHla>U@3C8kz#*-r7znWF;kgtJ=MtU}Qn7p8a}WYK!D$rQq( z&8PS*#$JsXkhSXV(t~Z=YnhTQWLq>!=hm`#Ch0$Ujf}BMnxJW_jNx9isWO>3dr_(^ zLgUWr5LeNq;}Tq}xiYrBv(cTc4sn#PXKQwmdtzCs_G>|#iwsMRU%a_kgNp?pfJi_k zegN@-!TS0Cvj3SP=X)8Ij|~rDf#728)#*9x9TcsMNr49OQ>0aeb&2A{hT`zEe}C zoCZQC$N`S;%^I#bW@*$k78!6t~g8-Kd^PDF@V$hHmu#@OadUW!{w;< z;_@R?+RT7WC$1!GTD5FRT%Fi5=0Y|o&cGHZnU@#%?s(VTokH)R+;qmToUTBaL(@cP&8%4&o)VMD+LwFyA_5rFkc=a*?7edoo~uo2-0elFQBq24f$5AE zy|*i(UbF;ITgSB8*^dnH4i^Y^^Y+DQFI!S%&ws?z8`8d!a31PU_B4-+3TVGqg{~b^ GQ$s^@Yu;Y~ literal 982 zcmV;{11bDcQ$s@n000005C8x{2mk=S0{{RhwJ-f(K?kKB09LGyL;$lS9rkaa7eJ{3 z?EolrfDQlvP&!IcT8y^X$e#RrZ*J6fYfWxadR(L9tPS<ti}KZlayHla{;!;|jVkBJ7j3dOxR->Dug)ap{?FjQjm!`rByfCqm^s|n zT-T@B?J4O0f&T*joBRjx2ei4!kklw;i0y#Wx!8PIy6p9kaBA4B@vwGs$K!Bh0Q4wy>a1**FqMp7ne#REZS^} z&tmM=m;qU<-X=ZRw!M}pIV9VnQ98Glg+u3mlE$4?71x>9$QY-j4@^sC4ELffmA%B- zdrD;zE*+ELTFsTQ?VXM8Y*oeb^=!>9a!+i#F^e~`j5HT(aIu!L(XIW40w92bfJ$m~ zdUEK%VV!2@|F2=E=5bKbgNBg|KZXky{#T$dL1zY$9S}%JU|w8uBJfDrDZ*2ug=J;* zLB@(48$Urx{;PC&5p!eY;vc;qlMxCbF*-kfOdg!Xz-S!gcM9VAPAO(u{FnJnMU`w? zhz&vxV4R3msH<^(JtZpL5kJarY*ZXujr`m;k7eQfUvT8kL=%9jsDULy3W3 z!~zoay`vm?Jsk}Eqolw=U!~Xu6HVShuR93Aw%9(b>Toc#NYzz<1A5v}U)P<#&s6JL zxwH+$#Y?$#t!FB}GYH)*`9sxa0ZX%!x10y`FD80iG$fOgls2OXNH1}}r>9kFJuwnM3UK;zn~SWHxU^qcO<}TjX^ltvTrIi=Z7FHIHGByfpttD-c2~@ zMk1AJMWWC{+#+_5ovHQl;u)&L*^ieQJ!OkHi33U&U!+a_3biBim;U30Vkw?iC+L<5 z6CPUm+jJ1?)Z5u2GN+N5Y7si-@KRiXkd!3oCwNNEcjpqSC?L>BMcMiV&^9TuliXv) zx;Yw=oxX5~gM*pio#y*Sa=;8vc*qd*7mEn^jr4f@rJqXp^SV&g21Xe}?4!x815#5% EL+jGw-T(jq diff --git a/Runtime/Shading/Shaders/Effects/TriPlanarOverlay/TriPlanarOverlay.gdshader b/Runtime/Shading/Shaders/Effects/TriPlanarOverlay/TriPlanarOverlay.gdshader index b328f58..a5c10b9 100644 --- a/Runtime/Shading/Shaders/Effects/TriPlanarOverlay/TriPlanarOverlay.gdshader +++ b/Runtime/Shading/Shaders/Effects/TriPlanarOverlay/TriPlanarOverlay.gdshader @@ -25,7 +25,7 @@ void vertex() { vec3 normal = NORMAL; - uv_power_normal = pow( abs (NORMAL ), vec3( uv_blend_sharpness ) ); + uv_power_normal = pow( abs (NORMAL), vec3( uv_blend_sharpness ) ); uv_power_normal /= dot( uv_power_normal, vec3( 1.0 ) ); vec3 scaledVertex = VERTEX * extractScale( MODEL_NORMAL_MATRIX ); @@ -37,7 +37,9 @@ void vertex() void fragment() { vec4 albedo_tex = triplanarTexture( texture_albedo, uv_power_normal, uv_triplanar_pos ); - - ALBEDO = albedo.rgb * albedo_tex.rgb; - ALPHA *= albedo.a * albedo_tex.a; + + float alpha = albedo.a * albedo_tex.a; + float albedoAlphaBoost = max( 1.0, alpha ); + ALBEDO = albedo.rgb * albedo_tex.rgb * albedoAlphaBoost; + ALPHA = clamp( alpha, 0.0, 1.0 ); } diff --git a/Runtime/Structures/MultiMap3.cs b/Runtime/Structures/MultiMap3.cs new file mode 100644 index 0000000..21fc611 --- /dev/null +++ b/Runtime/Structures/MultiMap3.cs @@ -0,0 +1,71 @@ + +using System.Diagnostics; +using System.Collections; +using System.Collections.Generic; +using System; +using Godot; + + +namespace Rokojori +{ + public class MultiMap:Map>> + { + public bool Has( K1 key1, K2 key2, K3 key3 ) + { + if ( ! ContainsKey( key1 ) ) + { + return false; + } + + if ( ! this[ key1 ].ContainsKey( key2 ) ) + { + return false; + } + + + return this[ key1 ][ key2 ].ContainsKey( key3 ); + } + + public V Get( K1 key1, K2 key2, K3 key3 ) + { + if ( key1 == null || key2 == null || key3 == null || ! Has( key1, key2, key3 ) ) + { + return default(V); + } + + return this[ key1 ][ key2 ][ key3 ]; + } + + public void Set( K1 key, K2 key2, K3 key3, V value ) + { + if ( ! ContainsKey( key ) ) + { + this[ key ] = new Map>(); + this[ key ][ key2 ] = new Map(); + } + + this[ key ][ key2 ][ key3 ] = value; + } + + public void Remove( K1 key, K2 key2, K3 key3, V value ) + { + if ( ! Has( key, key2, key3 ) ) + { + return; + } + + this[ key ][ key2 ].Remove( key3 ); + + if ( this[ key ][ key2 ].Count == 0 ) + { + this[ key ].Remove( key2 ); + } + + if ( this[ key ].Count == 0 ) + { + Remove( key ); + } + + } + } +} \ No newline at end of file diff --git a/Runtime/Structures/MultiMap3.cs.uid b/Runtime/Structures/MultiMap3.cs.uid new file mode 100644 index 0000000..944535a --- /dev/null +++ b/Runtime/Structures/MultiMap3.cs.uid @@ -0,0 +1 @@ +uid://dby1sjayw5vjm diff --git a/Runtime/Time/Duration/SecondsDuration.cs b/Runtime/Time/Duration/SecondsDuration.cs index d64afce..d0ea0df 100644 --- a/Runtime/Time/Duration/SecondsDuration.cs +++ b/Runtime/Time/Duration/SecondsDuration.cs @@ -13,7 +13,7 @@ namespace Rokojori public partial class SecondsDuration:Duration { [Export] - public float seconds; + public float seconds = 1f; public override float GetDurationInSeconds() { diff --git a/Runtime/Time/TimeLineSpan.cs b/Runtime/Time/TimeLineSpan.cs index 59c12bc..3c92e97 100644 --- a/Runtime/Time/TimeLineSpan.cs +++ b/Runtime/Time/TimeLineSpan.cs @@ -30,12 +30,12 @@ namespace Rokojori public float duration => end - start; + public float elapsed => timeLine.position - start ; public float phase { get { - var position = timeLine.position; - return Mathf.Clamp( ( position - start ) / duration, 0, 1 ); + return Mathf.Clamp( elapsed / duration, 0, 1 ); } } } diff --git a/Runtime/Tools/Lists.cs b/Runtime/Tools/Lists.cs index 3a1c4ed..5ff2b4c 100644 --- a/Runtime/Tools/Lists.cs +++ b/Runtime/Tools/Lists.cs @@ -448,6 +448,18 @@ namespace Rokojori return ToList( elements ); } + public static List FromAny( IEnumerable elements ) + { + var list = new List(); + + foreach ( var e in elements ) + { + list.Add( e ); + } + + return list; + } + public static List FromLists( params List[] elements ) { var list = new List(); @@ -558,7 +570,7 @@ namespace Rokojori return list; } - public static bool Has( List list, T item ) + public static bool Has( this List list, T item ) { return list.IndexOf( item ) != - 1; } diff --git a/Runtime/Tools/ReflectionHelper.cs b/Runtime/Tools/ReflectionHelper.cs index 4b4e889..91caf24 100644 --- a/Runtime/Tools/ReflectionHelper.cs +++ b/Runtime/Tools/ReflectionHelper.cs @@ -436,9 +436,8 @@ namespace Rokojori return Lists.Map( infos, i => GetDataMemberValue( instance, i ) ); } - public static MemberInfo GetDataMemberInfo( object instance, string memberName, BindingFlags flags = BindingFlags.Public | BindingFlags.Instance ) + public static MemberInfo GetDataMemberInfo( Type type, string memberName, BindingFlags flags = BindingFlags.Public | BindingFlags.Instance ) { - var type = instance.GetType(); var fieldInfo = type.GetField( memberName, flags ); if ( fieldInfo != null ) @@ -449,6 +448,11 @@ namespace Rokojori return type.GetProperty( memberName, flags ); } + public static MemberInfo GetDataMemberInfo( object instance, string memberName, BindingFlags flags = BindingFlags.Public | BindingFlags.Instance ) + { + return GetDataMemberInfo( instance.GetType(), memberName, flags ); + } + public const BindingFlags defaultBindings = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | diff --git a/Runtime/VFX/FlareVFX/FlareType/StarFlareType.cs b/Runtime/VFX/FlareVFX/FlareType/StarFlareType.cs index fe43cfb..69ebbb7 100644 --- a/Runtime/VFX/FlareVFX/FlareType/StarFlareType.cs +++ b/Runtime/VFX/FlareVFX/FlareType/StarFlareType.cs @@ -63,77 +63,77 @@ namespace Rokojori [Export( PropertyHint.Range, "0,1")] - float speedMultiply = 1f; + public float speedMultiply = 1f; [Export] - Vector4 innerHsl = Vector4.Zero; + public Vector4 innerHsl = Vector4.Zero; [Export] - Vector4 outerHsl = Vector4.Zero; + public Vector4 outerHsl = Vector4.Zero; [Export( PropertyHint.Range, "0,5")] - float colorFillRange = 0.5f; + public float colorFillRange = 0.5f; [Export( PropertyHint.Range, "0.01,5")] - float colorFillDistributionPower = 1f; + public float colorFillDistributionPower = 1f; [ExportGroup( "Streaks")] [Export( PropertyHint.Range, "0,8")] - float streaksFrequency = 1f; + public float streaksFrequency = 1f; [Export( PropertyHint.Range, "0,16")] - float streaksRotation = 0f; + public float streaksRotation = 0f; [Export( PropertyHint.Range, "0,1")] - float streaksRotationSpeed = 0f; + public float streaksRotationSpeed = 0f; [Export( PropertyHint.Range, "0,2")] - float streaksNoise = 0f; + public float streaksNoise = 0f; [Export( PropertyHint.Range, "-2,2")] - float streaksNoiseOffset = 0f; + public float streaksNoiseOffset = 0f; [Export( PropertyHint.Range, "-1,1")] - float streaksNoiseScroll = 0f; + public float streaksNoiseScroll = 0f; [ExportGroup( "Streaks 2")] [Export] bool streaks2Enabled = false; [Export( PropertyHint.Range, "0,1")] - float streaksAddVsMult = 0f; + public float streaksAddVsMult = 0f; [Export( PropertyHint.Range, "0,5")] - float streaks2Multiply = 0f; + public float streaks2Multiply = 0f; [Export( PropertyHint.Range, "0,8")] - float streaksFrequency2 = 1f; + public float streaksFrequency2 = 1f; [Export( PropertyHint.Range, "0,16")] - float streaksRotation2 = 0f; + public float streaksRotation2 = 0f; [Export( PropertyHint.Range, "0,1")] - float streaksRotationSpeed2 = 0f; + public float streaksRotationSpeed2 = 0f; [Export( PropertyHint.Range, "0,2")] - float streaksNoise2 = 0f; + public float streaksNoise2 = 0f; [Export( PropertyHint.Range, "-2,2")] - float streaksNoiseOffset2 = 0f; + public float streaksNoiseOffset2 = 0f; [Export( PropertyHint.Range, "-1,1")] - float streaksNoiseScroll2 = 0f; + public float streaksNoiseScroll2 = 0f; [ExportGroup( "Mask")] [Export( PropertyHint.Range, "0,1")] - float maskScale = 0.5f; + public float maskScale = 0.5f; [Export( PropertyHint.Range, "0,2")] - float maskRange = 0.1f; + public float maskRange = 0.1f; [Export( PropertyHint.Range, "0,1")] - float maskRangeOscillation = 0.1f; + public float maskRangeOscillation = 0.1f; [Export( PropertyHint.Range, "0,1")] - float maskRangeOscillationSpeed = 0.1f; + public float maskRangeOscillationSpeed = 0.1f; [Export( PropertyHint.Range, "0,2")] - float maskInnerSize = 1f; + public float maskInnerSize = 1f; [Export( PropertyHint.Range, "0,2")] - float maskFrequency = 1f; + public float maskFrequency = 1f; [Export( PropertyHint.Range, "0,1")] - float maskRotation = 0f; + public float maskRotation = 0f; [Export( PropertyHint.Range, "-1,1")] - float maskRotationSpeed = 0f; + public float maskRotationSpeed = 0f; [ExportGroup( "Noise Blend")] [Export( PropertyHint.Range, "0,0.5")] - float blendingRange = 0.1f; + public float blendingRange = 0.1f; [ExportGroup( "Noise","noise")] diff --git a/Runtime/VFX/FlareVFX/FlareVFX.cs b/Runtime/VFX/FlareVFX/FlareVFX.cs index e252de2..8534c7f 100644 --- a/Runtime/VFX/FlareVFX/FlareVFX.cs +++ b/Runtime/VFX/FlareVFX/FlareVFX.cs @@ -31,7 +31,7 @@ namespace Rokojori List _layers = []; - void UpdateFlare() + public void UpdateFlare() { if ( preset == null ) { diff --git a/Runtime/VFX/FlareVFX/FlareVFXPresets/Red Orange Classic.tres b/Runtime/VFX/FlareVFX/FlareVFXPresets/Red Orange Classic.tres index 0ebfe13..07f10f2 100644 --- a/Runtime/VFX/FlareVFX/FlareVFXPresets/Red Orange Classic.tres +++ b/Runtime/VFX/FlareVFX/FlareVFXPresets/Red Orange Classic.tres @@ -1,4 +1,4 @@ -[gd_resource type="Resource" script_class="FlarePreset" load_steps=105 format=3 uid="uid://dp4g3uk1vgdg5"] +[gd_resource type="Resource" script_class="FlarePreset" load_steps=106 format=3 uid="uid://dp4g3uk1vgdg5"] [ext_resource type="Script" uid="uid://dmswtuayeoagf" path="res://addons/rokojori_action_library/Runtime/VFX/FlareVFX/FlareChromaticAberation/OrientatedFlareChromaticAberation.cs" id="1_ho1cr"] [ext_resource type="Script" uid="uid://c67s0ccpomg2s" path="res://addons/rokojori_action_library/Runtime/VFX/FlareVFX/FlareFading/EdgeFlareFading.cs" id="2_lw24a"] @@ -110,6 +110,12 @@ screenOffsetLayerScale = 0.153 screenOffsetLayerDirection = Vector2(1, 1) metadata/_custom_type_script = "uid://u3g0mlwlpd6s" +[sub_resource type="Resource" id="Resource_lw24a"] +script = ExtResource("1_ho1cr") +amount = 7.9906 +smear = 4.4186 +metadata/_custom_type_script = "uid://dmswtuayeoagf" + [sub_resource type="Resource" id="Resource_xxny3"] script = ExtResource("2_lw24a") power = 2.0 @@ -145,7 +151,7 @@ curve = SubResource("Curve_nt8a7") [sub_resource type="Resource" id="Resource_ade2u"] script = ExtResource("4_1hsao") -layerName = "Big Hexagons" +layerName = "Big Hexagons Ghosts" opacity = 0.1879 numLayers = 8 flareType = SubResource("Resource_adfmi") @@ -167,6 +173,7 @@ screenOffsetLayerDirection = Vector2(100, 100) rotationOverX = 45.0 rotationPerLayer = -2.0 fading = SubResource("Resource_xxny3") +chromaticAberation = SubResource("Resource_lw24a") metadata/_custom_type_script = "uid://u3g0mlwlpd6s" [sub_resource type="Resource" id="Resource_0y4dn"] @@ -197,7 +204,7 @@ curve = SubResource("Curve_ymqbv") [sub_resource type="Resource" id="Resource_jvxnt"] script = ExtResource("4_1hsao") -layerName = "Small Circles" +layerName = "Small Circles Ghosts" opacity = 0.3343 numLayers = 50 flareType = SubResource("Resource_0y4dn") @@ -325,7 +332,7 @@ curve = SubResource("Curve_008mr") [sub_resource type="Resource" id="Resource_nt8a7"] script = ExtResource("4_1hsao") -layerName = "Blend" +layerName = "Blend God Rays" opacity = 0.0141 flareType = SubResource("Resource_ui5ll") overwriteColor = Color(1.8247963, 1.8247963, 1.8247963, 1) @@ -734,7 +741,7 @@ curve = SubResource("Curve_6xf1f") [sub_resource type="Resource" id="Resource_skhw3"] script = ExtResource("4_1hsao") -layerName = "Rainbow Streaks" +layerName = "Rainbow God Rays" opacity = 0.1 flareType = SubResource("Resource_sxovr") overwriteColor = Color(2.8845115, 2.8845115, 2.8845115, 1) diff --git a/Runtime/VFX/FlashVFX/FlashPreset.cs b/Runtime/VFX/FlashVFX/FlashPreset.cs new file mode 100644 index 0000000..e000ac9 --- /dev/null +++ b/Runtime/VFX/FlashVFX/FlashPreset.cs @@ -0,0 +1,57 @@ +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + [Tool] + [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Flash.svg") ] + public partial class FlashPreset:Resource + { + + [Export] + public GradientGenerator colorGradient; + + [Export] + public Curve opacityCurve; + + [Export] + public Duration duration; + + [Export] + public FlashType flashType; + + public enum PositionMode + { + World_Origin, + Origin_Of_First, + Center_Of_All, + Position_Offset + } + + [ExportGroup("Light", "light")] + [Export] + public bool lightEnabled = false; + + [Export] + public PositionMode lightPosition = PositionMode.Origin_Of_First; + + [Export] + public Vector3 lightPositionOffset = Vector3.Zero; + + [Export] + public float lightRange = 5; + + [Export] + public float lightAttenutation = 2f; + + [Export] + public float lightEnergy = 2f; + + [Export] + public bool lightShadowCasting = false; + + + + + } +} \ No newline at end of file diff --git a/Runtime/VFX/FlashVFX/FlashPreset.cs.uid b/Runtime/VFX/FlashVFX/FlashPreset.cs.uid new file mode 100644 index 0000000..cb1e176 --- /dev/null +++ b/Runtime/VFX/FlashVFX/FlashPreset.cs.uid @@ -0,0 +1 @@ +uid://c78b88pjvobsi diff --git a/Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashPosition.cs b/Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashPosition.cs new file mode 100644 index 0000000..cd71e0a --- /dev/null +++ b/Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashPosition.cs @@ -0,0 +1,19 @@ +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + [Tool] + [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Flash.svg") ] + public partial class CustomFlashPosition:Resource + { + [Export] + public FlashPreset.PositionMode positionMode; + + [Export] + public Vector3 offset; + + [Export] + public Vector3PropertyName propertyName; + } +} \ No newline at end of file diff --git a/Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashPosition.cs.uid b/Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashPosition.cs.uid new file mode 100644 index 0000000..f61977b --- /dev/null +++ b/Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashPosition.cs.uid @@ -0,0 +1 @@ +uid://bn31ol127rm2i diff --git a/Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashType.cs b/Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashType.cs new file mode 100644 index 0000000..3ef26ee --- /dev/null +++ b/Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashType.cs @@ -0,0 +1,72 @@ +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + [Tool] + [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Flash.svg") ] + public partial class CustomFlashType:FlashType + { + [Export] + public Material flashMaterial; + + [Export] + public ColorPropertyName colorPropertyName; + + [Export] + public bool multiplyColorAlpha = true; + + [Export] + public FloatPropertyName opacityPropertyName; + + [Export] + public FloatPropertyName phasePropertyName; + + + [Export] + public CustomFlashPosition flashPosition; + + + public override void ApplyFlashType( + FlashVFXRunner runner, float phase, Color color, float opacity, + GeometryInstance3D gi, Material material ) + { + + var materialColor = color; + + if ( multiplyColorAlpha ) + { + materialColor.A *= opacity; + } + + if ( colorPropertyName != null ) + { + colorPropertyName.Set( material, materialColor ); + } + + if ( opacityPropertyName != null ) + { + opacityPropertyName.Set( material, opacity ); + } + + if ( phasePropertyName != null ) + { + phasePropertyName.Set( material, phase ); + } + + } + + public override Material CreateMaterial( FlashVFXRunner runner, GeometryInstance3D gi ) + { + var duplicateMaterial = (Material)flashMaterial.Duplicate(); + + if ( flashPosition != null ) + { + flashPosition.propertyName.Set( duplicateMaterial, runner.GetFlashPosition( flashPosition.positionMode, flashPosition.offset ) ); + } + + return duplicateMaterial; + } + + } +} \ No newline at end of file diff --git a/Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashType.cs.uid b/Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashType.cs.uid new file mode 100644 index 0000000..985b9e8 --- /dev/null +++ b/Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashType.cs.uid @@ -0,0 +1 @@ +uid://chl43fdu0vn81 diff --git a/Runtime/VFX/FlashVFX/FlashTypes/FlashType.cs b/Runtime/VFX/FlashVFX/FlashTypes/FlashType.cs new file mode 100644 index 0000000..5f224fa --- /dev/null +++ b/Runtime/VFX/FlashVFX/FlashTypes/FlashType.cs @@ -0,0 +1,26 @@ +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + [Tool] + [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Flash.svg") ] + public abstract partial class FlashType:Resource + { + public abstract void ApplyFlashType( + FlashVFXRunner runner, float phase, Color color, float opacity, + GeometryInstance3D gi, Material material + ); + + public abstract Material CreateMaterial( FlashVFXRunner runner, GeometryInstance3D gi ); + + public Material CreateAndInitializeMaterial( FlashVFXRunner runner, GeometryInstance3D gi, Color color, float opacity = 0f ) + { + var material = CreateMaterial( runner, gi ); + ApplyFlashType( runner, -1f, color, opacity, gi, material ); + return material; + } + + + } +} \ No newline at end of file diff --git a/Runtime/VFX/FlashVFX/FlashTypes/FlashType.cs.uid b/Runtime/VFX/FlashVFX/FlashTypes/FlashType.cs.uid new file mode 100644 index 0000000..5489f10 --- /dev/null +++ b/Runtime/VFX/FlashVFX/FlashTypes/FlashType.cs.uid @@ -0,0 +1 @@ +uid://blxhc8xcka2hf diff --git a/Runtime/VFX/FlashVFX/FlashTypes/FlatFlashType/FlatFlashType.cs b/Runtime/VFX/FlashVFX/FlashTypes/FlatFlashType/FlatFlashType.cs new file mode 100644 index 0000000..bf009d5 --- /dev/null +++ b/Runtime/VFX/FlashVFX/FlashTypes/FlatFlashType/FlatFlashType.cs @@ -0,0 +1,44 @@ +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + [Tool] + [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Flash.svg") ] + public partial class FlatFlashType:FlashType + { + [Export] + public BaseMaterial3D.BlendModeEnum blendMode = BaseMaterial3D.BlendModeEnum.Add; + + [Export] + public BaseMaterial3D.TransparencyEnum transparency = BaseMaterial3D.TransparencyEnum.Alpha; + + [Export] + public BaseMaterial3D.ShadingModeEnum shadingMode = BaseMaterial3D.ShadingModeEnum.Unshaded; + + public override void ApplyFlashType( + FlashVFXRunner runner, float phase, Color color, float opacity, + GeometryInstance3D gi, Material material ) + { + var sm = (StandardMaterial3D)material; + + var materialColor = color; + materialColor.A *= opacity; + + sm.AlbedoColor = materialColor; + + } + + public override Material CreateMaterial( FlashVFXRunner runner, GeometryInstance3D gi ) + { + var material = new StandardMaterial3D(); + + material.ShadingMode = shadingMode; + material.BlendMode = blendMode; + material.Transparency = transparency; + + return material; + } + + } +} \ No newline at end of file diff --git a/Runtime/VFX/FlashVFX/FlashTypes/FlatFlashType/FlatFlashType.cs.uid b/Runtime/VFX/FlashVFX/FlashTypes/FlatFlashType/FlatFlashType.cs.uid new file mode 100644 index 0000000..d66468f --- /dev/null +++ b/Runtime/VFX/FlashVFX/FlashTypes/FlatFlashType/FlatFlashType.cs.uid @@ -0,0 +1 @@ +uid://dp3vhm6l8mc62 diff --git a/Runtime/VFX/FlashVFX/FlashTypes/FresnelFlashType/FresnelFlashType.cs b/Runtime/VFX/FlashVFX/FlashTypes/FresnelFlashType/FresnelFlashType.cs new file mode 100644 index 0000000..1b623e6 --- /dev/null +++ b/Runtime/VFX/FlashVFX/FlashTypes/FresnelFlashType/FresnelFlashType.cs @@ -0,0 +1,54 @@ +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + [Tool] + [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Flash.svg") ] + public partial class FresnelFlashType:FlashType + { + [Export] + public BaseMaterial3D.BlendModeEnum blendMode = BaseMaterial3D.BlendModeEnum.Add; + + [Export] + public float fresnelSharpness= 1f; + + [Export] + public float fresnelMultiply = 1; + + [Export] + public float fresnelOffset = 0; + + [Export] + public float grow = 0; + + [Export] + public bool clampAlpha = true; + + public override void ApplyFlashType( + FlashVFXRunner runner, float phase, Color color, float opacity, + GeometryInstance3D gi, Material material ) + { + + var materialColor = color; + materialColor.A *= opacity; + + FresnelOverlayShader.albedo.Set( material, materialColor ); + } + + public override Material CreateMaterial( FlashVFXRunner runner, GeometryInstance3D gi ) + { + var sm = new ShaderMaterial(); + sm.Shader = FresnelOverlayShader.GetShaderWithBlendMode( blendMode ); + + FresnelOverlayShader.fresnelSharpness.Set( sm, fresnelSharpness ); + FresnelOverlayShader.fresnelMultiply.Set( sm, fresnelMultiply ); + FresnelOverlayShader.fresnelOffset.Set( sm, fresnelOffset ); + FresnelOverlayShader.grow.Set( sm, grow ); + FresnelOverlayShader.clampAlpha.Set( sm, clampAlpha ); + + return sm; + } + + } +} \ No newline at end of file diff --git a/Runtime/VFX/FlashVFX/FlashTypes/FresnelFlashType/FresnelFlashType.cs.uid b/Runtime/VFX/FlashVFX/FlashTypes/FresnelFlashType/FresnelFlashType.cs.uid new file mode 100644 index 0000000..9a84a9f --- /dev/null +++ b/Runtime/VFX/FlashVFX/FlashTypes/FresnelFlashType/FresnelFlashType.cs.uid @@ -0,0 +1 @@ +uid://ovls0u6yc8li diff --git a/Runtime/VFX/FlashVFX/FlashVFX.cs b/Runtime/VFX/FlashVFX/FlashVFX.cs new file mode 100644 index 0000000..c10ef59 --- /dev/null +++ b/Runtime/VFX/FlashVFX/FlashVFX.cs @@ -0,0 +1,336 @@ +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + [Tool] + [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Flash.svg") ] + public partial class FlashVFX:SequenceAction, Animator + { + [Export] + public FlashPreset preset; + + [Export] + public Node[] targets; + + [Export] + public bool includeChildren = false; + + public enum MaterialAssignementMode + { + Replace_Per_Target, + Add_For_Each_Material + } + + [ExportGroup("Material Assignment")] + [Export] + public MaterialAssignementMode assignementMode = MaterialAssignementMode.Add_For_Each_Material; + + [Export] + public Node3D positionOffset; + + public void OnAnimatorStart(){} + public void OnAnimatorEnd(){} + public void OnAnimatorCancel(){} + + Dictionary _running = new Dictionary(); + + protected override void _OnTrigger() + { + + if ( assignementMode == MaterialAssignementMode.Replace_Per_Target ) + { + _OnTrigger_ReplacePerTarget(); + } + + if ( assignementMode == MaterialAssignementMode.Add_For_Each_Material ) + { + _OnTrigger_AddForEachMaterial(); + } + } + + + protected void _OnTrigger_ReplacePerTarget() + { + var id = DispatchStart(); + + var duration = preset.duration == null ? new SecondsDuration() : preset.duration; + var tl = TimeLineManager.Ensure( duration.timeLine ); + + var OVERLAY = GeometryInstance3D.PropertyName.MaterialOverlay; + + var runner = new FlashVFXRunner(); + runner.flashVFX = this; + runner.targets = VFXTools.GetGeometryInstance3Ds( targets, includeChildren ); + + var gradient = preset.colorGradient.GetGradient(); + var gradientRepeat = preset.colorGradient.GetRepeat(); + var gradientRepeatMode = preset.colorGradient.GetRepeatMode(); + + var opacityCurve = preset.opacityCurve; + + + if ( runner.targets.Count == 0 ) + { + DispatchEnd( id ); + return; + } + + runner.materials = runner.targets.Map( gi => + { + return preset.flashType.CreateAndInitializeMaterial( runner, gi, gradient.Sample( 0 ) ); + } + ); + + _running[ id ] = runner; + + runner.AddLight(); + + for ( int i = 0; i < runner.targets.Count; i++ ) + { + var t = runner.targets[ i ]; + + AnimationManager.StartAnimation( this, t, OVERLAY ); + + t.MaterialOverlay = runner.materials[ i ]; + runner.assignedMaterials[ t ] = runner.materials[ i ]; + + } + + + TimeLineManager.ScheduleSpanIn( tl, 0, duration.GetDurationInSeconds(), + ( span, type )=> + { + var timeNow = tl.position; + var phase = span.phase; + var color = gradient.SampleRepeated( phase * gradientRepeat, gradientRepeatMode ); + var opacity = opacityCurve.Sample( phase ); + + runner.UpdateLight( phase, color, opacity ); + + for ( int i = 0; i < runner.targets.Count; i++ ) + { + var gi = runner.targets[ i ]; + + if ( ! AnimationManager.IsAnimating( this, gi, OVERLAY ) ) + { + continue; + } + + var material = runner.materials[ i ]; + preset.flashType.ApplyFlashType( runner, span.phase, color, opacity, gi, material ); + } + + + if ( type == TimeLineSpanUpdateType.End ) + { + for ( int i = 0; i < runner.targets.Count; i++ ) + { + var gi = runner.targets[ i ]; + + if ( gi.MaterialOverlay == runner.assignedMaterials[ gi ] ) + { + gi.MaterialOverlay = null; + } + + AnimationManager.EndAnimation( this, gi, OVERLAY, runner.materials[ i ] ); + } + + runner.RemoveLight(); + DispatchEnd( id ); + } + }, + this + ); + } + + protected void _OnTrigger_AddForEachMaterial() + { + var id = DispatchStart(); + + var duration = preset.duration == null ? new SecondsDuration() : preset.duration; + var tl = TimeLineManager.Ensure( duration.timeLine ); + + var OVERLAY = GeometryInstance3D.PropertyName.MaterialOverlay; + + var runner = new FlashVFXRunner(); + runner.flashVFX = this; + runner.targets = VFXTools.GetGeometryInstance3Ds( targets, includeChildren ); + + if ( runner.targets.Count == 0 ) + { + DispatchEnd( id ); + return; + } + + runner.AddLight(); + + var gradient = preset.colorGradient.GetGradient(); + var gradientRepeat = preset.colorGradient.GetRepeat(); + var gradientRepeatMode = preset.colorGradient.GetRepeatMode(); + var opacityCurve = preset.opacityCurve; + + Material nullMaterial = null; + + for ( int i = 0; i < runner.targets.Count; i++ ) + { + var t = runner.targets[ i ]; + + if ( t.MaterialOverlay == null ) + { + if ( nullMaterial == null ) + { + nullMaterial = preset.flashType.CreateAndInitializeMaterial( runner, null, gradient.Sample( 0 ) ); + runner.materials.Add( nullMaterial ); + runner.assignedMaterials[ t ] = nullMaterial; + } + + } + else + { + var original = t.MaterialOverlay; + Material extended = null; + + if ( ! runner.mappedMaterials.ContainsKey( original ) ) + { + var mapped = preset.flashType.CreateAndInitializeMaterial( runner, null, gradient.Sample( 0 ) ); + extended = t.MaterialOverlay.Duplicate() as Material; + + Materials.AddToNextPass( extended, mapped ); + runner.materials.Add( extended ); + runner.mappedMaterials[ original ] = extended; + } + else + { + extended = runner.mappedMaterials[ original ]; + } + + runner.originalMaterials[ t ] = original; + runner.assignedMaterials[ t ] = extended; + t.MaterialOverlay = extended; + } + } + + + _running[ id ] = runner; + + + TimeLineManager.ScheduleSpanIn( tl, 0, duration.GetDurationInSeconds(), + ( span, type )=> + { + var timeNow = tl.position; + var phase = span.phase; + var color = gradient.SampleRepeated( phase * gradientRepeat, gradientRepeatMode ); + var opacity = opacityCurve.Sample( phase ); + + runner.UpdateLight( phase, color, opacity ); + + for ( int i = 0; i < runner.materials.Count; i++ ) + { + var material = runner.materials[ i ]; + preset.flashType.ApplyFlashType( runner, span.phase, color, opacity, null, material ); + } + + if ( type == TimeLineSpanUpdateType.End ) + { + for ( int i = 0; i < runner.targets.Count; i++ ) + { + var gi = runner.targets[ i ]; + var material = runner.assignedMaterials[ gi ]; + + if ( gi.MaterialOverlay == material ) + { + gi.MaterialOverlay = runner.originalMaterials.ContainsKey( gi ) ? runner.originalMaterials[ gi ] : null; + } + + } + + DispatchEnd( id ); + + runner.RemoveLight(); + + } + }, + this + ); + } + } + + public class FlashVFXRunner + { + public FlashVFX flashVFX; + public FlashPreset preset => flashVFX.preset; + + public List targets = []; + public List materials = []; + + public OmniLight3D light; + + public Dictionary originalMaterials = new Dictionary(); + public Dictionary assignedMaterials = new Dictionary(); + public Dictionary mappedMaterials = new Dictionary(); + + + public Vector3 GetFlashPosition( FlashPreset.PositionMode mode, Vector3 offset ) + { + if ( FlashPreset.PositionMode.Position_Offset == mode ) + { + return flashVFX.positionOffset.GlobalPosition + offset; + } + else if ( FlashPreset.PositionMode.Origin_Of_First == mode ) + { + return targets[ 0 ].GlobalPosition + offset; + } + else if ( FlashPreset.PositionMode.Center_Of_All == mode ) + { + return Node3DExtensions.GetCenter( targets ) + offset; + } + else + { + return offset; + } + } + + public void AddLight() + { + if ( ! preset.lightEnabled ) + { + return; + } + + light = flashVFX.CreateChild(); + + light.LightColor = new Color( 0, 0, 0 ); + + light.GlobalPosition = GetFlashPosition( preset.lightPosition, preset.lightPositionOffset ); + + light.OmniRange = preset.lightRange; + light.OmniAttenuation = preset.lightAttenutation; + light.LightEnergy = preset.lightEnergy; + light.ShadowEnabled = preset.lightShadowCasting; + + + } + + public void UpdateLight( float phase, Color color, float opacity ) + { + if ( light == null ) + { + return; + } + + + light.LightColor = color * opacity; + } + + public void RemoveLight() + { + if ( light == null ) + { + return; + } + + light.DeleteSelf(); + } + } +} \ No newline at end of file diff --git a/Runtime/VFX/FlashVFX/FlashVFX.cs.uid b/Runtime/VFX/FlashVFX/FlashVFX.cs.uid new file mode 100644 index 0000000..f4fc2b8 --- /dev/null +++ b/Runtime/VFX/FlashVFX/FlashVFX.cs.uid @@ -0,0 +1 @@ +uid://degpoh0ab3gpl diff --git a/Runtime/VFX/FlashVFX/FlashVFXPresets/Blinking/Rainbow Blinking Flash.tres b/Runtime/VFX/FlashVFX/FlashVFXPresets/Blinking/Rainbow Blinking Flash.tres new file mode 100644 index 0000000..5f04168 --- /dev/null +++ b/Runtime/VFX/FlashVFX/FlashVFXPresets/Blinking/Rainbow Blinking Flash.tres @@ -0,0 +1,41 @@ +[gd_resource type="Resource" script_class="FlashPreset" load_steps=10 format=3 uid="uid://bsvm0ca6kdwiw"] + +[ext_resource type="Script" uid="uid://mer2h3i8xjot" path="res://addons/rokojori_action_library/Runtime/VFX/GradientGenerator/RainbowGradient.cs" id="1_eid4b"] +[ext_resource type="Script" uid="uid://ddhwhwos5kkrm" path="res://addons/rokojori_action_library/Runtime/Time/Duration/SecondsDuration.cs" id="2_mw8wy"] +[ext_resource type="Script" uid="uid://ovls0u6yc8li" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashTypes/FresnelFlashType/FresnelFlashType.cs" id="3_elmbg"] +[ext_resource type="Script" uid="uid://c78b88pjvobsi" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashPreset.cs" id="4_r4a2w"] + +[sub_resource type="Gradient" id="Gradient_tsojp"] +offsets = PackedFloat32Array(0, 0.09090909, 0.18181819, 0.27272728, 0.36363637, 0.45454547, 0.54545456, 0.6363636, 0.72727275, 0.8181818, 0.90909094, 1) +colors = PackedColorArray(3.2944157, 0.58140206, 0.58140206, 16, 3.2944157, 2.0612278, 0.58140206, 16, 3.0477781, 3.2944157, 0.58140206, 16, 1.5679523, 3.2944157, 0.58140206, 16, 0.58140206, 3.2944157, 1.0746772, 16, 0.58140206, 3.2944157, 2.5545027, 16, 0.58140206, 2.5545022, 3.2944157, 16, 0.58140206, 1.0746772, 3.2944157, 16, 1.5679523, 0.58140206, 3.2944157, 16, 3.0477774, 0.58140206, 3.2944157, 16, 3.2944157, 0.58140206, 2.0612273, 16, 3.2944157, 0.58140206, 0.58140206, 16) + +[sub_resource type="Resource" id="Resource_e6c6u"] +script = ExtResource("1_eid4b") +lightness = 63.9394 +intensity = 2.0 +resolution = 12 +outputGradient = SubResource("Gradient_tsojp") +repeat = 3.0 +repeatMode = 1 +metadata/_custom_type_script = "uid://mer2h3i8xjot" + +[sub_resource type="Resource" id="Resource_k277t"] +script = ExtResource("2_mw8wy") +metadata/_custom_type_script = "uid://ddhwhwos5kkrm" + +[sub_resource type="Resource" id="Resource_it5p0"] +script = ExtResource("3_elmbg") +fresnelSharpness = 2.0 +metadata/_custom_type_script = "uid://ovls0u6yc8li" + +[sub_resource type="Curve" id="Curve_61uky"] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.05454545, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] +point_count = 3 + +[resource] +script = ExtResource("4_r4a2w") +colorGradient = SubResource("Resource_e6c6u") +opacityCurve = SubResource("Curve_61uky") +duration = SubResource("Resource_k277t") +flashType = SubResource("Resource_it5p0") +metadata/_custom_type_script = "uid://c78b88pjvobsi" diff --git a/Runtime/VFX/FlashVFX/FlashVFXPresets/Blinking/Red Blinking Flash.tres b/Runtime/VFX/FlashVFX/FlashVFXPresets/Blinking/Red Blinking Flash.tres new file mode 100644 index 0000000..80455a3 --- /dev/null +++ b/Runtime/VFX/FlashVFX/FlashVFXPresets/Blinking/Red Blinking Flash.tres @@ -0,0 +1,37 @@ +[gd_resource type="Resource" script_class="FlashPreset" load_steps=10 format=3 uid="uid://im8nc0763r7r"] + +[ext_resource type="Script" uid="uid://ckr83rn42kvf2" path="res://addons/rokojori_action_library/Runtime/VFX/GradientGenerator/CustomGradient.cs" id="1_oea31"] +[ext_resource type="Script" uid="uid://ddhwhwos5kkrm" path="res://addons/rokojori_action_library/Runtime/Time/Duration/SecondsDuration.cs" id="2_x2dmj"] +[ext_resource type="Script" uid="uid://dp3vhm6l8mc62" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashTypes/FlatFlashType/FlatFlashType.cs" id="3_u6gyh"] +[ext_resource type="Script" uid="uid://c78b88pjvobsi" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashPreset.cs" id="4_r80hv"] + +[sub_resource type="Gradient" id="Gradient_ymeji"] +offsets = PackedFloat32Array(0) +colors = PackedColorArray(1, 0, 0, 1) + +[sub_resource type="Resource" id="Resource_3gtgp"] +script = ExtResource("1_oea31") +gradient = SubResource("Gradient_ymeji") +metadata/_custom_type_script = "uid://ckr83rn42kvf2" + +[sub_resource type="Resource" id="Resource_j11dc"] +script = ExtResource("2_x2dmj") +seconds = 0.3 +metadata/_custom_type_script = "uid://ddhwhwos5kkrm" + +[sub_resource type="Resource" id="Resource_puepo"] +script = ExtResource("3_u6gyh") +metadata/_custom_type_script = "uid://dp3vhm6l8mc62" + +[sub_resource type="Curve" id="Curve_854jy"] +_limits = [0.0, 2.0, 0.0, 1.0] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.026515156, 1.8006134), 0.0, 0.0, 0, 0, Vector2(0.47727275, 0), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] +point_count = 4 + +[resource] +script = ExtResource("4_r80hv") +colorGradient = SubResource("Resource_3gtgp") +opacityCurve = SubResource("Curve_854jy") +duration = SubResource("Resource_j11dc") +flashType = SubResource("Resource_puepo") +metadata/_custom_type_script = "uid://c78b88pjvobsi" diff --git a/Runtime/VFX/FlashVFX/FlashVFXPresets/Blinking/White Blinking Flash.tres b/Runtime/VFX/FlashVFX/FlashVFXPresets/Blinking/White Blinking Flash.tres new file mode 100644 index 0000000..b23b74a --- /dev/null +++ b/Runtime/VFX/FlashVFX/FlashVFXPresets/Blinking/White Blinking Flash.tres @@ -0,0 +1,37 @@ +[gd_resource type="Resource" script_class="FlashPreset" load_steps=10 format=3 uid="uid://dt7ue6b8iknrf"] + +[ext_resource type="Script" uid="uid://ckr83rn42kvf2" path="res://addons/rokojori_action_library/Runtime/VFX/GradientGenerator/CustomGradient.cs" id="1_f0lav"] +[ext_resource type="Script" uid="uid://ddhwhwos5kkrm" path="res://addons/rokojori_action_library/Runtime/Time/Duration/SecondsDuration.cs" id="2_ja8q1"] +[ext_resource type="Script" uid="uid://dp3vhm6l8mc62" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashTypes/FlatFlashType/FlatFlashType.cs" id="3_uq5g2"] +[ext_resource type="Script" uid="uid://c78b88pjvobsi" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashPreset.cs" id="4_abpyj"] + +[sub_resource type="Gradient" id="Gradient_xf1he"] +offsets = PackedFloat32Array(0) +colors = PackedColorArray(3.325515, 3.325515, 3.325515, 1) + +[sub_resource type="Resource" id="Resource_gbubg"] +script = ExtResource("1_f0lav") +gradient = SubResource("Gradient_xf1he") +metadata/_custom_type_script = "uid://ckr83rn42kvf2" + +[sub_resource type="Resource" id="Resource_1s8ae"] +script = ExtResource("2_ja8q1") +seconds = 0.3 +metadata/_custom_type_script = "uid://ddhwhwos5kkrm" + +[sub_resource type="Resource" id="Resource_2dgt6"] +script = ExtResource("3_uq5g2") +metadata/_custom_type_script = "uid://dp3vhm6l8mc62" + +[sub_resource type="Curve" id="Curve_vekw0"] +_limits = [0.0, 2.0, 0.0, 1.0] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.030303031, 2), 0.0, 0.0, 0, 0, Vector2(0.18939394, 0), 0.0, 0.0, 0, 0, Vector2(0.4621212, 0), 0.0, 0.0, 0, 0, Vector2(0.5, 1.5015337), 0.0, 0.0, 0, 0, Vector2(0.655303, 0), 0.10755398, 0.10755398, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] +point_count = 7 + +[resource] +script = ExtResource("4_abpyj") +colorGradient = SubResource("Resource_gbubg") +opacityCurve = SubResource("Curve_vekw0") +duration = SubResource("Resource_1s8ae") +flashType = SubResource("Resource_2dgt6") +metadata/_custom_type_script = "uid://c78b88pjvobsi" diff --git a/Runtime/VFX/FlashVFX/FlashVFXPresets/Fresnel/Blue Fresnel Flash.tres b/Runtime/VFX/FlashVFX/FlashVFXPresets/Fresnel/Blue Fresnel Flash.tres new file mode 100644 index 0000000..2094953 --- /dev/null +++ b/Runtime/VFX/FlashVFX/FlashVFXPresets/Fresnel/Blue Fresnel Flash.tres @@ -0,0 +1,47 @@ +[gd_resource type="Resource" script_class="FlashPreset" load_steps=10 format=3 uid="uid://dmlpjt3b1xp15"] + +[ext_resource type="Script" uid="uid://cjyssfkixctwe" path="res://addons/rokojori_action_library/Runtime/VFX/GradientGenerator/TemperatureGradient.cs" id="1_7saw8"] +[ext_resource type="Script" uid="uid://ddhwhwos5kkrm" path="res://addons/rokojori_action_library/Runtime/Time/Duration/SecondsDuration.cs" id="2_msqee"] +[ext_resource type="Script" uid="uid://ovls0u6yc8li" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashTypes/FresnelFlashType/FresnelFlashType.cs" id="3_us2h7"] +[ext_resource type="Script" uid="uid://c78b88pjvobsi" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashPreset.cs" id="4_s4ag5"] + +[sub_resource type="Gradient" id="Gradient_d8o7a"] +offsets = PackedFloat32Array(0, 0.5, 1) +colors = PackedColorArray(0.24000007, 0.96, 0.57723343, 1, 0, 0.78162026, 1, 1, 0, 0.025296224, 0.8, 1) + +[sub_resource type="Resource" id="Resource_205gq"] +script = ExtResource("1_7saw8") +baseColor = Color(0, 0.78162026, 1, 1) +centerAttraction = 0.0 +temperaturePolarBlendRadius = 30.0 +startTemperatureShift = 45.0 +startSaturationShift = -10.0 +startLightnessShift = 10.0 +endTemperatureShift = -45.0 +endSaturationShift = 10.0 +endLightnessShift = -10.0 +outputGradient = SubResource("Gradient_d8o7a") +metadata/_custom_type_script = "uid://cjyssfkixctwe" + +[sub_resource type="Resource" id="Resource_7pyme"] +script = ExtResource("2_msqee") +seconds = 0.3 +metadata/_custom_type_script = "uid://ddhwhwos5kkrm" + +[sub_resource type="Resource" id="Resource_l2t0j"] +script = ExtResource("3_us2h7") +metadata/_custom_type_script = "uid://ovls0u6yc8li" + +[sub_resource type="Curve" id="Curve_n2yo8"] +_limits = [0.0, 2.0, 0.0, 1.0] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.026515156, 1.8006134), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] +point_count = 3 + +[resource] +script = ExtResource("4_s4ag5") +colorGradient = SubResource("Resource_205gq") +opacityCurve = SubResource("Curve_n2yo8") +duration = SubResource("Resource_7pyme") +flashType = SubResource("Resource_l2t0j") +lightEnabled = true +metadata/_custom_type_script = "uid://c78b88pjvobsi" diff --git a/Runtime/VFX/FlashVFX/FlashVFXPresets/Fresnel/Orange Fresnel Flash.tres b/Runtime/VFX/FlashVFX/FlashVFXPresets/Fresnel/Orange Fresnel Flash.tres new file mode 100644 index 0000000..c854f5e --- /dev/null +++ b/Runtime/VFX/FlashVFX/FlashVFXPresets/Fresnel/Orange Fresnel Flash.tres @@ -0,0 +1,47 @@ +[gd_resource type="Resource" script_class="FlashPreset" load_steps=10 format=3 uid="uid://irftyqm8w762"] + +[ext_resource type="Script" uid="uid://cjyssfkixctwe" path="res://addons/rokojori_action_library/Runtime/VFX/GradientGenerator/TemperatureGradient.cs" id="1_b51fw"] +[ext_resource type="Script" uid="uid://ddhwhwos5kkrm" path="res://addons/rokojori_action_library/Runtime/Time/Duration/SecondsDuration.cs" id="2_uu5id"] +[ext_resource type="Script" uid="uid://ovls0u6yc8li" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashTypes/FresnelFlashType/FresnelFlashType.cs" id="3_w2g18"] +[ext_resource type="Script" uid="uid://c78b88pjvobsi" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashPreset.cs" id="4_cee5e"] + +[sub_resource type="Gradient" id="Gradient_uu5id"] +offsets = PackedFloat32Array(0, 0.5, 1) +colors = PackedColorArray(0.96, 0.9211765, 0.24000007, 1, 1, 0.19607843, 0, 1, 0.8, 0, 0.4431372, 1) + +[sub_resource type="Resource" id="Resource_w2g18"] +script = ExtResource("1_b51fw") +baseColor = Color(1, 0.19607843, 0, 1) +centerAttraction = 0.0 +temperaturePolarBlendRadius = 30.0 +startTemperatureShift = 45.0 +startSaturationShift = -10.0 +startLightnessShift = 10.0 +endTemperatureShift = -45.0 +endSaturationShift = 10.0 +endLightnessShift = -10.0 +outputGradient = SubResource("Gradient_uu5id") +metadata/_custom_type_script = "uid://cjyssfkixctwe" + +[sub_resource type="Resource" id="Resource_58b12"] +script = ExtResource("2_uu5id") +seconds = 0.3 +metadata/_custom_type_script = "uid://ddhwhwos5kkrm" + +[sub_resource type="Resource" id="Resource_l1caf"] +script = ExtResource("3_w2g18") +metadata/_custom_type_script = "uid://ovls0u6yc8li" + +[sub_resource type="Curve" id="Curve_mem7v"] +_limits = [0.0, 2.0, 0.0, 1.0] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.026515156, 1.8006134), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] +point_count = 3 + +[resource] +script = ExtResource("4_cee5e") +colorGradient = SubResource("Resource_w2g18") +opacityCurve = SubResource("Curve_mem7v") +duration = SubResource("Resource_58b12") +flashType = SubResource("Resource_l1caf") +lightEnabled = true +metadata/_custom_type_script = "uid://c78b88pjvobsi" diff --git a/Runtime/VFX/FlashVFX/FlashVFXPresets/Scanner/Green Health Charge Flash.tres b/Runtime/VFX/FlashVFX/FlashVFXPresets/Scanner/Green Health Charge Flash.tres new file mode 100644 index 0000000..f777b04 --- /dev/null +++ b/Runtime/VFX/FlashVFX/FlashVFXPresets/Scanner/Green Health Charge Flash.tres @@ -0,0 +1,77 @@ +[gd_resource type="Resource" script_class="FlashPreset" load_steps=19 format=3 uid="uid://uwqptosumnks"] + +[ext_resource type="Script" uid="uid://cjyssfkixctwe" path="res://addons/rokojori_action_library/Runtime/VFX/GradientGenerator/TemperatureGradient.cs" id="1_0dcww"] +[ext_resource type="Script" uid="uid://ddhwhwos5kkrm" path="res://addons/rokojori_action_library/Runtime/Time/Duration/SecondsDuration.cs" id="2_m3qwr"] +[ext_resource type="Script" uid="uid://y2p0r8c5rs45" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/ColorPropertyName.cs" id="3_j8fax"] +[ext_resource type="Material" uid="uid://eklfe1i0kt1e" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashVFXPresets/Scanner/Scanner.material" id="4_nhwmm"] +[ext_resource type="Script" uid="uid://jqgdm3r2u8xq" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/FloatPropertyName.cs" id="5_1uu41"] +[ext_resource type="Script" uid="uid://rukdqg1uo30" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/Vector3PropertyName.cs" id="5_j8fax"] +[ext_resource type="Script" uid="uid://chl43fdu0vn81" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashType.cs" id="6_lpua8"] +[ext_resource type="Script" uid="uid://bn31ol127rm2i" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashPosition.cs" id="6_nhwmm"] +[ext_resource type="Script" uid="uid://c78b88pjvobsi" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashPreset.cs" id="7_d6aiv"] + +[sub_resource type="Gradient" id="Gradient_vc6ua"] +offsets = PackedFloat32Array(0.08335, 0.5, 0.91665) +colors = PackedColorArray(1, 1, 0.82500005, 1, 0.28650653, 1.825, 0, 1, 0, 0.9363221, 0.8340571, 1) + +[sub_resource type="Resource" id="Resource_k2ykb"] +script = ExtResource("1_0dcww") +baseColor = Color(0.28650653, 1.825, 0, 1) +centerAttraction = 0.1667 +temperaturePolarBlendRadius = 30.0 +startTemperatureShift = 90.0 +endTemperatureShift = -62.8662 +endSaturationShift = 20.6349 +endLightnessShift = -44.4339 +outputGradient = SubResource("Gradient_vc6ua") +metadata/_custom_type_script = "uid://cjyssfkixctwe" + +[sub_resource type="Resource" id="Resource_hs1rr"] +script = ExtResource("2_m3qwr") +seconds = 0.5 +metadata/_custom_type_script = "uid://ddhwhwos5kkrm" + +[sub_resource type="Resource" id="Resource_q7vi4"] +script = ExtResource("3_j8fax") +propertyName = "albedo" +metadata/_custom_type_script = "uid://y2p0r8c5rs45" + +[sub_resource type="Resource" id="Resource_1uu41"] +script = ExtResource("5_j8fax") +propertyName = "position" +metadata/_custom_type_script = "uid://rukdqg1uo30" + +[sub_resource type="Resource" id="Resource_lpua8"] +script = ExtResource("6_nhwmm") +positionMode = 1 +offset = Vector3(0, -0.5, 0) +propertyName = SubResource("Resource_1uu41") +metadata/_custom_type_script = "uid://bn31ol127rm2i" + +[sub_resource type="Resource" id="Resource_1djbv"] +script = ExtResource("5_1uu41") +propertyName = "driver" +metadata/_custom_type_script = "uid://jqgdm3r2u8xq" + +[sub_resource type="Resource" id="Resource_ug21n"] +script = ExtResource("6_lpua8") +flashMaterial = ExtResource("4_nhwmm") +colorPropertyName = SubResource("Resource_q7vi4") +phasePropertyName = SubResource("Resource_1djbv") +flashPosition = SubResource("Resource_lpua8") +metadata/_custom_type_script = "uid://chl43fdu0vn81" + +[sub_resource type="Curve" id="Curve_ud7rl"] +_limits = [0.0, 2.0, 0.0, 1.0] +_data = [Vector2(0, 0), 0.0, 37.714283, 0, 1, Vector2(0.053030305, 2), 0.0, 0.0, 0, 0, Vector2(1, 0), -0.05551173, 0.0, 0, 0] +point_count = 3 + +[resource] +script = ExtResource("7_d6aiv") +colorGradient = SubResource("Resource_k2ykb") +opacityCurve = SubResource("Curve_ud7rl") +duration = SubResource("Resource_hs1rr") +flashType = SubResource("Resource_ug21n") +lightEnabled = true +lightEnergy = 1.0 +metadata/_custom_type_script = "uid://c78b88pjvobsi" diff --git a/Runtime/VFX/FlashVFX/FlashVFXPresets/Scanner/Pink Mana Charge Flash.tres b/Runtime/VFX/FlashVFX/FlashVFXPresets/Scanner/Pink Mana Charge Flash.tres new file mode 100644 index 0000000..bc53891 --- /dev/null +++ b/Runtime/VFX/FlashVFX/FlashVFXPresets/Scanner/Pink Mana Charge Flash.tres @@ -0,0 +1,103 @@ +[gd_resource type="Resource" script_class="FlashPreset" load_steps=22 format=3 uid="uid://cwdpmuqt0svwm"] + +[ext_resource type="Script" uid="uid://cjyssfkixctwe" path="res://addons/rokojori_action_library/Runtime/VFX/GradientGenerator/TemperatureGradient.cs" id="1_gli2s"] +[ext_resource type="Script" uid="uid://ddhwhwos5kkrm" path="res://addons/rokojori_action_library/Runtime/Time/Duration/SecondsDuration.cs" id="2_kuv45"] +[ext_resource type="Script" uid="uid://y2p0r8c5rs45" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/ColorPropertyName.cs" id="3_ad8tv"] +[ext_resource type="Shader" uid="uid://bdjl44rcb2la0" path="res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/Scanner/Scanner.gdshader" id="4_gli2s"] +[ext_resource type="Script" uid="uid://rukdqg1uo30" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/Vector3PropertyName.cs" id="5_ad8tv"] +[ext_resource type="Script" uid="uid://jqgdm3r2u8xq" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/FloatPropertyName.cs" id="5_dr54e"] +[ext_resource type="Script" uid="uid://bn31ol127rm2i" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashPosition.cs" id="6_0xqn3"] +[ext_resource type="Script" uid="uid://chl43fdu0vn81" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashType.cs" id="6_7nrn2"] +[ext_resource type="Script" uid="uid://c78b88pjvobsi" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashPreset.cs" id="7_7sesa"] + +[sub_resource type="Gradient" id="Gradient_kuv45"] +offsets = PackedFloat32Array(0.051560313, 0.1667, 0.74226034) +colors = PackedColorArray(1, 0.9495292, 0.82500005, 1, 1.825, 0, 1.4388391, 1, 0.15339342, 0, 0.9363221, 1) + +[sub_resource type="Resource" id="Resource_lggrh"] +script = ExtResource("1_gli2s") +baseColor = Color(1.825, 0, 1.4388391, 1) +centerPosition = 0.1667 +centerAttraction = 0.3093 +temperaturePolarBlendRadius = 30.0 +startTemperatureShift = 90.0 +endTemperatureShift = -62.8662 +endSaturationShift = 20.6349 +endLightnessShift = -44.4339 +outputGradient = SubResource("Gradient_kuv45") +metadata/_custom_type_script = "uid://cjyssfkixctwe" + +[sub_resource type="Resource" id="Resource_5soom"] +script = ExtResource("2_kuv45") +seconds = 0.5 +metadata/_custom_type_script = "uid://ddhwhwos5kkrm" + +[sub_resource type="Resource" id="Resource_q7vi4"] +script = ExtResource("3_ad8tv") +propertyName = "albedo" +metadata/_custom_type_script = "uid://y2p0r8c5rs45" + +[sub_resource type="Gradient" id="Gradient_ad8tv"] +offsets = PackedFloat32Array(0.011450382, 0.55725193, 1) +colors = PackedColorArray(1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0) + +[sub_resource type="GradientTexture1D" id="GradientTexture1D_0xqn3"] +gradient = SubResource("Gradient_ad8tv") + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_dr54e"] +render_priority = 0 +shader = ExtResource("4_gli2s") +shader_parameter/albedo = Color(4.2130003, 4.2130003, 4.2130003, 1) +shader_parameter/driver = 0.0 +shader_parameter/position = Vector3(0, 0, 0) +shader_parameter/direction = Vector3(0, 1, 0) +shader_parameter/scannerSize = 0.8965 +shader_parameter/scanTexture = SubResource("GradientTexture1D_0xqn3") +shader_parameter/noiseAmount = 0.114000005415 +shader_parameter/noiseScale = 8.87900041849262 +shader_parameter/noiseScroll = Vector3(0, 0, 0) +shader_parameter/noiseScrollFromScanDirection = 3.0 +shader_parameter/noiseAmount2 = 0.2390000113525 +shader_parameter/noiseScale2 = 4.03300018830762 +shader_parameter/noiseScroll2 = Vector3(0, 0, 0) +shader_parameter/noiseScrollFromScanDirection2 = 4.0 + +[sub_resource type="Resource" id="Resource_dr54e"] +script = ExtResource("5_ad8tv") +propertyName = "position" +metadata/_custom_type_script = "uid://rukdqg1uo30" + +[sub_resource type="Resource" id="Resource_7nrn2"] +script = ExtResource("6_0xqn3") +positionMode = 1 +offset = Vector3(0, -0.5, 0) +propertyName = SubResource("Resource_dr54e") +metadata/_custom_type_script = "uid://bn31ol127rm2i" + +[sub_resource type="Resource" id="Resource_1djbv"] +script = ExtResource("5_dr54e") +propertyName = "driver" +metadata/_custom_type_script = "uid://jqgdm3r2u8xq" + +[sub_resource type="Resource" id="Resource_5604o"] +script = ExtResource("6_7nrn2") +flashMaterial = SubResource("ShaderMaterial_dr54e") +colorPropertyName = SubResource("Resource_q7vi4") +phasePropertyName = SubResource("Resource_1djbv") +flashPosition = SubResource("Resource_7nrn2") +metadata/_custom_type_script = "uid://chl43fdu0vn81" + +[sub_resource type="Curve" id="Curve_s7w4q"] +_limits = [0.0, 2.0, 0.0, 1.0] +_data = [Vector2(0, 0), 0.0, 37.714283, 0, 1, Vector2(0.053030305, 2), 0.0, 0.0, 0, 0, Vector2(1, 0), -0.05551173, 0.0, 0, 0] +point_count = 3 + +[resource] +script = ExtResource("7_7sesa") +colorGradient = SubResource("Resource_lggrh") +opacityCurve = SubResource("Curve_s7w4q") +duration = SubResource("Resource_5soom") +flashType = SubResource("Resource_5604o") +lightEnabled = true +lightEnergy = 1.0 +metadata/_custom_type_script = "uid://c78b88pjvobsi" diff --git a/Runtime/VFX/FlashVFX/FlashVFXPresets/Scanner/Rainbow Star Boost Flash.tres b/Runtime/VFX/FlashVFX/FlashVFXPresets/Scanner/Rainbow Star Boost Flash.tres new file mode 100644 index 0000000..65bdeab --- /dev/null +++ b/Runtime/VFX/FlashVFX/FlashVFXPresets/Scanner/Rainbow Star Boost Flash.tres @@ -0,0 +1,96 @@ +[gd_resource type="Resource" script_class="FlashPreset" load_steps=22 format=3 uid="uid://bne3wk6xbt48p"] + +[ext_resource type="Script" uid="uid://mer2h3i8xjot" path="res://addons/rokojori_action_library/Runtime/VFX/GradientGenerator/RainbowGradient.cs" id="1_03l83"] +[ext_resource type="Script" uid="uid://ddhwhwos5kkrm" path="res://addons/rokojori_action_library/Runtime/Time/Duration/SecondsDuration.cs" id="2_y5iyo"] +[ext_resource type="Script" uid="uid://y2p0r8c5rs45" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/ColorPropertyName.cs" id="3_p1cg2"] +[ext_resource type="Shader" uid="uid://bdjl44rcb2la0" path="res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/Scanner/Scanner.gdshader" id="4_uu110"] +[ext_resource type="Script" uid="uid://jqgdm3r2u8xq" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/FloatPropertyName.cs" id="5_jquqm"] +[ext_resource type="Script" uid="uid://rukdqg1uo30" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/Vector3PropertyName.cs" id="5_p1cg2"] +[ext_resource type="Script" uid="uid://chl43fdu0vn81" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashType.cs" id="6_phuds"] +[ext_resource type="Script" uid="uid://bn31ol127rm2i" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashPosition.cs" id="6_uu110"] +[ext_resource type="Script" uid="uid://c78b88pjvobsi" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashPreset.cs" id="7_5xn3m"] + +[sub_resource type="Gradient" id="Gradient_8gpm3"] +offsets = PackedFloat32Array(0, 0.09090909, 0.18181819, 0.27272728, 0.36363637, 0.45454547, 0.54545456, 0.6363636, 0.72727275, 0.8181818, 0.90909094, 1) +colors = PackedColorArray(3.2944157, 0.58140206, 0.58140206, 16, 3.2944157, 2.0612278, 0.58140206, 16, 3.0477781, 3.2944157, 0.58140206, 16, 1.5679523, 3.2944157, 0.58140206, 16, 0.58140206, 3.2944157, 1.0746772, 16, 0.58140206, 3.2944157, 2.5545027, 16, 0.58140206, 2.5545022, 3.2944157, 16, 0.58140206, 1.0746772, 3.2944157, 16, 1.5679523, 0.58140206, 3.2944157, 16, 3.0477774, 0.58140206, 3.2944157, 16, 3.2944157, 0.58140206, 2.0612273, 16, 3.2944157, 0.58140206, 0.58140206, 16) + +[sub_resource type="Resource" id="Resource_1d707"] +script = ExtResource("1_03l83") +intensity = 2.0 +resolution = 12 +outputGradient = SubResource("Gradient_8gpm3") +repeat = 2.0 +repeatMode = 1 +metadata/_custom_type_script = "uid://mer2h3i8xjot" + +[sub_resource type="Resource" id="Resource_w5yc7"] +script = ExtResource("2_y5iyo") +metadata/_custom_type_script = "uid://ddhwhwos5kkrm" + +[sub_resource type="Resource" id="Resource_ff4i8"] +script = ExtResource("3_p1cg2") +propertyName = "albedo" +metadata/_custom_type_script = "uid://y2p0r8c5rs45" + +[sub_resource type="Gradient" id="Gradient_nekbm"] +offsets = PackedFloat32Array(0, 0.5152672, 0.84351146, 0.980916) +colors = PackedColorArray(1, 1, 1, 0, 1.195908, 1.195908, 1.195908, 0.81632656, 1.8247963, 1.8247963, 1.8247963, 1, 1, 1, 1, 0) + +[sub_resource type="GradientTexture1D" id="GradientTexture1D_n4dn7"] +gradient = SubResource("Gradient_nekbm") +use_hdr = true + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_1sieh"] +render_priority = 0 +shader = ExtResource("4_uu110") +shader_parameter/albedo = Color(4.2130003, 4.2130003, 4.2130003, 1) +shader_parameter/driver = 0.0 +shader_parameter/position = Vector3(0, 0, 0) +shader_parameter/direction = Vector3(0, 1, 0) +shader_parameter/scannerSize = 0.8965 +shader_parameter/scanTexture = SubResource("GradientTexture1D_n4dn7") +shader_parameter/noiseAmount = 0.7630000362425 +shader_parameter/noiseScale = 6.300000295990119 +shader_parameter/noiseScroll = Vector3(0, 0, 0) +shader_parameter/noiseScrollFromScanDirection = 3.0 +shader_parameter/noiseAmount2 = 0.25200001197 +shader_parameter/noiseScale2 = 39.37700186714763 +shader_parameter/noiseScroll2 = Vector3(0, 0, 0) +shader_parameter/noiseScrollFromScanDirection2 = 10.0 + +[sub_resource type="Resource" id="Resource_jquqm"] +script = ExtResource("5_p1cg2") +propertyName = "position" +metadata/_custom_type_script = "uid://rukdqg1uo30" + +[sub_resource type="Resource" id="Resource_phuds"] +script = ExtResource("6_uu110") +positionMode = 1 +offset = Vector3(0, -0.5, 0) +propertyName = SubResource("Resource_jquqm") +metadata/_custom_type_script = "uid://bn31ol127rm2i" + +[sub_resource type="Resource" id="Resource_jv2hp"] +script = ExtResource("5_jquqm") +propertyName = "driver" +metadata/_custom_type_script = "uid://jqgdm3r2u8xq" + +[sub_resource type="Resource" id="Resource_ihcvp"] +script = ExtResource("6_phuds") +flashMaterial = SubResource("ShaderMaterial_1sieh") +colorPropertyName = SubResource("Resource_ff4i8") +phasePropertyName = SubResource("Resource_jv2hp") +flashPosition = SubResource("Resource_phuds") +metadata/_custom_type_script = "uid://chl43fdu0vn81" + +[sub_resource type="Curve" id="Curve_set2r"] +_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.05454545, 1), 0.0, 0.0, 0, 0, Vector2(0.36969694, 0.33470583), -1.5141176, -1.5141176, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] +point_count = 4 + +[resource] +script = ExtResource("7_5xn3m") +colorGradient = SubResource("Resource_1d707") +opacityCurve = SubResource("Curve_set2r") +duration = SubResource("Resource_w5yc7") +flashType = SubResource("Resource_ihcvp") +metadata/_custom_type_script = "uid://c78b88pjvobsi" diff --git a/Runtime/VFX/FlashVFX/FlashVFXPresets/Scanner/Scanner.material b/Runtime/VFX/FlashVFX/FlashVFXPresets/Scanner/Scanner.material new file mode 100644 index 0000000000000000000000000000000000000000..ab551c541bad67756d4344eb12c54893408db138 GIT binary patch literal 800 zcmV+*1K<2oQ$s@n000005C8zA1^@sE0{{RhwJ-f(qy_aC0Jh?JNAS`l9Z<-!mg{lY zn6Y@qwP7O#l3xC1dprkATm%QTy#!=$_K198S8A1OzI6UiaNZBt6F5NTh(&^XYl`J#8mTQ$YjKd{{gPa*?eV&=1j6u{|)>v`A_nHj2}P*~_P`Tr<(^tY#df$=7^& zlP$SuB^PfI)Bgl+bZ6JuTx`y$$~$94wk_7p=7&ppX0liR2mEpYKsTI<8b5>`l5Jzl zt$}5wrt>=JaCkSVgepvkIVKpOudq{1$DQ|V{x6W>;o;+GX-UGf6-_gJ_F}A3U3j*6 zMd#yfUfSw;MlCyNYEj17Rj3ZtewNlOlkeGBp#LI2y`N63$<$I&e;yD1kD;9xY&Iq+o&L|IGgbzY0pq6@o^N z|119spqz*RK=7AX=(;1=wIC&-P{hQ*9~Kd?yAdK}$TfoV13MYm{cxqU0zDulK@34; zz!MN3D8dtZsF5X7%1kgMnv$f@24I3QL}lv|z$GP#I-`^k2`DHET96hB(`Iz|!R2ty z3m-7W+Qn_5n|*p^kDL7(d%+^xTv)D@tJ}|Tpe!~~5x6j{fwJ27^SB3D%AkN?fDtGl zxKe+Re=vW9l$4XaAk-b@4CvHh7Vz Callable.From( ()=> outputGradient = GetGradient() ); + [Export] + public Gradient outputGradient; + + public override Gradient GetGradient() + { + var colors = new List(); + + for ( int i = 0; i < resolution; i++ ) + { + var hue = i / (float)( resolution - 1 ) * 360f + hueStart; + hue = MathX.Repeat( hue, 360f ); + + var color = new HSLColor( hue, saturation / 100f, lightness / 100f ); + var rgb = color.ToRGBA(); + colors.Add( rgb.WithIntensity( intensity ) ); + } + + return GradientExtensions.Create( colors ); + + } + + [ExportGroup("Repeat")] + [Export] + public float repeat = 1f; + public override float GetRepeat() + { + return repeat; + } + + [Export] + public GradientExtensions.GradientRepeatMode repeatMode = GradientExtensions.GradientRepeatMode.Clamp; + public override GradientExtensions.GradientRepeatMode GetRepeatMode() + { + return repeatMode; + } + + } + +} \ No newline at end of file diff --git a/Runtime/VFX/GradientGenerator/RainbowGradient.cs.uid b/Runtime/VFX/GradientGenerator/RainbowGradient.cs.uid new file mode 100644 index 0000000..c8cf691 --- /dev/null +++ b/Runtime/VFX/GradientGenerator/RainbowGradient.cs.uid @@ -0,0 +1 @@ +uid://mer2h3i8xjot diff --git a/Runtime/VFX/GradientGenerator/TemperatureGradient.cs b/Runtime/VFX/GradientGenerator/TemperatureGradient.cs new file mode 100644 index 0000000..2e1b944 --- /dev/null +++ b/Runtime/VFX/GradientGenerator/TemperatureGradient.cs @@ -0,0 +1,76 @@ +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + [Tool] + [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Flash.svg") ] + public partial class TemperatureGradient:GradientGenerator + { + [Export] + public Color baseColor; + + [Export( PropertyHint.Range, "0,1" )] + public float centerPosition = 0.5f; + + [Export( PropertyHint.Range, "0,1" )] + public float centerAttraction = 0.25f; + + [Export] + public float temperaturePolarBlendRadius = 60f; + + [ExportGroup( "Start", "start")] + [Export( PropertyHint.Range, "-180,180")] + public float startTemperatureShift = 0; + [Export( PropertyHint.Range, "-100,100")] + public float startSaturationShift = 0; + [Export( PropertyHint.Range, "-100,100")] + public float startLightnessShift = 0; + + [ExportGroup( "End", "end")] + [Export( PropertyHint.Range, "-180,180")] + public float endTemperatureShift = 0; + [Export( PropertyHint.Range, "-100,100")] + public float endSaturationShift = 0; + [Export( PropertyHint.Range, "-100,100")] + public float endLightnessShift = 0; + + [ExportGroup("Output")] + [ExportToolButton( "Show Output")] + public Callable showOutputButton => Callable.From( ()=> outputGradient = GetGradient() ); + [Export] + public Gradient outputGradient; + + [ExportGroup("Repeat")] + + [Export] + public float repeat = 1f; + + [Export] + public GradientExtensions.GradientRepeatMode repeatMode = GradientExtensions.GradientRepeatMode.Clamp; + + + + + public override Gradient GetGradient() + { + var gradient = new Gradient(); + + gradient.Colors = + [ + baseColor.ToHSL().ShiftTemperature( startTemperatureShift, startSaturationShift / 100f, startLightnessShift / 100f, temperaturePolarBlendRadius ), + baseColor, + baseColor.ToHSL().ShiftTemperature( endTemperatureShift, endSaturationShift / 100f, endLightnessShift / 100f, temperaturePolarBlendRadius ), + ]; + + gradient.Offsets = + [ + Mathf.Lerp( 0f, centerPosition, centerAttraction ), + centerPosition, + Mathf.Lerp( 1f, centerPosition, centerAttraction ), + ]; + + return gradient; + } + } +} \ No newline at end of file diff --git a/Runtime/VFX/GradientGenerator/TemperatureGradient.cs.uid b/Runtime/VFX/GradientGenerator/TemperatureGradient.cs.uid new file mode 100644 index 0000000..9deccca --- /dev/null +++ b/Runtime/VFX/GradientGenerator/TemperatureGradient.cs.uid @@ -0,0 +1 @@ +uid://cjyssfkixctwe diff --git a/Runtime/VFX/VFXTools.cs b/Runtime/VFX/VFXTools.cs new file mode 100644 index 0000000..5248372 --- /dev/null +++ b/Runtime/VFX/VFXTools.cs @@ -0,0 +1,20 @@ +using Godot; +using System.Collections.Generic; +using System.Linq; + +namespace Rokojori +{ + public class VFXTools + { + public static List GetGeometryInstance3Ds( Node[] targets, bool includeChildren ) + { + if ( ! includeChildren ) + { + var list = targets.ToList(); + return list.FilterType(); + } + + return Nodes.GetAnyChildren( targets ).FilterType(); + } + } +} \ No newline at end of file diff --git a/Runtime/VFX/VFXTools.cs.uid b/Runtime/VFX/VFXTools.cs.uid new file mode 100644 index 0000000..6f2af0c --- /dev/null +++ b/Runtime/VFX/VFXTools.cs.uid @@ -0,0 +1 @@ +uid://kpv1q8b3frge diff --git a/Tools/godot-editor-inspector-tools/GodotEditorAttributeDrawer.cs b/Tools/godot-editor-inspector-tools/GodotEditorAttributeDrawer.cs new file mode 100644 index 0000000..8c856d6 --- /dev/null +++ b/Tools/godot-editor-inspector-tools/GodotEditorAttributeDrawer.cs @@ -0,0 +1,55 @@ +using System; +using System.Reflection; +using Godot; + +namespace Rokojori.Tools; + +public abstract partial class GodotEditorAttributeDrawer : GodotEditorInspector where A : Attribute +{ + public GodotObject godotObject; + + public override bool _ParseProperty( + GodotObject obj, Variant.Type type, string name, + PropertyHint hintType, string hintString, + PropertyUsageFlags usageFlags, bool wide + ) + { + godotObject = obj; + + if ( GetValueOfMemberWithAttribute( obj, name, typeof(A), out object value ) ) + { + var control = GetPropertyEditor( type, name, hintType, hintString, usageFlags, wide, value ); + AddPropertyEditor( name, control ); + + return true; + } + + return base._ParseProperty( obj, type, name, hintType, hintString, usageFlags, wide ); + } + + protected abstract Control GetPropertyEditor( + Variant.Type type, string name, PropertyHint hintType, + string hintString, PropertyUsageFlags usageFlags, bool wide, object value + ); + + protected bool GetValueOfMemberWithAttribute( + GodotObject obj, string memberName, Type attributeType, out object resultValue + ) + { + resultValue = null; + + var flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance; + + var info = ReflectionHelper.GetDataMemberInfo( obj, memberName, flags ); + + if ( info != null && info.IsDefined( attributeType ) ) + { + resultValue = ReflectionHelper.GetDataMemberValue( obj, info ); + + return true; + } + + return false; + + } +} diff --git a/Tools/godot-editor-inspector-tools/GodotEditorAttributeDrawer.cs.uid b/Tools/godot-editor-inspector-tools/GodotEditorAttributeDrawer.cs.uid new file mode 100644 index 0000000..c38be4b --- /dev/null +++ b/Tools/godot-editor-inspector-tools/GodotEditorAttributeDrawer.cs.uid @@ -0,0 +1 @@ +uid://bm2y1d646juyg diff --git a/Tools/godot-editor-inspector-tools/GodotEditorInspector.cs b/Tools/godot-editor-inspector-tools/GodotEditorInspector.cs new file mode 100644 index 0000000..5cfd8f8 --- /dev/null +++ b/Tools/godot-editor-inspector-tools/GodotEditorInspector.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using Godot; + +namespace Rokojori.Tools; + +public abstract partial class GodotEditorInspector : EditorInspectorPlugin where T : GodotObject +{ + public override bool _CanHandle( GodotObject obj ) => obj is T t && CanHandle( t ); + protected virtual bool CanHandle( T t ) => true; +} \ No newline at end of file diff --git a/Tools/godot-editor-inspector-tools/GodotEditorInspector.cs.uid b/Tools/godot-editor-inspector-tools/GodotEditorInspector.cs.uid new file mode 100644 index 0000000..9a26b05 --- /dev/null +++ b/Tools/godot-editor-inspector-tools/GodotEditorInspector.cs.uid @@ -0,0 +1 @@ +uid://bsap2ukq7q174