lerpValue
- )
+ public float GetUnclampedTransitionPhase()
{
- var propertyTransition = activeTransitions.Find( t => t != null && EqualityComparer.Default.Equals( t.propertyType, property ) );
+ var transitionPhase = timeLine.ComputeRange( start, end );
+ return transitionPhase;
+ }
- if ( propertyTransition == null )
+ public float ComputeTransitionWeight( float phase )
+ {
+ var amount = MathX.Clamp01( phase );
+
+ if ( curve != null )
{
- propertyTransition = new ActiveStyleTransition();
- propertyTransition.propertyType = property;
- propertyTransition.value = activeValue;
- propertyTransition.transitioning = false;
+ amount = curve.Sample( amount );
+ }
- activeTransitions.Add( propertyTransition );
+ return amount;
+ }
- return computedValue;
- }
+ public float GetTransitionWeight()
+ {
+ var transitionPhase = GetUnclampedTransitionPhase();
+ return ComputeTransitionWeight( transitionPhase );
+ }
+
+ public void EndTransition()
+ {
+ transitioning = false;
+ lastValues = [];
+ lastWeights = [];
+
+ }
+
+ public void StartTransition( Control control, V nextValue, TransitionSettings transitionSettings )
+ {
+ if ( ! transitioning )
+ {
+ lastValues = [ value ];
+ lastWeights = [ 1f ];
+ }
else
{
- if ( ! EqualityComparer.Default.Equals( propertyTransition.value, activeValue ) &&
- ! propertyTransition.transitioning && getTransitionSettings() != null )
+ var valueWeight = GetTransitionWeight();
+ var lastWeight = 1f - valueWeight;
+
+ for ( int i = 0; i < lastWeights.Count; i++ )
{
- var transitionSettings = getTransitionSettings();
- propertyTransition.timeLine = transitionSettings.timeLine;
- propertyTransition.start = transitionSettings.timeLine.position;
- propertyTransition.end = propertyTransition.start + transitionSettings.duration;
- propertyTransition.transitioning = true;
- propertyTransition.curve = transitionSettings.curve;
+ lastWeights[ i ] *= lastWeight;
}
+
+ lastValues.Add( value );
+ lastWeights.Add( valueWeight );
}
- if ( EqualityComparer.Default.Equals( propertyTransition.value, activeValue ) )
- {
- propertyTransition.transitioning = false;
- return computedValue;
- }
+ value = nextValue;
- var computedTransitionValue = computeValue( propertyTransition.value );
-
- var transitionPhase = propertyTransition.timeLine.ComputeRange( propertyTransition.start, propertyTransition.end );
-
- if ( transitionPhase >= 1 )
- {
- activeTransitions.Remove( propertyTransition );
- }
-
- var amount = MathX.Clamp01( transitionPhase );
- var curveAmount = amount;
-
- if ( propertyTransition.curve != null )
- {
- curveAmount = propertyTransition.curve.Sample( curveAmount );
- }
-
- return lerpValue( computedTransitionValue, computedValue, curveAmount );
+ timeLine = UI.GetTimeLine( control, transitionSettings.timeLine );
+ start = timeLine.position;
+ end = start + transitionSettings.duration;
+ transitioning = true;
+ curve = transitionSettings.curve;
}
+
+ // public static O ProcessTransition(
+ // UIStylePropertyContainer container, O computedValue,
+ // List> activeTransitions, V activeValue, P property,
+ // Func getTransitionSettings,
+ // Func computeValue,
+ // Func lerpValue
+ // )
+ // {
+ // var propertyTransition = activeTransitions.Find( t => t != null && EqualityComparer.Default.Equals( t.propertyType, property ) );
+
+ // if ( propertyTransition == null )
+ // {
+ // propertyTransition = new ActiveStyleTransition();
+ // propertyTransition.propertyType = property;
+ // propertyTransition.value = activeValue;
+ // propertyTransition.transitioning = false;
+
+ // activeTransitions.Add( propertyTransition );
+
+ // return computedValue;
+ // }
+ // else
+ // {
+ // if ( ! EqualityComparer.Default.Equals( propertyTransition.value, activeValue ) &&
+ // ! propertyTransition.transitioning && getTransitionSettings() != null )
+ // {
+ // var transitionSettings = getTransitionSettings();
+ // propertyTransition.timeLine = transitionSettings.timeLine;
+ // propertyTransition.start = transitionSettings.timeLine.position;
+ // propertyTransition.end = propertyTransition.start + transitionSettings.duration;
+ // propertyTransition.transitioning = true;
+ // propertyTransition.curve = transitionSettings.curve;
+ // }
+ // }
+
+ // if ( EqualityComparer.Default.Equals( propertyTransition.value, activeValue ) )
+ // {
+ // propertyTransition.transitioning = false;
+ // return computedValue;
+ // }
+
+ // var computedTransitionValue = computeValue( propertyTransition.value );
+
+ // var transitionPhase = propertyTransition.timeLine.ComputeRange( propertyTransition.start, propertyTransition.end );
+
+ // if ( transitionPhase >= 1 )
+ // {
+ // activeTransitions.Remove( propertyTransition );
+ // }
+
+ // var amount = MathX.Clamp01( transitionPhase );
+ // var curveAmount = amount;
+
+ // if ( propertyTransition.curve != null )
+ // {
+ // curveAmount = propertyTransition.curve.Sample( curveAmount );
+ // }
+
+ // return lerpValue( computedTransitionValue, computedValue, curveAmount );
+ // }
}
}
\ No newline at end of file
diff --git a/Runtime/UI/Transitions/UIColorTransition.cs b/Runtime/UI/Transitions/UIColorTransition.cs
index bc8f8b6..f93f871 100644
--- a/Runtime/UI/Transitions/UIColorTransition.cs
+++ b/Runtime/UI/Transitions/UIColorTransition.cs
@@ -12,8 +12,28 @@ namespace Rokojori
[Export]
public UIStyleColorProperty property;
+ [Export]
+ public string shaderPropertyName;
+
[Export]
public TransitionSettings settings;
+ public bool Matches( UIStyleColorProperty property, string name )
+ {
+ var hasSameProperty = this.property == property;
+
+ if ( ! hasSameProperty )
+ {
+ return false;
+ }
+
+ if ( UIStyleColorProperty.ColorShaderProperty == property )
+ {
+ return true;
+ }
+
+ return name == shaderPropertyName;
+ }
+
}
}
\ No newline at end of file
diff --git a/Runtime/UI/Transitions/UINumberTransition.cs b/Runtime/UI/Transitions/UINumberTransition.cs
index 0c25f21..85008f0 100644
--- a/Runtime/UI/Transitions/UINumberTransition.cs
+++ b/Runtime/UI/Transitions/UINumberTransition.cs
@@ -12,6 +12,9 @@ namespace Rokojori
[Export]
public UIStyleNumberProperty property;
+ [Export]
+ public string shaderPropertyName;
+
[Export]
public TransitionSettings settings;
}
diff --git a/Runtime/UI/UI-Selectors/UI Active Selector Flag.tres b/Runtime/UI/UI-Selectors/UI Active Selector Flag.tres
new file mode 100644
index 0000000..2734ab4
--- /dev/null
+++ b/Runtime/UI/UI-Selectors/UI Active Selector Flag.tres
@@ -0,0 +1,7 @@
+[gd_resource type="Resource" script_class="UISelectorFlag" load_steps=2 format=3 uid="uid://bpm40sb3qq3ov"]
+
+[ext_resource type="Script" uid="uid://n2lc266yedxq" path="res://addons/rokojori_action_library/Runtime/UI/Styling/UISelectorFlag.cs" id="1_s6l7t"]
+
+[resource]
+script = ExtResource("1_s6l7t")
+metadata/_custom_type_script = "uid://n2lc266yedxq"
diff --git a/Runtime/UI/UI-Selectors/UI Dragging Selector Flag.tres b/Runtime/UI/UI-Selectors/UI Dragging Selector Flag.tres
new file mode 100644
index 0000000..d3d6a9e
--- /dev/null
+++ b/Runtime/UI/UI-Selectors/UI Dragging Selector Flag.tres
@@ -0,0 +1,7 @@
+[gd_resource type="Resource" script_class="UISelectorFlag" load_steps=2 format=3 uid="uid://x1w1ht0ri7bh"]
+
+[ext_resource type="Script" uid="uid://n2lc266yedxq" path="res://addons/rokojori_action_library/Runtime/UI/Styling/UISelectorFlag.cs" id="1_aefxm"]
+
+[resource]
+script = ExtResource("1_aefxm")
+metadata/_custom_type_script = "uid://n2lc266yedxq"
diff --git a/Runtime/UI/UI-Selectors/UI Focus Selector Flag.tres b/Runtime/UI/UI-Selectors/UI Focus Selector Flag.tres
new file mode 100644
index 0000000..a0a3e41
--- /dev/null
+++ b/Runtime/UI/UI-Selectors/UI Focus Selector Flag.tres
@@ -0,0 +1,7 @@
+[gd_resource type="Resource" script_class="UISelectorFlag" load_steps=2 format=3 uid="uid://b1ylhdxhl00md"]
+
+[ext_resource type="Script" uid="uid://n2lc266yedxq" path="res://addons/rokojori_action_library/Runtime/UI/Styling/UISelectorFlag.cs" id="1_l76s3"]
+
+[resource]
+script = ExtResource("1_l76s3")
+metadata/_custom_type_script = "uid://n2lc266yedxq"
diff --git a/Runtime/UI/UI-Selectors/UI Hover Selector Flag.tres b/Runtime/UI/UI-Selectors/UI Hover Selector Flag.tres
new file mode 100644
index 0000000..114515a
--- /dev/null
+++ b/Runtime/UI/UI-Selectors/UI Hover Selector Flag.tres
@@ -0,0 +1,7 @@
+[gd_resource type="Resource" script_class="UISelectorFlag" load_steps=2 format=3 uid="uid://doblbnl2fu6u6"]
+
+[ext_resource type="Script" uid="uid://n2lc266yedxq" path="res://addons/rokojori_action_library/Runtime/UI/Styling/UISelectorFlag.cs" id="1_30u76"]
+
+[resource]
+script = ExtResource("1_30u76")
+metadata/_custom_type_script = "uid://n2lc266yedxq"
diff --git a/Runtime/UI/UI-Selectors/UI Scrolling Selector Flag.tres b/Runtime/UI/UI-Selectors/UI Scrolling Selector Flag.tres
new file mode 100644
index 0000000..dc0d9b7
--- /dev/null
+++ b/Runtime/UI/UI-Selectors/UI Scrolling Selector Flag.tres
@@ -0,0 +1,7 @@
+[gd_resource type="Resource" script_class="UISelectorFlag" load_steps=2 format=3 uid="uid://dleim1i076r0k"]
+
+[ext_resource type="Script" uid="uid://n2lc266yedxq" path="res://addons/rokojori_action_library/Runtime/UI/Styling/UISelectorFlag.cs" id="1_hxexc"]
+
+[resource]
+script = ExtResource("1_hxexc")
+metadata/_custom_type_script = "uid://n2lc266yedxq"
diff --git a/Runtime/UI/UI-Settings-Default.tres b/Runtime/UI/UI-Settings-Default.tres
index d372244..540ead5 100644
--- a/Runtime/UI/UI-Settings-Default.tres
+++ b/Runtime/UI/UI-Settings-Default.tres
@@ -1,8 +1,32 @@
-[gd_resource type="Resource" script_class="UISettings" load_steps=3 format=3 uid="uid://dp57o0ykhkqfj"]
+[gd_resource type="Resource" script_class="UISettings" load_steps=10 format=3 uid="uid://dp57o0ykhkqfj"]
+[ext_resource type="SystemFont" uid="uid://s1pi67tbxu24" path="res://3rdPerson/Inputs/Jost-Font.tres" id="1_0wska"]
[ext_resource type="Script" uid="uid://cgdxalxhdbmjn" path="res://addons/rokojori_action_library/Runtime/UI/UISettings.cs" id="1_5a283"]
+[ext_resource type="Resource" uid="uid://b4iykcwesp1y6" path="res://addons/rokojori_action_library/Runtime/Time/TimeLines/UITime.tres" id="1_6vky0"]
[ext_resource type="Resource" uid="uid://bhy8b3gopkq4m" path="res://addons/rokojori_action_library/Runtime/UI/ShaderProperties/Vector2/Size.tres" id="2_cdd3u"]
+[ext_resource type="Script" uid="uid://cebfjne1ewhnm" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/Vector2PropertyName.cs" id="3_e2b6y"]
+[ext_resource type="Script" uid="uid://cnkyynboxg1qg" path="res://addons/rokojori_action_library/Runtime/UI/Styling/UINumber.cs" id="3_xon8j"]
+[ext_resource type="Resource" uid="uid://dq52vhnqr5m6" path="res://addons/rokojori_action_library/Runtime/Sensors/Default-Sensors/Default-Input-Icons-Library.tres" id="4_v6r6i"]
+
+[sub_resource type="Resource" id="Resource_wm644"]
+script = ExtResource("3_xon8j")
+value = 1.5
+unit = "vw"
+isAnimated = false
+animationDuration = 0.0
+animationOffset = 0.0
+metadata/_custom_type_script = "uid://cnkyynboxg1qg"
+
+[sub_resource type="Resource" id="Resource_6vky0"]
+script = ExtResource("3_e2b6y")
+propertyName = "texture_size"
+metadata/_custom_type_script = "uid://cebfjne1ewhnm"
[resource]
script = ExtResource("1_5a283")
+inputIconsLibrary = ExtResource("4_v6r6i")
+fontSize = SubResource("Resource_wm644")
+defaultFont = ExtResource("1_0wska")
sizePropertyName = ExtResource("2_cdd3u")
+textureSizePropertyName = SubResource("Resource_6vky0")
+defaultTimeline = ExtResource("1_6vky0")
diff --git a/Runtime/UI/UI.cs b/Runtime/UI/UI.cs
index cb76256..a0cc1d6 100644
--- a/Runtime/UI/UI.cs
+++ b/Runtime/UI/UI.cs
@@ -1,46 +1,212 @@
using Godot;
-
+using System;
+using System.Collections.Generic;
+
namespace Rokojori
{
[Tool]
[GlobalClass,Icon("res://addons/rokojori_action_library/Icons/UI.svg")]
- public partial class UI : Control
- {
+ public partial class UI : Control, IDisposable
+ {
+
[Export]
public UISettings settings;
- [Export]
- public InputIconsLibrary inputIconsLibrary;
-
- [ExportGroup("Font Settings")]
-
- [Export]
- public UINumber fontSize;
-
- [Export]
- public Font defaultFont;
-
[Export]
public float fontZoom = 1;
- [ExportGroup("Update Mode")]
+ public enum UpdateMode
+ {
+ Always,
+ Only_Manual_Updates
+ }
[Export]
- public bool updateFlag = false;
+ public UpdateMode updateMode = UpdateMode.Always;
+
+ [Export]
+ public bool useParentSize = false;
+
+ [ExportGroup("Functions")]
+ [ExportToolButton( "Mouse:Stop => Pass")]
+ public Callable StopToPassButton => Callable.From( ()=>{ MakeStopToPass(); } );
[Export]
- public bool updateAlways = true;
+ public Node[] stopToPassRoots = [];
[ExportGroup("Read Only")]
[Export]
public float X_computedFontSizePixels = 1;
+
+
+ List _customDisposers = [];
+
+ public void AddForDisposing( ICustomDisposer customDisposer )
+ {
+ _customDisposers.Add( customDisposer );
+ }
+
+ protected override void Dispose( bool disposing )
+ {
+ _customDisposers.ForEach( cd => cd.Dispose() );
+ _customDisposers = [];
+ }
+
+ [Export]
+ public string[] customDisposerIDs = [];
+
+ public void MakeStopToPass()
+ {
+ var roots = stopToPassRoots;
+
+ if ( roots == null || roots.Length == 0 )
+ {
+ roots = [ this ];
+ }
+
+ foreach ( var n in roots )
+ {
+ if ( n is Control c )
+ {
+ if ( c.MouseFilter == MouseFilterEnum.Stop )
+ {
+ c.MouseFilter = MouseFilterEnum.Pass;
+ }
+ }
+
+ n.ForEach(
+ ( c )=>
+ {
+ if ( c.MouseFilter == MouseFilterEnum.Stop )
+ {
+ c.MouseFilter = MouseFilterEnum.Pass;
+ }
+ }
+ );
+ }
+ }
+
+ Vector2 cachedSize;
+
+ public static UI Get( Control c )
+ {
+ return UIHolder.GetUI( c );
+ }
+
+ public static UIStylePropertyContainer GetStylePropertyContainerParent( Control c )
+ {
+ var it = c as Node;
+ var walker = NodesWalker.Get();
+
+ it = walker.Parent( it );
+
+ if ( it is UI )
+ {
+ return null;
+ }
+
+ while ( it != null )
+ {
+ if ( it is UIStylePropertyContainer )
+ {
+ return it as UIStylePropertyContainer;
+ }
+
+ it = walker.Parent( it );
+
+ if ( it is UI )
+ {
+ it = null;
+ }
+ }
+
+ return null;
+ }
+
+
+ public static TimeLine GetTimeLine( Control c, TimeLine timeLine )
+ {
+ if ( timeLine != null )
+ {
+ return timeLine;
+ }
+
+ var ui = Get( c );
+
+ if ( ui == null || ui.settings == null )
+ {
+ return null;
+ }
+
+ return ui.settings.defaultTimeline;
+ }
+
public override void _Process( double delta )
{
+ if ( settings == null )
+ {
+ return;
+ }
+
+ if ( useParentSize )
+ {
+ var parentSize = GetParent().Size;
+
+ if ( parentSize != cachedSize )
+ {
+ Size = parentSize;
+
+ cachedSize = parentSize;
+
+ // this.LogInfo( "Size Changed" );
+ }
+
+
+ }
+
+ onProcess.DispatchEvent( (float)delta );
UpdateFontSize();
UpdateUIElements();
+
+ // customDisposerIDs = _customDisposers.Map( c => c.GetUID() + ":" + c.GetInfo() ).ToArray();
+
+ }
+
+ public void UpdateExternal( float delta)
+ {
+ onProcess.DispatchEvent( delta );
+ UpdateFontSize();
+ }
+
+ public readonly EventSlot onInputEvent = new EventSlot();
+ public readonly EventSlot onProcess = new EventSlot();
+
+ public override void _Input( InputEvent ie )
+ {
+ onInputEvent.DispatchEvent( ie );
+ }
+
+ List hoveredControls = new List();
+
+ public void SetHovered( UIHoverable control )
+ {
+ hoveredControls.Add( control );
+ }
+
+ public void BindOwnChildren()
+ {
+ BindChildrenOf( this );
+ }
+
+ public void BindChildrenOf( Node node )
+ {
+ node.ForEach( img => img.SetUI( this ) );
+ node.ForEach( info => info.SetUI( this ) );
+ node.ForEach( text => text.SetUI( this ) );
+ node.ForEach( region => region.SetUI( this ) );
}
public override void _Ready()
@@ -64,7 +230,13 @@ namespace Rokojori
void UpdateFontSize()
{
- X_computedFontSizePixels = UINumber.Compute( this, fontSize ) * fontZoom;
+ if ( settings == null )
+ {
+ return;
+ }
+
+ X_computedFontSizePixels = UINumber.Compute( this, settings.fontSize ) * fontZoom;
+
if ( Theme != null )
{
@@ -74,16 +246,18 @@ namespace Rokojori
void UpdateUIElements()
{
- if ( ! ( updateFlag || updateAlways ) )
+ if ( UpdateMode.Always != updateMode )
{
return;
}
- updateFlag = false;
-
- Nodes.ForEachDirectChild( this, r => r.Layout() );
+ UpdateAllUIRegions();
}
+ public void UpdateAllUIRegions()
+ {
+ Nodes.ForEachDirectChild( this, r => r.Layout() );
+ }
public static float GetWindowWidth( Control control )
{
diff --git a/Runtime/UI/UISettings.cs b/Runtime/UI/UISettings.cs
index 2d0321b..c270dee 100644
--- a/Runtime/UI/UISettings.cs
+++ b/Runtime/UI/UISettings.cs
@@ -7,10 +7,24 @@ namespace Rokojori
[GlobalClass,Icon("res://addons/rokojori_action_library/Icons/UI.svg")]
public partial class UISettings : Resource
{
+ [Export]
+ public InputIconsLibrary inputIconsLibrary;
+
+ [Export]
+ public UINumber fontSize;
+
+ [Export]
+ public Font defaultFont;
+
[Export]
public Vector2PropertyName sizePropertyName;
[Export]
public Vector2PropertyName textureSizePropertyName;
+
+ [Export]
+ public TimeLine defaultTimeline;
+
+
}
}
\ No newline at end of file
diff --git a/Runtime/VirtualCameras/CameraSlotSelectors/SetActiveCamera.cs b/Runtime/VirtualCameras/CameraSlotSelectors/SetActiveCamera.cs
index ba7a418..d38d748 100644
--- a/Runtime/VirtualCameras/CameraSlotSelectors/SetActiveCamera.cs
+++ b/Runtime/VirtualCameras/CameraSlotSelectors/SetActiveCamera.cs
@@ -33,7 +33,7 @@ namespace Rokojori
slot.camera = virtualCamera;
slot.flags = slotFlags;
- vm.RefreshSlots();
+ vm.RefreshSlots( true );
}
return slot;
diff --git a/Runtime/VirtualCameras/PostProcess/CenterAndRangeDepthOfFieldEffect.cs b/Runtime/VirtualCameras/PostProcess/CenterAndRangeDepthOfFieldEffect.cs
new file mode 100644
index 0000000..bd1c3ab
--- /dev/null
+++ b/Runtime/VirtualCameras/PostProcess/CenterAndRangeDepthOfFieldEffect.cs
@@ -0,0 +1,71 @@
+
+using Godot;
+using System.Collections.Generic;
+using System;
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass]
+ public partial class CenterAndRangeDepthOfFieldEffect:_XX_DepthOfFieldEffect
+ {
+
+ [Export( PropertyHint.Range, "0,1000")]
+ public float centerDistance = 10;
+
+ [Export( PropertyHint.Range, "0,50")]
+ public float centerDistanceDetails = 0;
+
+ [Export( PropertyHint.Range, "0,1")]
+ public float centerDistanceMicro = 0;
+
+ [Export( PropertyHint.Range, "0,1000")]
+ public float absoluteRange = 1;
+
+ [Export( PropertyHint.Range, "0,0.5")]
+ public float distanceRelativeRange = 0.1f;
+
+
+ [Export( PropertyHint.Range, "0,100")]
+ public float absoluteTransition = 1;
+
+ [Export( PropertyHint.Range, "0,1")]
+ public float distanceRelativeTransition = 0.1f;
+
+ [Export( PropertyHint.Range, "0.1,10")]
+ public float nearTransitionScale = 0.5f;
+
+ [Export( PropertyHint.Range, "0.1,10")]
+ public float farTransitionScale = 2.5f;
+
+ [Export]
+ public NormalizedValue amount;
+
+ [Export]
+ public Float8Value exposure;
+
+ public override BoxedFloatValue[] GetFloatValues()
+ {
+ var distance = MathX.Max( 0, centerDistance + centerDistanceDetails + centerDistanceMicro );
+ var range = absoluteRange + distance * distanceRelativeRange;
+ var far = distance + range;
+ var near = distance - range;
+
+ var farTransition = ( absoluteTransition + ( distanceRelativeTransition * far ) ) * farTransitionScale;
+ var nearTransition = ( absoluteTransition + ( distanceRelativeTransition * near ) )* nearTransitionScale;
+
+ _values[ 0 ] = BoolFloatValue.Create( 1 );
+ _values[ 1 ] = FloatValue.Create( far );
+ _values[ 2 ] = FloatValue.Create( farTransition );
+
+ _values[ 3 ] = BoolFloatValue.Create( 1 );
+ _values[ 4 ] = FloatValue.Create( near );
+ _values[ 5 ] = FloatValue.Create( nearTransition );
+
+ _values[ 6 ] = amount;
+ _values[ 7 ] = exposure;
+
+ return _values;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/Runtime/VirtualCameras/PostProcess/CenterAndRangeDepthOfFieldEffect.cs.uid b/Runtime/VirtualCameras/PostProcess/CenterAndRangeDepthOfFieldEffect.cs.uid
new file mode 100644
index 0000000..c04f917
--- /dev/null
+++ b/Runtime/VirtualCameras/PostProcess/CenterAndRangeDepthOfFieldEffect.cs.uid
@@ -0,0 +1 @@
+uid://dsou2hpnpk77s
diff --git a/Runtime/VirtualCameras/PostProcess/FixedDepthOfFieldEffect.cs b/Runtime/VirtualCameras/PostProcess/FixedDepthOfFieldEffect.cs
new file mode 100644
index 0000000..25c5df6
--- /dev/null
+++ b/Runtime/VirtualCameras/PostProcess/FixedDepthOfFieldEffect.cs
@@ -0,0 +1,66 @@
+
+using Godot;
+using System.Collections.Generic;
+using System;
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass]
+ public partial class FixedDepthOfFieldEffect:_XX_DepthOfFieldEffect
+ {
+ [Export]
+ public BoolFloatValue farEnabled;
+
+ [Export]
+ public FloatDOFDistanceValue farDistance;
+
+ [Export]
+ public FloatDOFTransitionValue farTransition;
+
+ [Export]
+ public BoolFloatValue nearEnabled;
+
+ [Export]
+ public FloatDOFDistanceValue nearDistance;
+
+ [Export]
+ public FloatDOFTransitionValue nearTransition;
+
+ [Export]
+ public NormalizedValue amount;
+
+ [Export]
+ public Float8Value exposure;
+
+ public override BoxedFloatValue[] GetFloatValues()
+ {
+ _values[ 0 ] = farEnabled;
+ _values[ 1 ] = farDistance;
+ _values[ 2 ] = farTransition;
+
+ _values[ 3 ] = nearEnabled;
+ _values[ 4 ] = nearDistance;
+ _values[ 5 ] = nearTransition;
+
+ _values[ 6 ] = amount;
+ _values[ 7 ] = exposure;
+
+ return _values;
+ }
+
+ // public override void SetFloatValues( BoxedFloatValue[] values )
+ // {
+
+ // farEnabled = BoolFloatValue.Create( _values[ 0 ] );
+ // farDistance = FloatDOFDistanceValue.Create( _values[ 1 ] );
+ // farTransition = FloatDOFTransitionValue.Create( _values[ 2 ] );
+
+ // nearEnabled = BoolFloatValue.Create( _values[ 3 ] );
+ // nearDistance = FloatDOFDistanceValue.Create( _values[ 4 ] );
+ // nearTransition = FloatDOFTransitionValue.Create( _values[ 5 ] );
+
+ // amount = NormalizedValue.Create( _values[ 6 ] );
+ // exposure = Float8Value.Create( _values[ 7 ] );
+ // }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/VirtualCameras/PostProcess/FixedDepthOfFieldEffect.cs.uid b/Runtime/VirtualCameras/PostProcess/FixedDepthOfFieldEffect.cs.uid
new file mode 100644
index 0000000..57db90a
--- /dev/null
+++ b/Runtime/VirtualCameras/PostProcess/FixedDepthOfFieldEffect.cs.uid
@@ -0,0 +1 @@
+uid://b2bnxnhb016fs
diff --git a/Runtime/VirtualCameras/PostProcess/FogEffect.cs b/Runtime/VirtualCameras/PostProcess/FogEffect.cs
new file mode 100644
index 0000000..0a24e8f
--- /dev/null
+++ b/Runtime/VirtualCameras/PostProcess/FogEffect.cs
@@ -0,0 +1,148 @@
+
+using Godot;
+using System.Collections.Generic;
+using System;
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass]
+ public partial class FogEffect:PostProcessVolumeEffect
+ {
+ [Export]
+ public ColorValue lightColor;
+
+ [Export]
+ public Float16Value lightEnergy;
+
+ [Export]
+ public NormalizedValue sunScatter;
+
+ [Export]
+ public PowerValue density;
+
+ [Export]
+ public NormalizedValue aerialPerspective;
+
+ [Export]
+ public NormalizedValue skyEffect;
+
+ [Export]
+ public Polar1024Value height;
+
+ [Export]
+ public Polar16Value heightDensity;
+
+ BoxedFloatValue[] _values = new BoxedFloatValue[ 7 ];
+
+
+ public override BoxedFloatValue[] GetFloatValues()
+ {
+ _values[ 0 ] = lightEnergy;
+ _values[ 1 ] = sunScatter;
+ _values[ 2 ] = density;
+ _values[ 3 ] = aerialPerspective;
+ _values[ 4 ] = skyEffect;
+ _values[ 5 ] = height;
+ _values[ 6 ] = heightDensity;
+
+ return _values;
+ }
+
+ public override void SetFloatValues( BoxedFloatValue[] values )
+ {
+ lightEnergy = Float16Value.Create( _values[ 0 ] );
+ sunScatter = NormalizedValue.Create( _values[ 1 ] );
+ density = PowerValue.Create( _values[ 2 ] );
+ aerialPerspective = NormalizedValue.Create( _values[ 3 ] );
+ skyEffect = NormalizedValue.Create( _values[ 4 ] );
+ height = Polar1024Value.Create( _values[ 5 ] );
+ heightDensity = Polar16Value.Create( _values[ 6 ] );
+ }
+
+ ColorValue[] _colors = new ColorValue[ 1 ];
+
+
+ public override ColorValue[] GetColorValues()
+ {
+ _colors[ 0 ] = lightColor;
+
+ return _colors;
+ }
+
+ public override void SetColorValues( ColorValue[] values )
+ {
+ lightColor = ColorValue.Create( values[ 0 ] );
+ }
+
+ public override void Lerp( object fogEffects, List volumes )
+ {
+ LerpFrom( (List) fogEffects, volumes );
+ }
+
+ public void LerpFrom( List fogEffects, List volumes )
+ {
+ LerpColors( fogEffects, volumes );
+ LerpFloats( fogEffects, volumes );
+ }
+
+ public override void Apply( WorldEnvironment worldEnvironment )
+ {
+ if ( worldEnvironment == null || worldEnvironment.Environment == null )
+ {
+ return;
+ }
+
+ if ( lightColor != null )
+ {
+ worldEnvironment.Environment.FogLightColor = lightColor.value;
+ }
+
+ /*
+
+ _values[ 0 ] = lightEnergy;
+ _values[ 1 ] = sunScatter;
+ _values[ 2 ] = density;
+ _values[ 3 ] = aerialPerspective;
+ _values[ 4 ] = skyEffect;
+ _values[ 5 ] = height;
+ _values[ 6 ] = heightDensity;
+
+ */
+
+ if ( lightEnergy != null )
+ {
+ worldEnvironment.Environment.FogLightEnergy = lightEnergy.value;
+ }
+
+ if ( sunScatter != null )
+ {
+ worldEnvironment.Environment.FogSunScatter = sunScatter.value;
+ }
+
+ if ( density != null )
+ {
+ worldEnvironment.Environment.FogDensity = density.value;
+ }
+
+ if ( aerialPerspective != null )
+ {
+ worldEnvironment.Environment.FogAerialPerspective = aerialPerspective.value;
+ }
+
+ if ( skyEffect != null )
+ {
+ worldEnvironment.Environment.FogSkyAffect = skyEffect.value;
+ }
+
+ if ( height != null )
+ {
+ worldEnvironment.Environment.FogHeight = height.value;
+ }
+
+ if ( heightDensity != null )
+ {
+ worldEnvironment.Environment.FogHeightDensity = heightDensity.value;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/VirtualCameras/PostProcess/FogEffect.cs.uid b/Runtime/VirtualCameras/PostProcess/FogEffect.cs.uid
new file mode 100644
index 0000000..9791cbf
--- /dev/null
+++ b/Runtime/VirtualCameras/PostProcess/FogEffect.cs.uid
@@ -0,0 +1 @@
+uid://cmhbynml7hyhj
diff --git a/Runtime/VirtualCameras/PostProcess/FollowDepthOfFieldEffect.cs b/Runtime/VirtualCameras/PostProcess/FollowDepthOfFieldEffect.cs
new file mode 100644
index 0000000..3ef45df
--- /dev/null
+++ b/Runtime/VirtualCameras/PostProcess/FollowDepthOfFieldEffect.cs
@@ -0,0 +1,77 @@
+
+using Godot;
+using System.Collections.Generic;
+using System;
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass]
+ public partial class FollowDepthOfFieldEffect:_XX_DepthOfFieldEffect
+ {
+ [Export]
+ public NodePath node;
+
+ protected float centerDistance = 0;
+
+ [Export( PropertyHint.Range, "-10,10")]
+ public float offsetDistanceDetails = 0;
+
+ [Export( PropertyHint.Range, "-1,1")]
+ public float offsetDistanceMicro = 0;
+
+ [Export( PropertyHint.Range, "0,1000")]
+ public float absoluteRange = 1;
+
+ [Export( PropertyHint.Range, "0,0.5")]
+ public float distanceRelativeRange = 0.1f;
+
+
+ [Export( PropertyHint.Range, "0,100")]
+ public float absoluteTransition = 1;
+
+ [Export( PropertyHint.Range, "0,1")]
+ public float distanceRelativeTransition = 0.1f;
+
+ [Export( PropertyHint.Range, "0.1,10")]
+ public float nearTransitionScale = 0.5f;
+
+ [Export( PropertyHint.Range, "0.1,10")]
+ public float farTransitionScale = 2.5f;
+
+ [Export]
+ public NormalizedValue amount;
+
+ [Export]
+ public Float8Value exposure;
+
+ public void SetCenterDistance( float distance )
+ {
+ centerDistance = distance;
+ }
+
+ public override BoxedFloatValue[] GetFloatValues()
+ {
+ var distance = MathX.Max( 0, centerDistance + offsetDistanceDetails + offsetDistanceMicro );
+ var range = absoluteRange + distance * distanceRelativeRange;
+ var far = distance + range;
+ var near = distance - range;
+
+ var farTransition = ( absoluteTransition + ( distanceRelativeTransition * far ) ) * farTransitionScale;
+ var nearTransition = ( absoluteTransition + ( distanceRelativeTransition * near ) )* nearTransitionScale;
+
+ _values[ 0 ] = BoolFloatValue.Create( 1 );
+ _values[ 1 ] = FloatValue.Create( far );
+ _values[ 2 ] = FloatValue.Create( farTransition );
+
+ _values[ 3 ] = BoolFloatValue.Create( 1 );
+ _values[ 4 ] = FloatValue.Create( near );
+ _values[ 5 ] = FloatValue.Create( nearTransition );
+
+ _values[ 6 ] = amount;
+ _values[ 7 ] = exposure;
+
+ return _values;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/Runtime/VirtualCameras/PostProcess/FollowDepthOfFieldEffect.cs.uid b/Runtime/VirtualCameras/PostProcess/FollowDepthOfFieldEffect.cs.uid
new file mode 100644
index 0000000..54bae01
--- /dev/null
+++ b/Runtime/VirtualCameras/PostProcess/FollowDepthOfFieldEffect.cs.uid
@@ -0,0 +1 @@
+uid://d0vnyofpv743a
diff --git a/Runtime/VirtualCameras/PostProcess/GlowEffect.cs b/Runtime/VirtualCameras/PostProcess/GlowEffect.cs
new file mode 100644
index 0000000..8494803
--- /dev/null
+++ b/Runtime/VirtualCameras/PostProcess/GlowEffect.cs
@@ -0,0 +1,138 @@
+
+using Godot;
+using System.Collections.Generic;
+using System;
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass]
+ public partial class GlowEffect:PostProcessVolumeEffect
+ {
+ [Export]
+ public GlowEffectLevels levels;
+
+ [Export]
+ public Float8Value intensity;
+
+ [Export]
+ public Float2Value strength;
+
+ [Export]
+ public NormalizedValue bloom;
+
+ [Export]
+ public Float4Value hdrTreshold;
+
+ [Export]
+ public Float4Value hdrScale;
+
+ [Export]
+ public Float256Value hdrLuminanceCap;
+
+ [Export]
+ public NormalizedValue mapStrength;
+
+
+ BoxedFloatValue[] _values = new BoxedFloatValue[ 7 ];
+
+
+ public override BoxedFloatValue[] GetFloatValues()
+ {
+ _values[ 0 ] = intensity;
+ _values[ 1 ] = strength;
+ _values[ 2 ] = bloom;
+ _values[ 3 ] = hdrTreshold;
+ _values[ 4 ] = hdrScale;
+ _values[ 5 ] = hdrLuminanceCap;
+ _values[ 6 ] = mapStrength;
+
+ return _values;
+ }
+
+ public override void SetFloatValues( BoxedFloatValue[] values )
+ {
+ intensity = Float8Value.Create( _values[ 0 ] );
+ strength = Float2Value.Create(_values[ 1 ] );
+ bloom = NormalizedValue.Create( _values[ 2 ] );
+ hdrTreshold = Float4Value.Create(_values[ 3 ] );
+ hdrScale = Float4Value.Create(_values[ 4 ] );
+ hdrLuminanceCap = Float256Value.Create(_values[ 5 ] );
+ mapStrength = NormalizedValue.Create(_values[ 6 ] );
+ }
+
+ public override void Lerp( object glowEffects, List volumes )
+ {
+ LerpFrom( (List) glowEffects, volumes );
+ }
+
+ public void LerpFrom( List glowEffects, List volumes )
+ {
+ if ( levels == null && glowEffects.Find( g => g.levels != null ) != null )
+ {
+ levels = new GlowEffectLevels();
+ }
+
+ if ( levels != null )
+ {
+ levels.LerpFrom( glowEffects, volumes );
+ }
+
+ LerpFloats( glowEffects, volumes );
+
+ }
+
+ public override void Apply( WorldEnvironment worldEnvironment )
+ {
+ if ( worldEnvironment == null || worldEnvironment.Environment == null )
+ {
+ return;
+ }
+
+ if ( levels != null )
+ {
+ var normalizer = levels.normalizer;
+
+ worldEnvironment.Environment.SetGlowLevel( 0, levels.level1 * normalizer );
+ worldEnvironment.Environment.SetGlowLevel( 1, levels.level2 * normalizer );
+ worldEnvironment.Environment.SetGlowLevel( 2, levels.level3 * normalizer );
+ worldEnvironment.Environment.SetGlowLevel( 3, levels.level4 * normalizer );
+ worldEnvironment.Environment.SetGlowLevel( 4, levels.level5 * normalizer );
+ worldEnvironment.Environment.SetGlowLevel( 5, levels.level6 * normalizer );
+ worldEnvironment.Environment.SetGlowLevel( 6, levels.level7 * normalizer );
+
+ }
+
+ if ( intensity != null )
+ {
+ worldEnvironment.Environment.GlowIntensity = intensity.GetFloatValue();
+ }
+
+ if ( strength != null )
+ {
+ worldEnvironment.Environment.GlowStrength = strength.GetFloatValue();
+ }
+
+ if ( bloom != null )
+ {
+ worldEnvironment.Environment.GlowBloom = bloom.GetFloatValue();
+ }
+
+ if ( hdrTreshold != null )
+ {
+ worldEnvironment.Environment.GlowHdrThreshold = hdrTreshold.GetFloatValue();
+ }
+
+ if ( hdrScale != null )
+ {
+ worldEnvironment.Environment.GlowHdrScale = hdrScale.GetFloatValue();
+ }
+
+ if ( mapStrength != null )
+ {
+ worldEnvironment.Environment.GlowMapStrength = mapStrength.GetFloatValue();
+ }
+
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/VirtualCameras/PostProcess/GlowEffect.cs.uid b/Runtime/VirtualCameras/PostProcess/GlowEffect.cs.uid
new file mode 100644
index 0000000..7901a48
--- /dev/null
+++ b/Runtime/VirtualCameras/PostProcess/GlowEffect.cs.uid
@@ -0,0 +1 @@
+uid://bcw4w7f5c1n0x
diff --git a/Runtime/VirtualCameras/PostProcess/GlowEffectLevels.cs b/Runtime/VirtualCameras/PostProcess/GlowEffectLevels.cs
new file mode 100644
index 0000000..3c8d23f
--- /dev/null
+++ b/Runtime/VirtualCameras/PostProcess/GlowEffectLevels.cs
@@ -0,0 +1,83 @@
+
+using Godot;
+using System.Collections.Generic;
+using System;
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass]
+ public partial class GlowEffectLevels:Resource
+ {
+ [Export(PropertyHint.Range,"0,10")]
+ public float level1 = 1f;
+ [Export(PropertyHint.Range,"0,10")]
+ public float level2 = 1f;
+ [Export(PropertyHint.Range,"0,10")]
+ public float level3 = 1f;
+ [Export(PropertyHint.Range,"0,10")]
+
+ public float level4 = 1f;
+ [Export(PropertyHint.Range,"0,10")]
+ public float level5 = 1f;
+ [Export(PropertyHint.Range,"0,10")]
+ public float level6 = 1f;
+ [Export(PropertyHint.Range,"0,10")]
+ public float level7 = 1f;
+
+ [Export]
+ public bool normalized = true;
+
+ public float sum => level1 + level2 + level3 + level4 + level5 + level6 + level7;
+ public float normalizer => normalized ? 1f / sum : 1f;
+
+ public void LerpFrom( List glowEffects, List volumes )
+ {
+ level1 = 0;
+ level2 = 0;
+ level3 = 0;
+ level4 = 0;
+ level5 = 0;
+ level6 = 0;
+ level7 = 0;
+
+ float weight = 0;
+
+ for ( int i = 0; i < glowEffects.Count; i++ )
+ {
+ var levels = glowEffects[ i ].levels;
+
+ if ( levels == null )
+ {
+ continue;
+ }
+
+ var normalizer = levels.normalizer;
+
+ level1 += levels.level1 * normalizer;
+ level2 += levels.level2 * normalizer;
+ level3 += levels.level3 * normalizer;
+ level4 += levels.level4 * normalizer;
+ level5 += levels.level5 * normalizer;
+ level6 += levels.level6 * normalizer;
+ level7 += levels.level7 * normalizer;
+
+ weight += volumes[ i ].combinedWeight;
+ }
+
+ if ( weight == 0 )
+ {
+ return;
+ }
+
+ level1 /= weight;
+ level2 /= weight;
+ level3 /= weight;
+ level4 /= weight;
+ level5 /= weight;
+ level6 /= weight;
+ level7 /= weight;
+
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/Runtime/VirtualCameras/PostProcess/GlowEffectLevels.cs.uid b/Runtime/VirtualCameras/PostProcess/GlowEffectLevels.cs.uid
new file mode 100644
index 0000000..ac95c14
--- /dev/null
+++ b/Runtime/VirtualCameras/PostProcess/GlowEffectLevels.cs.uid
@@ -0,0 +1 @@
+uid://cqr3g8hjix8hu
diff --git a/Runtime/VirtualCameras/PostProcess/PostProcessEffectProcessor.cs b/Runtime/VirtualCameras/PostProcess/PostProcessEffectProcessor.cs
new file mode 100644
index 0000000..9232fcc
--- /dev/null
+++ b/Runtime/VirtualCameras/PostProcess/PostProcessEffectProcessor.cs
@@ -0,0 +1,46 @@
+
+using Godot;
+using System.Collections.Generic;
+using System;
+using System.Linq;
+namespace Rokojori
+{
+ public interface IPostProcessEffectProcessor
+ {
+ public void ClearForStackUpdate();
+ public void OnVolumeUpdate( PostProcessVolume volume, List allEffects );
+ public void Apply( WorldEnvironment worldEnvironment );
+ }
+
+ public class PostProcessEffectProcessor:IPostProcessEffectProcessor where T:PostProcessVolumeEffect, new()
+ {
+ public T combinedEffect = new T();
+ public List