diff --git a/Icons/Collidable.svg b/Icons/Collidable.svg
new file mode 100644
index 0000000..b6959a3
--- /dev/null
+++ b/Icons/Collidable.svg
@@ -0,0 +1,210 @@
+
+
diff --git a/Icons/Collidable.svg.import b/Icons/Collidable.svg.import
new file mode 100644
index 0000000..ddbc278
--- /dev/null
+++ b/Icons/Collidable.svg.import
@@ -0,0 +1,43 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://dg7on2hj1wbey"
+path="res://.godot/imported/Collidable.svg-8482075c469ae7f520a2601ba58d7e98.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://addons/rokojori_action_library/Icons/Collidable.svg"
+dest_files=["res://.godot/imported/Collidable.svg-8482075c469ae7f520a2601ba58d7e98.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/uastc_level=0
+compress/rdo_quality_loss=0.0
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/channel_remap/red=0
+process/channel_remap/green=1
+process/channel_remap/blue=2
+process/channel_remap/alpha=3
+process/fix_alpha_border=true
+process/premult_alpha=false
+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
+svg/scale=1.0
+editor/scale_with_editor_scale=false
+editor/convert_colors_with_editor_theme=false
diff --git a/Icons/Collider.svg b/Icons/Collider.svg
new file mode 100644
index 0000000..84b0197
--- /dev/null
+++ b/Icons/Collider.svg
@@ -0,0 +1,213 @@
+
+
diff --git a/Icons/Collider.svg.import b/Icons/Collider.svg.import
new file mode 100644
index 0000000..a9712e4
--- /dev/null
+++ b/Icons/Collider.svg.import
@@ -0,0 +1,43 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://xsgi8ucjgdbg"
+path="res://.godot/imported/Collider.svg-8f5313483cb1b4b6e56ac5d4f044ae74.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://addons/rokojori_action_library/Icons/Collider.svg"
+dest_files=["res://.godot/imported/Collider.svg-8f5313483cb1b4b6e56ac5d4f044ae74.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/uastc_level=0
+compress/rdo_quality_loss=0.0
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/channel_remap/red=0
+process/channel_remap/green=1
+process/channel_remap/blue=2
+process/channel_remap/alpha=3
+process/fix_alpha_border=true
+process/premult_alpha=false
+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
+svg/scale=1.0
+editor/scale_with_editor_scale=false
+editor/convert_colors_with_editor_theme=false
diff --git a/Icons/GDScriptAction.svg b/Icons/GDScriptAction.svg
new file mode 100644
index 0000000..914f6fc
--- /dev/null
+++ b/Icons/GDScriptAction.svg
@@ -0,0 +1,60 @@
+
+
diff --git a/Icons/GDScriptAction.svg.import b/Icons/GDScriptAction.svg.import
new file mode 100644
index 0000000..c220b89
--- /dev/null
+++ b/Icons/GDScriptAction.svg.import
@@ -0,0 +1,43 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://dw1dtygiamsdq"
+path="res://.godot/imported/GDScriptAction.svg-5229bd85d169d26c8b21208a93a35aae.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://addons/rokojori_action_library/Icons/GDScriptAction.svg"
+dest_files=["res://.godot/imported/GDScriptAction.svg-5229bd85d169d26c8b21208a93a35aae.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/uastc_level=0
+compress/rdo_quality_loss=0.0
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/channel_remap/red=0
+process/channel_remap/green=1
+process/channel_remap/blue=2
+process/channel_remap/alpha=3
+process/fix_alpha_border=true
+process/premult_alpha=false
+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
+svg/scale=1.0
+editor/scale_with_editor_scale=false
+editor/convert_colors_with_editor_theme=false
diff --git a/Icons/GDScriptSequenceAction.svg b/Icons/GDScriptSequenceAction.svg
new file mode 100644
index 0000000..ac7a545
--- /dev/null
+++ b/Icons/GDScriptSequenceAction.svg
@@ -0,0 +1,65 @@
+
+
diff --git a/Icons/GDScriptSequenceAction.svg.import b/Icons/GDScriptSequenceAction.svg.import
new file mode 100644
index 0000000..564399a
--- /dev/null
+++ b/Icons/GDScriptSequenceAction.svg.import
@@ -0,0 +1,43 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://ktq8w2ep7qtj"
+path="res://.godot/imported/GDScriptSequenceAction.svg-871462890bc760a2e2f4ebebacc73b30.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://addons/rokojori_action_library/Icons/GDScriptSequenceAction.svg"
+dest_files=["res://.godot/imported/GDScriptSequenceAction.svg-871462890bc760a2e2f4ebebacc73b30.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/uastc_level=0
+compress/rdo_quality_loss=0.0
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/channel_remap/red=0
+process/channel_remap/green=1
+process/channel_remap/blue=2
+process/channel_remap/alpha=3
+process/fix_alpha_border=true
+process/premult_alpha=false
+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
+svg/scale=1.0
+editor/scale_with_editor_scale=false
+editor/convert_colors_with_editor_theme=false
diff --git a/Icons/RJ_Action.svg b/Icons/RJ_Action.svg
new file mode 100644
index 0000000..c38da3c
--- /dev/null
+++ b/Icons/RJ_Action.svg
@@ -0,0 +1,40 @@
+
+
diff --git a/Icons/RJ_Action.svg.import b/Icons/RJ_Action.svg.import
new file mode 100644
index 0000000..c051f84
--- /dev/null
+++ b/Icons/RJ_Action.svg.import
@@ -0,0 +1,43 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://bc02q72sijom4"
+path="res://.godot/imported/RJ_Action.svg-e2ec937a63457fcfbd6e5b3d52f60bb6.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://addons/rokojori_action_library/Icons/RJ_Action.svg"
+dest_files=["res://.godot/imported/RJ_Action.svg-e2ec937a63457fcfbd6e5b3d52f60bb6.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/uastc_level=0
+compress/rdo_quality_loss=0.0
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/channel_remap/red=0
+process/channel_remap/green=1
+process/channel_remap/blue=2
+process/channel_remap/alpha=3
+process/fix_alpha_border=true
+process/premult_alpha=false
+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
+svg/scale=1.0
+editor/scale_with_editor_scale=false
+editor/convert_colors_with_editor_theme=false
diff --git a/Icons/RJ_SequenceAction.svg b/Icons/RJ_SequenceAction.svg
new file mode 100644
index 0000000..562a09e
--- /dev/null
+++ b/Icons/RJ_SequenceAction.svg
@@ -0,0 +1,45 @@
+
+
diff --git a/Icons/RJ_SequenceAction.svg.import b/Icons/RJ_SequenceAction.svg.import
new file mode 100644
index 0000000..938537f
--- /dev/null
+++ b/Icons/RJ_SequenceAction.svg.import
@@ -0,0 +1,43 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://didqgj0wwsx4l"
+path="res://.godot/imported/RJ_SequenceAction.svg-1ef2c9c94a8c9f5c9dcc7af742ad00d8.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://addons/rokojori_action_library/Icons/RJ_SequenceAction.svg"
+dest_files=["res://.godot/imported/RJ_SequenceAction.svg-1ef2c9c94a8c9f5c9dcc7af742ad00d8.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/uastc_level=0
+compress/rdo_quality_loss=0.0
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/channel_remap/red=0
+process/channel_remap/green=1
+process/channel_remap/blue=2
+process/channel_remap/alpha=3
+process/fix_alpha_border=true
+process/premult_alpha=false
+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
+svg/scale=1.0
+editor/scale_with_editor_scale=false
+editor/convert_colors_with_editor_theme=false
diff --git a/Icons/RenderingManager.svg b/Icons/RenderingManager.svg
index a264e18..2624720 100644
--- a/Icons/RenderingManager.svg
+++ b/Icons/RenderingManager.svg
@@ -150,9 +150,9 @@
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#505050"
showgrid="false"
- inkscape:zoom="22.627417"
- inkscape:cx="1.4584077"
- inkscape:cy="13.34664"
+ inkscape:zoom="2"
+ inkscape:cx="-101.25"
+ inkscape:cy="-9.5"
inkscape:window-width="1920"
inkscape:window-height="1017"
inkscape:window-x="-8"
diff --git a/Icons/WindManager.svg b/Icons/WindManager.svg
new file mode 100644
index 0000000..b01ebcb
--- /dev/null
+++ b/Icons/WindManager.svg
@@ -0,0 +1,198 @@
+
+
diff --git a/Icons/WindManager.svg.import b/Icons/WindManager.svg.import
new file mode 100644
index 0000000..c29c6fe
--- /dev/null
+++ b/Icons/WindManager.svg.import
@@ -0,0 +1,43 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://cxmpmvdminoh8"
+path="res://.godot/imported/WindManager.svg-af882a5a9dd0c369531b565ccd6be2fe.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://addons/rokojori_action_library/Icons/WindManager.svg"
+dest_files=["res://.godot/imported/WindManager.svg-af882a5a9dd0c369531b565ccd6be2fe.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/uastc_level=0
+compress/rdo_quality_loss=0.0
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/channel_remap/red=0
+process/channel_remap/green=1
+process/channel_remap/blue=2
+process/channel_remap/alpha=3
+process/fix_alpha_border=true
+process/premult_alpha=false
+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
+svg/scale=1.0
+editor/scale_with_editor_scale=false
+editor/convert_colors_with_editor_theme=false
diff --git a/RokojoriPlugin.cs b/RokojoriPlugin.cs
index 3d62400..6e7125b 100644
--- a/RokojoriPlugin.cs
+++ b/RokojoriPlugin.cs
@@ -31,6 +31,12 @@ namespace Rokojori
static readonly string RokojoriSettingsPath = "res://.rokojori/settings";
static readonly string RokojoriCachePath = "res://.rokojori/cache";
+ // static RokojoriPlugin _instance;
+ // public static RokojoriPlugin Get()
+ // {
+ // return _instance;
+ // }
+
public override void _EnablePlugin()
{
this.LogInfo();
@@ -99,6 +105,8 @@ namespace Rokojori
public override void _EnterTree()
{
+ // _instance = this;
+
EnsureHiddenProjectPath( RokojoriProjectInternalPath );
EnsureHiddenProjectPath( RokojoriSettingsPath );
EnsureHiddenProjectPath( RokojoriCachePath );
diff --git a/Runtime/Actions/Action.cs b/Runtime/Actions/Action.cs
index f36b75f..b1563b0 100644
--- a/Runtime/Actions/Action.cs
+++ b/Runtime/Actions/Action.cs
@@ -26,6 +26,23 @@ namespace Rokojori
NetworkNodeSlot _dataSlot = new NetworkNodeSlot();
NetworkNodeSlot _seedAndDataSlot = new NetworkNodeSlot();
+ public static bool IsAction( Node n )
+ {
+ if ( n == null )
+ {
+ return false;
+ }
+
+ return n is Action || GDScriptAction.IsRJAction( n );
+ }
+
+ public void LogInfoFor( Node n, string message )
+ {
+ var className = GDScriptNames.ExtractClassName( n );
+ RJLog.GDLog( $"{className}._onTrigger()", n, message );
+ }
+
+
protected override List CreateNetworkNodeMembers()
{
return new List()
@@ -83,7 +100,7 @@ namespace Rokojori
BitView _sendingNetworkData;
BitView _receivedNetworkData;
- protected bool isNetworkedTrigger => _isNetworkedTrigger;
+ public bool isNetworkedTrigger => _isNetworkedTrigger;
static readonly int maxNetworkSeed = Mathf.RoundToInt( Mathf.Pow( 2, 30 ) );
@@ -137,7 +154,7 @@ namespace Rokojori
action.Trigger();
}
- public static void TriggerAll( Action[] actions, Node target, bool triggerDirectChildren )
+ public static void TriggerAll( Action[] actions, Node target, bool triggerDirectChildren, Action caller = null )
{
if ( actions != null )
{
@@ -152,7 +169,7 @@ namespace Rokojori
return;
}
- Nodes.ForEachDirectChild( target, a => Action.Trigger( a ) );
+ Nodes.ForEachDirectChild( target, ( a ) => Trigger( a ) );
}
public static void TriggerAll( Action action, Node target, bool triggerDirectChildren )
@@ -168,7 +185,7 @@ namespace Rokojori
return;
}
- Nodes.ForEachDirectChild( target, a => Action.Trigger( a ) );
+ Nodes.ForEachDirectChild( target, ( a ) => Trigger( a ) );
}
}
diff --git a/Runtime/Actions/Conditional/ConditionalAction.cs b/Runtime/Actions/Conditional/ConditionalAction.cs
index ec0b800..dcc273a 100644
--- a/Runtime/Actions/Conditional/ConditionalAction.cs
+++ b/Runtime/Actions/Conditional/ConditionalAction.cs
@@ -12,6 +12,7 @@ namespace Rokojori
[ExportGroup("Condition")]
[Export]
public Condition condition;
+
[Export]
public SceneCondition sceneCondition;
@@ -24,7 +25,7 @@ namespace Rokojori
protected override void _OnTrigger()
{
- var conditionActive = Condition.Evaluate( condition ) && SceneCondition.Evaluate( sceneCondition );
+ var conditionActive = Condition.Evaluate( condition ) || SceneCondition.Evaluate( sceneCondition );
// this.LogInfo( "Condition is", conditionActive );
diff --git a/Runtime/Actions/Conditional/CoolDown.cs b/Runtime/Actions/Conditional/CoolDown.cs
index c178370..fdcb97e 100644
--- a/Runtime/Actions/Conditional/CoolDown.cs
+++ b/Runtime/Actions/Conditional/CoolDown.cs
@@ -16,6 +16,19 @@ namespace Rokojori
public Duration coolDownDuration;
bool _isCoolingDown = false;
+ int _coolDownID = -1;
+
+ public void ResetCoolDown()
+ {
+ if ( _coolDownID == -1 )
+ {
+ return;
+ }
+
+ _isCoolingDown = false;
+ _coolDownID = -1;
+ }
+
protected override void _OnTrigger()
{
if ( _isCoolingDown )
@@ -28,10 +41,21 @@ namespace Rokojori
if ( coolDownDuration != null )
{
- TimeLineManager.ScheduleEventIn(
+ var te = TimeLineManager.ScheduleEventIn(
coolDownDuration.timeLine, coolDownDuration.GetDurationInSeconds(),
- ev => _isCoolingDown = false
+ ev =>
+ {
+ if ( _coolDownID != ev.id )
+ {
+ return;
+ }
+
+ _isCoolingDown = false;
+ }
);
+
+ _coolDownID = te.id;
+
}
}
diff --git a/Runtime/Actions/Conditional/ResetCoolDown.cs b/Runtime/Actions/Conditional/ResetCoolDown.cs
new file mode 100644
index 0000000..e2d75c2
--- /dev/null
+++ b/Runtime/Actions/Conditional/ResetCoolDown.cs
@@ -0,0 +1,20 @@
+
+using Godot;
+using System.Collections.Generic;
+
+
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/ConditionalAction.svg")]
+ public partial class ResetCoolDown : Action
+ {
+ [Export]
+ public CoolDown coolDown;
+
+ protected override void _OnTrigger()
+ {
+ coolDown.ResetCoolDown();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Actions/Conditional/ResetCoolDown.cs.uid b/Runtime/Actions/Conditional/ResetCoolDown.cs.uid
new file mode 100644
index 0000000..0d44292
--- /dev/null
+++ b/Runtime/Actions/Conditional/ResetCoolDown.cs.uid
@@ -0,0 +1 @@
+uid://d6m0k7ql0mnr
diff --git a/Runtime/Actions/GDScriptAction.cs b/Runtime/Actions/GDScriptAction.cs
new file mode 100644
index 0000000..cdf4ded
--- /dev/null
+++ b/Runtime/Actions/GDScriptAction.cs
@@ -0,0 +1,60 @@
+
+using Godot;
+using System.Collections.Generic;
+
+
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/GDScriptAction.svg")]
+ public partial class GDScriptAction : Action
+ {
+ public static string onTriggerFunctionName = "_onTrigger";
+ public static string rjAction_className = "RJ_Action";
+
+ public static bool IsRJAction( Node n )
+ {
+ var extractedClass = GDScriptNames.ExtractClassName( n );
+
+ if ( extractedClass == null )
+ {
+ return false;
+ }
+
+ return GDScriptNames.IsOrExtendsFrom( n, rjAction_className );
+ }
+
+ public static void TriggerRJAction( Node n, Action caller )
+ {
+ n.Call( onTriggerFunctionName, caller );
+ }
+
+ protected override void _OnTrigger()
+ {
+ var firstChild = GetChild( 0 );
+
+ if ( firstChild == null || ! IsRJAction( firstChild ) )
+ {
+ return;
+ }
+
+ TriggerRJAction( firstChild, this );
+ }
+
+ public async void WrapRJAction( Node rjAction )
+ {
+ await this.RequestNextFrame();
+
+ if ( rjAction == null || rjAction.GetParent() == null )
+ {
+ return;
+ }
+
+ this.LogInfo( "Wrapping:", rjAction );
+
+ this.Wrap( rjAction );
+
+ this.Name = rjAction.Name + " Wrapper" ;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Actions/GDScriptAction.cs.uid b/Runtime/Actions/GDScriptAction.cs.uid
new file mode 100644
index 0000000..21c1c53
--- /dev/null
+++ b/Runtime/Actions/GDScriptAction.cs.uid
@@ -0,0 +1 @@
+uid://c2m6vuo3nucna
diff --git a/Runtime/Actions/GDScriptSequenceAction.cs b/Runtime/Actions/GDScriptSequenceAction.cs
new file mode 100644
index 0000000..d81236b
--- /dev/null
+++ b/Runtime/Actions/GDScriptSequenceAction.cs
@@ -0,0 +1,59 @@
+
+using Godot;
+using System.Collections.Generic;
+
+
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/GDScriptSequenceAction.svg")]
+ public partial class GDScriptSequenceAction : SequenceAction
+ {
+ public static string rjSequenceAction_className = "RJ_SequenceAction";
+
+ public static bool IsRJSequenceAction( Node n )
+ {
+ var extractedClass = GDScriptNames.ExtractClassName( n );
+
+ if ( extractedClass == null )
+ {
+ return false;
+ }
+
+ return GDScriptNames.IsOrExtendsFrom( n, rjSequenceAction_className );
+ }
+
+ public static void TriggerRJ_SequenceAction( Node n, Action caller )
+ {
+ n.Call( GDScriptAction.onTriggerFunctionName, caller );
+ }
+
+ protected override void _OnTrigger()
+ {
+ var firstChild = GetChild( 0 );
+
+ if ( firstChild == null || ! IsRJSequenceAction( firstChild ) )
+ {
+ return;
+ }
+
+ TriggerRJ_SequenceAction( firstChild, this );
+ }
+
+ public async void WrapRJSequenceAction( Node rjSequenceAction )
+ {
+ await this.RequestNextFrame();
+
+ if ( rjSequenceAction == null || rjSequenceAction.GetParent() == null )
+ {
+ return;
+ }
+
+ this.LogInfo( "Wrapping:", rjSequenceAction );
+
+ this.Wrap( rjSequenceAction );
+
+ this.Name = rjSequenceAction.Name + " Wrapper" ;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Actions/GDScriptSequenceAction.cs.uid b/Runtime/Actions/GDScriptSequenceAction.cs.uid
new file mode 100644
index 0000000..8a8885d
--- /dev/null
+++ b/Runtime/Actions/GDScriptSequenceAction.cs.uid
@@ -0,0 +1 @@
+uid://cb26oih56el4s
diff --git a/Runtime/Actions/Node/SetNodeState.cs b/Runtime/Actions/Node/SetNodeState.cs
index 8a067ce..c85d7c8 100644
--- a/Runtime/Actions/Node/SetNodeState.cs
+++ b/Runtime/Actions/Node/SetNodeState.cs
@@ -13,8 +13,12 @@ namespace Rokojori
[Export]
public Node[] disable = new Node[ 0 ];
-
protected override void _OnTrigger()
+ {
+ CallDeferred( "SetStates" );
+ }
+
+ void SetStates()
{
Arrays.ForEach( enable, n => NodeState.Enable( n ) );
Arrays.ForEach( disable, n => NodeState.Disable( n ) );
diff --git a/Runtime/Actions/Node/SetNodeStateSpecific.cs b/Runtime/Actions/Node/SetNodeStateSpecific.cs
index 3cf9fce..01a7a3f 100644
--- a/Runtime/Actions/Node/SetNodeStateSpecific.cs
+++ b/Runtime/Actions/Node/SetNodeStateSpecific.cs
@@ -15,6 +15,11 @@ namespace Rokojori
protected override void _OnTrigger()
{
+ CallDeferred( "SetNodeState" );
+ }
+
+ void SetNodeState()
+ {
NodeState.Configure( target, configuration );
}
}
diff --git a/Runtime/Actions/Node3D/MoveTowards.cs b/Runtime/Actions/Node3D/MoveTowards.cs
index c31ba51..d97f9d4 100644
--- a/Runtime/Actions/Node3D/MoveTowards.cs
+++ b/Runtime/Actions/Node3D/MoveTowards.cs
@@ -43,7 +43,7 @@ namespace Rokojori
// this.LogInfo( "Moving:", direction );
target.LookAt( goal.GlobalPosition );
- var nextRotation = target.GetGlobalQuaternion();
+ var nextRotation = target.GlobalQuaternion();
var rotation = Smoothing.Apply( rotationSmoothing, nextRotation, (float) delta );
target.SetGlobalQuaternion( rotation );
}
diff --git a/Runtime/Actions/Node3D/PlaySound.cs b/Runtime/Actions/Node3D/PlaySound.cs
index 4a7d883..f7081ef 100644
--- a/Runtime/Actions/Node3D/PlaySound.cs
+++ b/Runtime/Actions/Node3D/PlaySound.cs
@@ -11,7 +11,7 @@ namespace Rokojori
public AudioStreamPlayer3D player;
[Export]
- public SelectorFlag overdrivePreventionFlag;
+ public AudioFlag overdrivePreventionFlag;
[Export]
@@ -103,7 +103,7 @@ namespace Rokojori
player.Play( offset );
- this.LogInfo( "Play sound", offset, HierarchyName.Of( player ) );
+ // this.LogInfo( "Play sound", offset, HierarchyName.Of( player ) );
if ( overdrivePreventionFlag != null )
{
diff --git a/Runtime/Actions/Node3D/SetTransform.cs b/Runtime/Actions/Node3D/SetTransform.cs
new file mode 100644
index 0000000..f97a98e
--- /dev/null
+++ b/Runtime/Actions/Node3D/SetTransform.cs
@@ -0,0 +1,72 @@
+
+using Godot;
+
+
+namespace Rokojori
+{
+ [GlobalClass, Tool ]
+ public partial class SetTransform : Action
+ {
+ [Export]
+ public Node3D target;
+
+ public enum IgnoreGlobalLocal
+ {
+ Ignore, Global, Local
+ }
+
+ [ExportGroup( "Position" ) ]
+ [Export]
+ public IgnoreGlobalLocal positionMode = IgnoreGlobalLocal.Ignore;
+
+ [Export]
+ public Vector3 position = Vector3.Zero;
+
+ [ExportGroup( "Rotation" ) ]
+ [Export]
+ public IgnoreGlobalLocal rotationMode = IgnoreGlobalLocal.Ignore;
+
+ [Export]
+ public Vector3 rotation = Vector3.Zero;
+
+ public enum IgnoreLocal
+ {
+ Ignore, Local
+ }
+
+
+ [ExportGroup( "Scale" ) ]
+ [Export]
+ public IgnoreLocal scaleMode = IgnoreLocal.Ignore;
+
+ [Export]
+ public Vector3 scale = Vector3.One;
+
+
+
+
+ protected override void _OnTrigger()
+ {
+ if ( target == null )
+ {
+ return;
+ }
+
+ if ( positionMode != IgnoreGlobalLocal.Ignore )
+ {
+ target.SetLocalOrGlobalPosition( position, positionMode == IgnoreGlobalLocal.Global );
+ }
+
+ if ( rotationMode != IgnoreGlobalLocal.Ignore )
+ {
+ target.SetLocalOrGlobalRotation( rotation, rotationMode == IgnoreGlobalLocal.Global );
+ }
+
+ if ( scaleMode != IgnoreLocal.Ignore )
+ {
+ target.Scale = scale;
+ }
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Actions/Node3D/SetTransform.cs.uid b/Runtime/Actions/Node3D/SetTransform.cs.uid
new file mode 100644
index 0000000..39afcfb
--- /dev/null
+++ b/Runtime/Actions/Node3D/SetTransform.cs.uid
@@ -0,0 +1 @@
+uid://cnp3xr8gawyi6
diff --git a/Runtime/Actions/RemoveNode.cs b/Runtime/Actions/RemoveNode.cs
index 4ddff4d..c68271a 100644
--- a/Runtime/Actions/RemoveNode.cs
+++ b/Runtime/Actions/RemoveNode.cs
@@ -1,6 +1,6 @@
using Godot;
-using System.Collections.Generic;
+using System.Threading.Tasks;
namespace Rokojori
{
@@ -13,17 +13,31 @@ namespace Rokojori
[Export]
public bool queue = true;
+
protected override void _OnTrigger()
{
- if ( target == null )
+ if ( target == null || Engine.IsEditorHint() )
{
return;
}
- // this.LogInfo( "Remove", HierarchyName.Of( target ) );
-
- target.SelfDestroy( queue );
+ if ( ! IsInstanceValid( this ) || ! IsInstanceValid( target ) )
+ {
+ return;
+ }
+
+ CallDeferred( "SelfDestroy" );
}
+
+ void SelfDestroy()
+ {
+ if ( ! IsInstanceValid( target ) )
+ {
+ return;
+ }
+
+ target.SelfDestroy( queue );
+ }
}
}
\ No newline at end of file
diff --git a/Runtime/Actions/Sequence/RepeatSequence.cs b/Runtime/Actions/Sequence/RepeatSequence.cs
index f97bb2e..be00efa 100644
--- a/Runtime/Actions/Sequence/RepeatSequence.cs
+++ b/Runtime/Actions/Sequence/RepeatSequence.cs
@@ -20,9 +20,16 @@ namespace Rokojori
public TimeLine timeLine;
+ bool stopSignal = false;
+
+
+ public void Stop()
+ {
+ stopSignal = true;
+ }
+
protected override void _OnTrigger()
{
-
var id = DispatchStart();
if ( ! ( action is SequenceAction ) )
@@ -62,6 +69,8 @@ namespace Rokojori
var finished = ( maxNumRepeats > 0 && executed >= maxNumRepeats ) ||
( tl != null && tl.position >= endTime );
+ finished = stopSignal || finished;
+
if ( finished )
{
DispatchEnd( id );
diff --git a/Runtime/Actions/Sequence/StopRepeatSequence.cs b/Runtime/Actions/Sequence/StopRepeatSequence.cs
new file mode 100644
index 0000000..66232f6
--- /dev/null
+++ b/Runtime/Actions/Sequence/StopRepeatSequence.cs
@@ -0,0 +1,18 @@
+
+using Godot;
+using System.Collections.Generic;
+
+namespace Rokojori
+{
+ [Tool][GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Parallel.svg") ]
+ public partial class StopRepeatSequence : Action
+ {
+ [Export]
+ public RepeatSequence repeatSequence;
+
+ protected override void _OnTrigger()
+ {
+ repeatSequence.Stop();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Actions/Sequence/StopRepeatSequence.cs.uid b/Runtime/Actions/Sequence/StopRepeatSequence.cs.uid
new file mode 100644
index 0000000..bb8e9ca
--- /dev/null
+++ b/Runtime/Actions/Sequence/StopRepeatSequence.cs.uid
@@ -0,0 +1 @@
+uid://cvw0nxi8migso
diff --git a/Runtime/Actions/Visual/TweenLight.cs b/Runtime/Actions/Visual/TweenLight.cs
index f3db835..be3e0f0 100644
--- a/Runtime/Actions/Visual/TweenLight.cs
+++ b/Runtime/Actions/Visual/TweenLight.cs
@@ -73,7 +73,8 @@ namespace Rokojori
{
DispatchEnd( sequenceID );
}
- }
+ },
+ this
);
}
diff --git a/Runtime/Animation/Flash/Flash.cs b/Runtime/Animation/Flash/Flash.cs
index 85bc1b1..3a9a376 100644
--- a/Runtime/Animation/Flash/Flash.cs
+++ b/Runtime/Animation/Flash/Flash.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
using Godot;
+using System.Linq;
namespace Rokojori
{
@@ -64,6 +65,15 @@ namespace Rokojori
OmniLight3D light = null;
+ // [Export]
+ // public Node3D debugProcessIndicator;
+
+ // [Export]
+ // public Vector3 debugProcessIndicatorFull = new Vector3( 5, 0, 0 );
+
+ // [Export]
+ // public StandardMaterial3D debugMaterial;
+
public override string[] _GetConfigurationWarnings()
{
var warnigns = new List();
@@ -186,6 +196,10 @@ namespace Rokojori
_materials = new List();
+ if ( Engine.IsEditorHint() )
+ {
+ _allTargets = null;
+ }
Arrays.ForEach( allTargets,
t =>
@@ -203,22 +217,31 @@ namespace Rokojori
var end = start + duration;
+
animationID = TimeLineManager.ScheduleSpanIn( timeline, 0, duration,
( TimeLineSpan span, TimeLineSpanUpdateType type )=>
- {
+ {
+
+ // debugProcessIndicator.Position = debugProcessIndicatorFull * span.phase;
if ( animationID != span.id )
{
return;
}
- var phase = span.phase;
- var value = flashCurve.Sample( phase );
+ // debugProcessIndicator.Position = debugProcessIndicatorFull * span.phase;
+ var phase = span.phase;
+
+
+ var value = flashCurve.Sample( phase );
+
var phaseColor = color;
phaseColor.A = value * initialAlpha;
+ // debugMaterial.AlbedoColor = phaseColor;
+
if ( light != null )
{
light.LightEnergy = value * flashEffect.lightFlashCurveScale;
@@ -270,8 +293,10 @@ namespace Rokojori
CancelAction( actionID );
DispatchEnd( actionID );
}
+
- }
+ },
+ this
).id;
@@ -298,7 +323,7 @@ namespace Rokojori
void RemoveMaterials()
{
- if ( _materials.Count != allTargets.Length )
+ if ( _materials == null || allTargets == null || _materials.Count != allTargets.Length )
{
return;
}
diff --git a/Runtime/Animation/Flash/Presets/Blue Shield - Flash.tres b/Runtime/Animation/Flash/Presets/Blue Shield - Flash.tres
index abf47de..66b08b1 100644
--- a/Runtime/Animation/Flash/Presets/Blue Shield - Flash.tres
+++ b/Runtime/Animation/Flash/Presets/Blue Shield - Flash.tres
@@ -8,9 +8,7 @@
[sub_resource type="Resource" id="Resource_54hj8"]
script = ExtResource("1_ejko8")
color = Color(0.151445, 0.275065, 1, 1)
-colorMultiply = 1.0
rgbMultiply = 3.0
-alphaMultiply = 1.0
[sub_resource type="Curve" id="Curve_tp3r5"]
_data = [Vector2(0, 0), 0.0, -0.249925, 0, 0, Vector2(0.0955632, 0.982574), -2.27942, -2.27942, 0, 0, Vector2(0.238908, 0.442359), -1.89107, -1.89107, 0, 0, Vector2(0.982935, 0.00670242), -0.229111, 0.0, 0, 0]
@@ -18,13 +16,7 @@ point_count = 4
[sub_resource type="Resource" id="Resource_pwp07"]
script = ExtResource("2_3i2og")
-duration = 1.0
-durationRandomRange = 0.0
-delay = 0.0
-delayRandomRange = 0.0
curve = SubResource("Curve_tp3r5")
-scaleY = 1.0
-scaleRandomRange = 0.0
[resource]
script = ExtResource("3_65ipm")
diff --git a/Runtime/Animation/Flash/Presets/Green Charge - Flash.tres b/Runtime/Animation/Flash/Presets/Green Charge - Flash.tres
index 6c207db..43b057f 100644
--- a/Runtime/Animation/Flash/Presets/Green Charge - Flash.tres
+++ b/Runtime/Animation/Flash/Presets/Green Charge - Flash.tres
@@ -8,9 +8,7 @@
[sub_resource type="Resource" id="Resource_54hj8"]
script = ExtResource("1_yrhv1")
color = Color(0, 1, 0.306108, 1)
-colorMultiply = 1.0
rgbMultiply = 2.0
-alphaMultiply = 1.0
[sub_resource type="Curve" id="Curve_tp3r5"]
_data = [Vector2(0, 0), 0.0, 0.441476, 0, 0, Vector2(0.0957096, 0.959975), -1.01521, -1.01521, 0, 0, Vector2(0.9967, 0.0283505), -0.240285, 0.0, 0, 0]
@@ -19,12 +17,7 @@ point_count = 3
[sub_resource type="Resource" id="Resource_pwp07"]
script = ExtResource("2_cdv3p")
duration = 0.6
-durationRandomRange = 0.0
-delay = 0.0
-delayRandomRange = 0.0
curve = SubResource("Curve_tp3r5")
-scaleY = 1.0
-scaleRandomRange = 0.0
[resource]
script = ExtResource("3_87ql1")
@@ -33,6 +26,5 @@ timeline = ExtResource("4_2na64")
color = SubResource("Resource_54hj8")
lightMode = 1
lightRange = 5.0
-lightFlashCurveScale = 2.0
lightHasShadows = true
materialMode = 2
diff --git a/Runtime/Animation/Flash/Presets/Red Hit - Flash.tres b/Runtime/Animation/Flash/Presets/Red Hit - Flash.tres
index 8269328..a99f1ff 100644
--- a/Runtime/Animation/Flash/Presets/Red Hit - Flash.tres
+++ b/Runtime/Animation/Flash/Presets/Red Hit - Flash.tres
@@ -7,10 +7,8 @@
[sub_resource type="Resource" id="Resource_54hj8"]
script = ExtResource("1_nmdum")
-color = Color(0.859799, 0.542989, 0.696896, 1)
-colorMultiply = 4.0
-rgbMultiply = 1.0
-alphaMultiply = 1.0
+color = Color(0.86, 0.12426996, 0.1118, 0.5254902)
+colorMultiply = 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]
@@ -18,21 +16,11 @@ point_count = 2
[sub_resource type="Resource" id="Resource_pwp07"]
script = ExtResource("2_0sgd7")
-duration = 0.5
-durationRandomRange = 0.0
-delay = 0.0
-delayRandomRange = 0.0
+duration = 0.3
curve = SubResource("Curve_tp3r5")
-scaleY = 1.0
-scaleRandomRange = 0.0
[resource]
script = ExtResource("3_7qcuh")
flashCurve = SubResource("Resource_pwp07")
timeline = ExtResource("4_rkq1j")
color = SubResource("Resource_54hj8")
-lightMode = 0
-lightRange = 2.0
-lightFlashCurveScale = 2.0
-lightHasShadows = false
-materialMode = 0
diff --git a/Runtime/Animation/Flash/Presets/White Blinking - Flash.tres b/Runtime/Animation/Flash/Presets/White Blinking - Flash.tres
index 145451a..6392dad 100644
--- a/Runtime/Animation/Flash/Presets/White Blinking - Flash.tres
+++ b/Runtime/Animation/Flash/Presets/White Blinking - Flash.tres
@@ -8,9 +8,7 @@
[sub_resource type="Resource" id="Resource_ny3sx"]
script = ExtResource("1_pp4qy")
color = Color(1, 1, 1, 1)
-colorMultiply = 1.0
rgbMultiply = 2.0
-alphaMultiply = 1.0
[sub_resource type="Curve" id="Curve_nqaq6"]
_data = [Vector2(0, 1), 0.0, 0.0775112, 0, 0, Vector2(0.0779661, 0), 0.0, 0.0, 0, 0, Vector2(0.227119, 0), 0.113556, 0.113556, 0, 0, Vector2(0.244068, 0.913564), 0.0, 0.0, 0, 0, Vector2(0.308475, 0), 0.0, 0.0, 0, 0, Vector2(0.505085, 0), 0.0, 0.0, 0, 0, Vector2(0.518644, 0.697473), 0.0, 0.0, 0, 0, Vector2(0.60339, 0), 0.0, 0.0, 0, 0, Vector2(0.742794, 0), 0.0, 0.0, 0, 0, Vector2(0.749153, 0.438165), 0.0, 0.0, 0, 0, Vector2(0.80678, 0), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0442571, 0.0, 0, 0]
@@ -19,20 +17,10 @@ point_count = 12
[sub_resource type="Resource" id="Resource_pwp07"]
script = ExtResource("2_f6f0o")
duration = 0.7
-durationRandomRange = 0.0
-delay = 0.0
-delayRandomRange = 0.0
curve = SubResource("Curve_nqaq6")
-scaleY = 1.0
-scaleRandomRange = 0.0
[resource]
script = ExtResource("3_dq1j1")
flashCurve = SubResource("Resource_pwp07")
timeline = ExtResource("4_d6hj6")
color = SubResource("Resource_ny3sx")
-lightMode = 0
-lightRange = 2.0
-lightFlashCurveScale = 2.0
-lightHasShadows = false
-materialMode = 0
diff --git a/Runtime/Animation/Highlight/Presets/White Outline - Highlight.tres b/Runtime/Animation/Highlight/Presets/White Outline - Highlight.tres
index f057526..2469c31 100644
--- a/Runtime/Animation/Highlight/Presets/White Outline - Highlight.tres
+++ b/Runtime/Animation/Highlight/Presets/White Outline - Highlight.tres
@@ -7,9 +7,6 @@
[sub_resource type="Resource" id="Resource_27v41"]
script = ExtResource("1_sk831")
color = Color(1, 1, 1, 1)
-colorMultiply = 1.0
-rgbMultiply = 1.0
-alphaMultiply = 1.0
[sub_resource type="Curve" id="Curve_idts4"]
_data = [Vector2(0, 0), 0.0, 1.0, 0, 1, Vector2(1, 1), 1.0, 0.0, 1, 0]
@@ -29,7 +26,4 @@ outCurve = SubResource("Curve_q8jgr")
color = SubResource("Resource_27v41")
opacityModulationStrength = 0.75
opacityModulationDuration = 1.0
-opacityModulationTransition = 1.0
-outlineMaterialMode = 0
overlayOpacity = 0.1
-overlayMaterialMode = 0
diff --git a/Runtime/Animation/Rotate.cs b/Runtime/Animation/Rotate.cs
index b6e7b32..67956f3 100644
--- a/Runtime/Animation/Rotate.cs
+++ b/Runtime/Animation/Rotate.cs
@@ -27,7 +27,7 @@ namespace Rokojori
}
var tl = TimeLineManager.Ensure( timeline );
- var rotation = target.GetGlobalQuaternion() * Quaternion.FromEuler( eulerRotation * (float)tl.delta );
+ var rotation = target.GlobalQuaternion() * Quaternion.FromEuler( eulerRotation * (float)tl.delta );
target.SetGlobalQuaternion( rotation );
}
}
diff --git a/Runtime/Animation/Shake/Presets/Small Impact Low FPS - Shake.tres b/Runtime/Animation/Shake/Presets/Small Impact Low FPS - Shake.tres
index e8dd68e..e06554b 100644
--- a/Runtime/Animation/Shake/Presets/Small Impact Low FPS - Shake.tres
+++ b/Runtime/Animation/Shake/Presets/Small Impact Low FPS - Shake.tres
@@ -2,7 +2,7 @@
[ext_resource type="Script" uid="uid://bec6skfqkb2ci" path="res://addons/rokojori_action_library/Runtime/Animation/Shake/ShakeEffect.cs" id="1_68es8"]
[ext_resource type="Script" uid="uid://c5tm02yj1bhhx" path="res://addons/rokojori_action_library/Runtime/Animation/AnimationCurve.cs" id="2_wfmv2"]
-[ext_resource type="Resource" uid="uid://h6oi6vkj4c2m" path="res://addons/rokojori_action_library/Runtime/Time/TimeLines/RealTime.tres" id="3_h08aw"]
+[ext_resource type="Resource" uid="uid://ch5nsa6yafs5l" path="res://addons/rokojori_action_library/Runtime/Time/TimeLines/GameTime.tres" id="3_udbmo"]
[sub_resource type="Curve" id="Curve_j2uji"]
_data = [Vector2(0, 1), 0.0, 0.0355988, 0, 0, Vector2(1, 0), -0.101636, 0.0, 0, 0]
@@ -11,12 +11,7 @@ point_count = 2
[sub_resource type="Resource" id="Resource_jwnpm"]
script = ExtResource("2_wfmv2")
duration = 0.4
-durationRandomRange = 0.0
-delay = 0.0
-delayRandomRange = 0.0
curve = SubResource("Curve_j2uji")
-scaleY = 1.0
-scaleRandomRange = 0.0
[sub_resource type="Curve" id="Curve_b6b7u"]
_data = [Vector2(0, 0.368339), 0.0, 3.25035, 0, 0, Vector2(0.264591, 0.73511), 0.0, 0.0, 0, 0, Vector2(1, 0.266458), -0.637268, 0.0, 1, 0]
@@ -25,24 +20,17 @@ point_count = 3
[sub_resource type="Resource" id="Resource_1s2e6"]
script = ExtResource("2_wfmv2")
duration = 0.5
-durationRandomRange = 0.0
-delay = 0.0
-delayRandomRange = 0.0
curve = SubResource("Curve_b6b7u")
scaleY = 30.0
-scaleRandomRange = 0.0
[resource]
script = ExtResource("1_68es8")
shakeAmountCurve = SubResource("Resource_jwnpm")
shakeChangeFPSCurve = SubResource("Resource_1s2e6")
-timeline = ExtResource("3_h08aw")
-smooth = true
+timeline = ExtResource("3_udbmo")
smoothingStrength = 0.325
positionShake = Vector3(0.075, 0, 0.075)
globalPosition = false
-repeatAndFlipFirstPosition = true
rotationShake = Vector3(1, 1, 20)
globalRotation = false
scaleShake = Vector3(0.25, 0.25, 0.05)
-scaleShakeIsRelative = true
diff --git a/Runtime/Animation/Shake/Shake.cs b/Runtime/Animation/Shake/Shake.cs
index 0f74474..9082fad 100644
--- a/Runtime/Animation/Shake/Shake.cs
+++ b/Runtime/Animation/Shake/Shake.cs
@@ -179,7 +179,8 @@ namespace Rokojori
}
lastKeyFrame = keyFrame;
- }
+ },
+ this
).id;
}
diff --git a/Runtime/Animation/Transform/AnimateTransform.cs b/Runtime/Animation/Transform/AnimateTransform.cs
index 2110131..30cde6e 100644
--- a/Runtime/Animation/Transform/AnimateTransform.cs
+++ b/Runtime/Animation/Transform/AnimateTransform.cs
@@ -101,7 +101,8 @@ namespace Rokojori
DispatchEnd( actionID );
_running = false;
}
- }
+ },
+ this
);
diff --git a/Runtime/Animation/Wipe/TextureWipeEffect.cs b/Runtime/Animation/Wipe/TextureWipeEffect.cs
index ca1e7fd..2d6a4f7 100644
--- a/Runtime/Animation/Wipe/TextureWipeEffect.cs
+++ b/Runtime/Animation/Wipe/TextureWipeEffect.cs
@@ -38,7 +38,7 @@ namespace Rokojori
public Vector2 scaleCenter = new Vector2( 0.5f, 0.5f );
- public static readonly Texture2DPropertyName _wipeTextureProperty = Texture2DPropertyName.Create( "wipeTexture" );
+ public static readonly Sampler2DPropertyName _wipeTextureProperty = Sampler2DPropertyName.Create( "wipeTexture" );
public static readonly Vector2PropertyName _outputViewSizeProperty = Vector2PropertyName.Create( "outputViewSize" );
public static readonly Vector2PropertyName _wipeTextureSizeProperty = Vector2PropertyName.Create( "wipeTextureSize" );
public static readonly Vector2PropertyName _uvRotationCenterProperty = Vector2PropertyName.Create( "uvRotationCenter" );
diff --git a/Runtime/Audio/AudioManager/AudioFlag.cs b/Runtime/Audio/AudioManager/AudioFlag.cs
new file mode 100644
index 0000000..9b59aee
--- /dev/null
+++ b/Runtime/Audio/AudioManager/AudioFlag.cs
@@ -0,0 +1,12 @@
+using Godot;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Rokojori
+{
+ [GlobalClass,Tool, Icon("res://addons/rokojori_action_library/Icons/SelecorFlag.svg") ]
+ public partial class AudioFlag:SelectorFlag
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Audio/AudioManager/AudioFlag.cs.uid b/Runtime/Audio/AudioManager/AudioFlag.cs.uid
new file mode 100644
index 0000000..48f3d0c
--- /dev/null
+++ b/Runtime/Audio/AudioManager/AudioFlag.cs.uid
@@ -0,0 +1 @@
+uid://cwsdhnenhdly4
diff --git a/Runtime/Audio/AudioManager/AudioManager.cs b/Runtime/Audio/AudioManager/AudioManager.cs
index 9088ced..4c62ff0 100644
--- a/Runtime/Audio/AudioManager/AudioManager.cs
+++ b/Runtime/Audio/AudioManager/AudioManager.cs
@@ -8,11 +8,11 @@ namespace Rokojori
public partial class AudioManager:Node
{
[Export]
- public AudioManagerData data;
+ public AudioManagerData data = new AudioManagerData();
- Dictionary _lastPlayTime = new Dictionary();
+ Dictionary _lastPlayTime = new Dictionary();
- public float GetLastPlayed( SelectorFlag selectorFlag )
+ public float GetLastPlayed( AudioFlag selectorFlag )
{
if ( ! _lastPlayTime.ContainsKey( selectorFlag ) )
{
@@ -22,12 +22,12 @@ namespace Rokojori
return _lastPlayTime[ selectorFlag ];
}
- public void RecordSoundPlaying( SelectorFlag selectorFlag )
+ public void RecordSoundPlaying( AudioFlag selectorFlag )
{
_lastPlayTime[ selectorFlag ] = TimeLine.osTime;
}
- public bool CanPlay( SelectorFlag selectorFlag, float blockDuration )
+ public bool CanPlay( AudioFlag selectorFlag, float blockDuration )
{
if ( ! _lastPlayTime.ContainsKey( selectorFlag ) )
{
diff --git a/Runtime/Cameras/CameraManager.cs b/Runtime/Cameras/CameraManager.cs
index 3eb314a..6c7aad7 100644
--- a/Runtime/Cameras/CameraManager.cs
+++ b/Runtime/Cameras/CameraManager.cs
@@ -102,6 +102,12 @@ namespace Rokojori
if ( Sensors.IsDown( debugCameraToggle ) )
{
debugCameraActive = ! debugCameraActive;
+
+ if ( debugCameraActive )
+ {
+ Input.MouseMode = Input.MouseModeEnum.Visible;
+ }
+
this.LogInfo( debugCameraActive );
}
diff --git a/Runtime/Cameras/CameraTypes/FollowCamera/FollowCamera3D.cs b/Runtime/Cameras/CameraTypes/FollowCamera/FollowCamera3D.cs
index 10defbf..758f24e 100644
--- a/Runtime/Cameras/CameraTypes/FollowCamera/FollowCamera3D.cs
+++ b/Runtime/Cameras/CameraTypes/FollowCamera/FollowCamera3D.cs
@@ -49,9 +49,9 @@ namespace Rokojori
void Rotate( float delta )
{
- var currentRotation = Math3D.GetGlobalQuaternion( this );
+ var currentRotation = this.GlobalQuaternion();
LookAt( target.GlobalPosition, Vector3.Up, true );
- var nextRotation = Math3D.GetGlobalQuaternion( this );
+ var nextRotation = this.GlobalQuaternion();
var smoothedRotation = smoother.SmoothWithCoefficient( currentRotation, nextRotation, rotationSmoothingCoefficient, delta );
diff --git a/Runtime/Cameras/CameraTypes/StrategyTopDownCamera/StrategyTopDownCamera.cs b/Runtime/Cameras/CameraTypes/StrategyTopDownCamera/StrategyTopDownCamera.cs
index 9e31aae..9446cf2 100644
--- a/Runtime/Cameras/CameraTypes/StrategyTopDownCamera/StrategyTopDownCamera.cs
+++ b/Runtime/Cameras/CameraTypes/StrategyTopDownCamera/StrategyTopDownCamera.cs
@@ -278,7 +278,7 @@ namespace Rokojori
smoothDistance = smoother.SmoothWithCoefficient( smoothDistance, distance, zoomSmoothingCoefficient, delta );
GlobalRotation = new Vector3( Mathf.DegToRad( pitch ), Mathf.DegToRad( yaw ), 0 );
- var forward = Math3D.GetGlobalForward( this ) * smoothDistance;
+ var forward = this.GlobalForward() * smoothDistance;
// this.LogInfo( forward, smoothDistance );
GlobalPosition = target + forward;
diff --git a/Runtime/Cameras/CameraTypes/ThirdPersonCamera/ThirdPersonCamera.cs b/Runtime/Cameras/CameraTypes/ThirdPersonCamera/ThirdPersonCamera.cs
index c68a19d..8fe25f0 100644
--- a/Runtime/Cameras/CameraTypes/ThirdPersonCamera/ThirdPersonCamera.cs
+++ b/Runtime/Cameras/CameraTypes/ThirdPersonCamera/ThirdPersonCamera.cs
@@ -16,225 +16,62 @@ namespace Rokojori
public Node3D target;
[Export]
- public Smoothing targetFollowSmoothing = new FrameSmoothing();
-
- [ExportGroup("Yaw")]
-
- [Export]
- public float yawSpeed;
+ public float yaw;
[Export]
- public Sensor yawPositiveAxis;
+ public float pitch;
[Export]
- public Sensor yawNegativeAxis;
-
- [Export]
- public bool roundYaw = false;
-
- [Export]
- public int roundedYawResolution = 64;
-
- [Export]
- public float yaw = 0;
-
- [Export]
- public Smoothing yawSmoothing = new FrameSmoothing();
-
- [Export]
- public bool yawGoesBehindPlayer = false;
-
- [Export]
- public Smoothing yawToBehingSmoothing = new FrameSmoothing();
-
- [Export]
- public float yawBehindDelayDuration = 5;
-
- [Export]
- public float yawGoesBehindActivation = 0.1f;
-
- [Export]
- public float behindYaw = 0;
-
- [Export]
- public float currentYaw = 0;
-
- [Export]
- public float bcDelta = 0;
-
-
- [ExportGroup("Pitch")]
-
- [Export]
- public float pitchSpeed;
-
- [Export]
- public Sensor pitchPositiveAxis;
-
- [Export]
- public Sensor pitchNegativeAxis;
-
- [Export]
- public bool pitchIsRelative = false;
-
- [Export]
- public float pitch = 0;
-
- [Export]
- public float minPitch = -10;
-
- [Export]
- public float maxPitch = 80;
-
- public float normalizedPitch => MathX.NormalizeClamped( pitch, minPitch, maxPitch );
-
- [Export]
- public Smoothing pitchSmoothing = new FrameSmoothing();
-
- [Export]
- public bool pitchGoesBackToCenter = true;
-
- [Export]
- public Smoothing toCenterPitchSmoothing = new FrameSmoothing();
-
- [Export]
- public float centerPitchDelayDuration = 5;
-
- [Export]
- public float centerPitch = 30;
-
- [Export]
- public float centerPitchActivation = 0.1f;
-
- [ExportGroup("Distance")]
- [Export]
- public Curve distanceForPitch = MathX.Curve( 1, 1 );
-
- [Export]
- public float distanceScale = 1;
-
- [ExportGroup("Camera Offset")]
- [Export]
- public Vector3 offset;
-
-
- float smoothedYaw = 0;
- float smoothedPitch = 0;
- float smoothedDistance = 0;
-
- float _centerPitchActivation = 0;
- float _yawBehindActivation = 0;
+ public ThirdPersonCameraSettings settings;
public override void _Process( double delta )
{
+ if ( Engine.IsEditorHint() )
+ {
+ return;
+ }
+
if ( target == null )
{
return;
}
- behindYaw = Math3D.GlobalYawDegrees( target.GlobalForward() * -1 );
- behindYaw = MathX.NormalizeAngle( behindYaw );
- currentYaw = MathX.NormalizeAngle( yaw );
+ var data = settings.GetActiveDeviceData();
- bcDelta = MathX.NormalizeAngle( MathX.AngleDelta( behindYaw, currentYaw ) );
-
- var targetPosition = Smoothing.Apply( targetFollowSmoothing, target.GlobalPosition, (float) delta );
+ var targetPosition = Smoothing.Apply( settings.targetFollowSmoothing, target.GlobalPosition, (float) delta );
- var yawAxis = Sensors.PolarAxis( yawNegativeAxis, yawPositiveAxis );
- var pitchAxis = Sensors.PolarAxis( pitchNegativeAxis, pitchPositiveAxis );
+ var yawAxis = Sensors.PolarPowerAxis( data.yawNegativeAxis, data.yawPositiveAxis, 1f, data.yawDeadZone, data.yawPower );
+ var pitchAxis = Sensors.PolarPowerAxis( data.pitchNegativeAxis, data.pitchPositiveAxis, 1f, data.pitchDeadZone, data.pitchPower );
+ // this.LogInfo( "YAW:", yawAxis, "PITCH:", pitchAxis );
+ yaw += yawAxis * settings.yawSpeed * data.yawSpeed * (float)delta;
- yaw += yawAxis * yawSpeed * (float)delta;
- if ( yawGoesBehindPlayer )
+ if ( data.pitchIsRelative )
{
- if ( Mathf.Abs( yawAxis ) < yawGoesBehindActivation )
- {
- _yawBehindActivation += (float)delta;
-
- if ( yawGoesBehindPlayer && _yawBehindActivation > yawBehindDelayDuration )
- {
- yaw = Smoothing.ApplyDegreesWith( yawToBehingSmoothing, yaw, behindYaw, (float) delta );
- }
-
- }
- else
- {
- _yawBehindActivation = 0;
- }
- }
-
- // yaw = MathX.Repeat( yaw, 360f );
-
- if ( pitchIsRelative )
- {
- pitch += pitchAxis * pitchSpeed * (float)delta;
- pitch = Mathf.Clamp( pitch, minPitch, maxPitch );
-
- if ( Mathf.Abs( pitchAxis ) < centerPitchActivation )
- {
- _centerPitchActivation += (float)delta;
-
- if ( _centerPitchActivation > centerPitchDelayDuration )
- {
- pitch = Smoothing.ApplyWith( toCenterPitchSmoothing, pitch, centerPitch, (float) delta );
- }
- }
- else
- {
- _centerPitchActivation = 0;
- }
+ pitch += pitchAxis * settings.relativePitchSpeed * data.relativePitchSpeed * (float)delta;
+ pitch = Mathf.Clamp( pitch, settings.minPitch, settings.maxPitch );
}
else
{
- pitch = Mathf.Remap( pitchAxis, -1, 1, minPitch, maxPitch );
+ pitch = Mathf.Remap( pitchAxis, -1, 1, settings.minPitch, settings.maxPitch );
}
-
-
- // if ( Mathf.Abs( yaw - smoothedYaw ) > 180 )
- // {
- // if ( yaw > smoothedYaw )
- // {
- // smoothedYaw += 360;
- // }
- // else if ( yaw < smoothedYaw )
- // {
- // smoothedYaw -= 360;
- // }
- // }
-
var appliedYaw = yaw;
- // if ( roundYaw )
- // {
- // appliedYaw = MathX.SnapRounded( yaw, 360f/roundedYawResolution );
- // }
+ var smoothedYaw = Smoothing.ApplyDegrees( settings.yawSmoothing, appliedYaw, (float) delta );
- smoothedYaw = Smoothing.ApplyDegrees( yawSmoothing, appliedYaw, (float) delta );
+ var smoothedPitch = Smoothing.Apply( settings.pitchSmoothing, pitch, (float) delta );
-
- smoothedPitch = Smoothing.Apply( pitchSmoothing, pitch, (float) delta );
-
- // if ( pitchGoesBackToCenter )
- // {
- // pitch = toCenterPitchSmoothing.Smooth( centerPitch, (float) delta );
- // }
-
-
- // RJLog.Log( "Pitch", smoothedPitch );
-
- // smoothedYaw = yaw;
- // smoothedPitch = pitch;
- var distance = distanceForPitch.Sample( MathX.NormalizeClamped( pitch, minPitch, maxPitch ) ) * distanceScale;
+ var distance = settings.distanceForPitch.Sample( MathX.NormalizeClamped( pitch, settings.minPitch, settings.maxPitch ) ) * settings.distanceScale;
GlobalPosition = targetPosition + Math3D.YawPitchRotation( smoothedYaw, smoothedPitch ) * Vector3.Forward * distance;
LookAt( targetPosition, Vector3.Up, true );
- GlobalPosition += this.GetOrientationBasedGlobalOffset( offset );
+ GlobalPosition += this.GetOrientationBasedGlobalOffset( settings.offset );
}
diff --git a/Runtime/Cameras/CameraTypes/ThirdPersonCamera/ThirdPersonCameraData.cs b/Runtime/Cameras/CameraTypes/ThirdPersonCamera/ThirdPersonCameraData.cs
new file mode 100644
index 0000000..4a07fb9
--- /dev/null
+++ b/Runtime/Cameras/CameraTypes/ThirdPersonCamera/ThirdPersonCameraData.cs
@@ -0,0 +1,56 @@
+
+using Godot;
+using System.Collections.Generic;
+
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass,Icon("res://addons/rokojori_action_library/Icons/SensorGroup.svg")]
+ public partial class ThirdPersonCameraData: Resource
+ {
+ [Export]
+ public SensorDeviceSelector deviceSelector;
+
+ [ExportGroup("Yaw")]
+
+ [Export]
+ public float yawSpeed = 1.0f;
+
+ [Export]
+ public Sensor yawPositiveAxis;
+
+ [Export]
+ public Sensor yawNegativeAxis;
+
+ [Export]
+ public float yawDeadZone = 0.1f;
+
+
+ [Export]
+ public float yawPower = 1.5f;
+
+
+
+ [ExportGroup("Pitch")]
+
+ [Export]
+ public float relativePitchSpeed = 1.0f;
+
+ [Export]
+ public Sensor pitchPositiveAxis;
+
+ [Export]
+ public Sensor pitchNegativeAxis;
+
+ [Export]
+ public float pitchDeadZone = 0.1f;
+
+ [Export]
+ public float pitchPower = 1.5f;
+
+ [Export]
+ public bool pitchIsRelative = true;
+
+
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Cameras/CameraTypes/ThirdPersonCamera/ThirdPersonCameraData.cs.uid b/Runtime/Cameras/CameraTypes/ThirdPersonCamera/ThirdPersonCameraData.cs.uid
new file mode 100644
index 0000000..ecf9cbe
--- /dev/null
+++ b/Runtime/Cameras/CameraTypes/ThirdPersonCamera/ThirdPersonCameraData.cs.uid
@@ -0,0 +1 @@
+uid://8b4s4nw4heif
diff --git a/Runtime/Cameras/CameraTypes/ThirdPersonCamera/ThirdPersonCameraSettings.cs b/Runtime/Cameras/CameraTypes/ThirdPersonCamera/ThirdPersonCameraSettings.cs
new file mode 100644
index 0000000..b3fcfa2
--- /dev/null
+++ b/Runtime/Cameras/CameraTypes/ThirdPersonCamera/ThirdPersonCameraSettings.cs
@@ -0,0 +1,65 @@
+
+using Godot;
+using System.Collections.Generic;
+
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass,Icon("res://addons/rokojori_action_library/Icons/SensorGroup.svg")]
+ public partial class ThirdPersonCameraSettings: Resource
+ {
+ [Export]
+ public Smoothing targetFollowSmoothing = new FrameSmoothing();
+
+ [Export]
+ public Vector3 offset = Vector3.Zero;
+
+ [Export]
+ public Smoothing yawSmoothing = new FrameSmoothing();
+
+ [Export]
+ public Smoothing pitchSmoothing = new FrameSmoothing();
+
+ [Export]
+ public ThirdPersonCameraData[] deviceData = [];
+
+ [ExportGroup("Yaw")]
+ [Export]
+ public float yawSpeed = 1;
+
+ [ExportGroup("Pitch")]
+ [Export]
+ public float relativePitchSpeed = 1;
+
+ [Export]
+ public float minPitch = -10;
+
+ [Export]
+ public float maxPitch = 80;
+
+
+ [ExportGroup("Distance")]
+ [Export]
+ public Curve distanceForPitch = MathX.Curve( 1, 1 );
+
+ [Export]
+ public float distanceScale = 1;
+
+
+ public float GetNormalizedPitch( float pitch )
+ {
+ return MathX.Normalize( pitch, minPitch, maxPitch );
+ }
+
+ public ThirdPersonCameraData GetActiveDeviceData()
+ {
+ var sm = Unique.Get();
+
+ var lastActive = sm.lastActiveDevice;
+
+ var lastActiveData = deviceData.FindNonNull( d => d.deviceSelector.Selects( lastActive ) );
+
+ return lastActiveData != null ? lastActiveData : deviceData[ 0 ];
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Cameras/CameraTypes/ThirdPersonCamera/ThirdPersonCameraSettings.cs.uid b/Runtime/Cameras/CameraTypes/ThirdPersonCamera/ThirdPersonCameraSettings.cs.uid
new file mode 100644
index 0000000..80e7c40
--- /dev/null
+++ b/Runtime/Cameras/CameraTypes/ThirdPersonCamera/ThirdPersonCameraSettings.cs.uid
@@ -0,0 +1 @@
+uid://cguitqskambdb
diff --git a/Runtime/Cameras/CameraTypes/ThirdPersonCamera/ThirdPersonCameraTargetOffset.cs b/Runtime/Cameras/CameraTypes/ThirdPersonCamera/ThirdPersonCameraTargetOffset.cs
index 6fa7d57..28fadf5 100644
--- a/Runtime/Cameras/CameraTypes/ThirdPersonCamera/ThirdPersonCameraTargetOffset.cs
+++ b/Runtime/Cameras/CameraTypes/ThirdPersonCamera/ThirdPersonCameraTargetOffset.cs
@@ -24,7 +24,7 @@ namespace Rokojori
{
if ( pitchMultiply != null && thirdPersonCamera != null )
{
- var normalizedPitch = thirdPersonCamera.normalizedPitch;
+ var normalizedPitch = thirdPersonCamera.settings.GetNormalizedPitch( thirdPersonCamera.pitch );
var sampledPitchMultiply = pitchMultiply.Sample( normalizedPitch );
movingForward *= sampledPitchMultiply;
}
diff --git a/Runtime/Cameras/EditorCamera/EditorCamera.cs b/Runtime/Cameras/EditorCamera/EditorCamera.cs
index 082f589..2ed23f7 100644
--- a/Runtime/Cameras/EditorCamera/EditorCamera.cs
+++ b/Runtime/Cameras/EditorCamera/EditorCamera.cs
@@ -138,7 +138,7 @@ namespace Rokojori
_smoothDistance = Smoothing.Apply( zoomSmoothing, distance, delta );
GlobalRotation = new Vector3( Mathf.DegToRad( pitch ), Mathf.DegToRad( yaw ), 0 );
- var forward = Math3D.GetGlobalForward( this ) * _smoothDistance;
+ var forward = this.GlobalForward() * _smoothDistance;
target -= moveDirection * delta;
GlobalPosition = target + forward;
}
diff --git a/Runtime/Cameras/PostProcess/PostProcessVolume.cs b/Runtime/Cameras/PostProcess/PostProcessVolume.cs
index 03c1b11..95ea673 100644
--- a/Runtime/Cameras/PostProcess/PostProcessVolume.cs
+++ b/Runtime/Cameras/PostProcess/PostProcessVolume.cs
@@ -62,7 +62,7 @@ namespace Rokojori
#endif
- d = camera.GlobalDistanceTo( n3 );
+ d = camera.DistanceTo( n3 );
}
fd.SetCenterDistance( d );
diff --git a/Runtime/Colors/ColorX.cs b/Runtime/Colors/ColorX.cs
index ee80797..513c99c 100644
--- a/Runtime/Colors/ColorX.cs
+++ b/Runtime/Colors/ColorX.cs
@@ -5,6 +5,16 @@ namespace Rokojori
{
public static class ColorX
{
+ public static float r( this Vector4 rgba )
+ {
+ return rgba.X;
+ }
+
+ public static Vector3 rgb( this Vector4 rgba )
+ {
+ return new Vector3( rgba.X, rgba.Y, rgba.Z );
+ }
+
public static float GetChannel( this Color color, ColorChannelType colorChannelType )
{
if ( ColorChannelType.Red == colorChannelType )
@@ -243,54 +253,7 @@ namespace Rokojori
{
return new Color( vec.X, vec.Y, b, alpha);
}
-
- public enum EdgeMode
- {
- Clamp,
- Repeat,
- TransparentBlack,
- }
-
-
- public static Color GetPixel( this Image image, int x, int y, EdgeMode mode )
- {
- if ( x < 0 || y < 0 || x >= image.GetSize().X || y >= image.GetSize().Y )
- {
- if ( mode == EdgeMode.TransparentBlack )
- {
- return new Color( 0, 0, 0, 0 );
- }
-
- if ( mode == EdgeMode.Repeat )
- {
- x = MathX.Repeat( x, image.GetSize().X );
- y = MathX.Repeat( y, image.GetSize().Y );
- }
-
- if ( mode == EdgeMode.Clamp )
- {
- x = Mathf.Clamp( x, 0, image.GetSize().X );
- y = Mathf.Clamp( y, 0, image.GetSize().Y );
- }
- }
-
- return image.GetPixel( x, y );
- }
-
-
- public static Color Sample( this Image image, Vector2 uv, EdgeMode mode )
- {
- var pixelUV = uv * image.GetSize();
- var lowUV = pixelUV.FloorToInt().Max( 0 );
- var highUV = ( lowUV + Vector2I.One ).Min( image.GetSize() - Vector2I.One );
-
- var mix = pixelUV - lowUV;
-
- var xTop = Lerp( image.GetPixel( lowUV.X, lowUV.Y, mode ), image.GetPixel( highUV.X, lowUV.Y, mode ), mix.X );
- var xLow = Lerp( image.GetPixel( highUV.X, lowUV.Y, mode ), image.GetPixel( highUV.X, highUV.Y, mode ), mix.X );
-
- return Lerp( xTop, xLow, mix.Y );
- }
+
public static Color Blend( Color bottom, Color top )
{
diff --git a/Runtime/GDScript/Core/RJ_Action.gd b/Runtime/GDScript/Core/RJ_Action.gd
new file mode 100644
index 0000000..94b6ee3
--- /dev/null
+++ b/Runtime/GDScript/Core/RJ_Action.gd
@@ -0,0 +1,19 @@
+@tool
+@icon("res://addons/rokojori_action_library/Icons/RJ_Action.svg")
+@abstract class_name RJ_Action extends Node
+
+@export_tool_button( "Create Wrapper" )
+var createWrapperAction = _createWrapper;
+
+func _createWrapper() -> void:
+
+ var wrapperClass = load( "res://addons/rokojori_action_library/Runtime/Actions/GDScriptAction.cs" );
+ var wrapper = wrapperClass.new();
+ wrapper.WrapRJAction( self );
+
+##---
+
+func _onTrigger( node:GDScriptAction ) -> void:
+
+ pass
+##---
diff --git a/Runtime/GDScript/Core/RJ_Action.gd.uid b/Runtime/GDScript/Core/RJ_Action.gd.uid
new file mode 100644
index 0000000..bcda347
--- /dev/null
+++ b/Runtime/GDScript/Core/RJ_Action.gd.uid
@@ -0,0 +1 @@
+uid://bho0sb0lvooih
diff --git a/Runtime/GDScript/Core/RJ_SequenceAction.gd b/Runtime/GDScript/Core/RJ_SequenceAction.gd
new file mode 100644
index 0000000..cc9e979
--- /dev/null
+++ b/Runtime/GDScript/Core/RJ_SequenceAction.gd
@@ -0,0 +1,22 @@
+@tool
+@icon("res://addons/rokojori_action_library/Icons/RJ_SequenceAction.svg")
+@abstract class_name RJ_SequenceAction extends Node
+
+@export_tool_button( "Create Wrapper" )
+var createWrapperAction = _createWrapper
+
+
+func _createWrapper() -> void:
+
+ var wrapperClass = load( "res://addons/rokojori_action_library/Runtime/Actions/GDScriptSequenceAction.cs" )
+ var wrapper = wrapperClass.new();
+ wrapper.WrapRJSequenceAction( self );
+
+## ---
+
+
+func _onTrigger( node:GDScriptSequenceAction ) -> void:
+
+ pass
+
+## ---
diff --git a/Runtime/GDScript/Core/RJ_SequenceAction.gd.uid b/Runtime/GDScript/Core/RJ_SequenceAction.gd.uid
new file mode 100644
index 0000000..70a8d66
--- /dev/null
+++ b/Runtime/GDScript/Core/RJ_SequenceAction.gd.uid
@@ -0,0 +1 @@
+uid://biyqj5eggsnqh
diff --git a/Runtime/GDScript/GDScriptNames.cs b/Runtime/GDScript/GDScriptNames.cs
index 552246e..197caad 100644
--- a/Runtime/GDScript/GDScriptNames.cs
+++ b/Runtime/GDScript/GDScriptNames.cs
@@ -7,6 +7,72 @@ namespace Rokojori
{
public static class GDScriptNames
{
+ public static bool IsOrExtendsFrom( Node node, string className )
+ {
+ if ( node == null )
+ {
+ return false;
+ }
+
+ if ( node.IsClass( className ) )
+ {
+ return true;
+ }
+
+ var script = (Script) node.GetScript();
+
+ while ( script != null )
+ {
+ if ( ExtractClassName( script ) == className )
+ {
+ return true;
+ }
+
+ script = script.GetBaseScript();
+ }
+
+ return false;
+
+ }
+
+ public static string ExtractClassName( Script script )
+ {
+ if ( script != null )
+ {
+ var className = script.GetClass();
+
+ if ( className != "GDScript" )
+ {
+ if ( className == "CSharpScript" )
+ {
+ return null;
+ }
+
+ return className;
+ }
+
+
+
+ var scriptPath = script.ResourcePath;
+
+ className = System.IO.Path.GetFileNameWithoutExtension( scriptPath );
+ return className;
+ }
+
+ return "GDScript";
+ }
+
+ public static string ExtractClassName( Node node )
+ {
+ if ( node == null )
+ {
+ return null;
+ }
+
+ var script = (Script) node.GetScript();
+
+ return ExtractClassName( script );
+ }
public static string ToCS( string gdScriptName )
{
return gdScriptName.ToPascalCase();
diff --git a/Runtime/Godot/Editor/TransformChange.cs b/Runtime/Godot/Editor/TransformChange.cs
index fa50f39..2757d88 100644
--- a/Runtime/Godot/Editor/TransformChange.cs
+++ b/Runtime/Godot/Editor/TransformChange.cs
@@ -22,7 +22,7 @@ namespace Rokojori
}
- var sourceRotation = source.GetGlobalQuaternion();
+ var sourceRotation = source.GlobalQuaternion();
if ( rotation != sourceRotation )
{
diff --git a/Runtime/Godot/Extensions/BasisExtensions.cs b/Runtime/Godot/Extensions/BasisExtensions.cs
new file mode 100644
index 0000000..5731967
--- /dev/null
+++ b/Runtime/Godot/Extensions/BasisExtensions.cs
@@ -0,0 +1,15 @@
+using Godot;
+using System.Text;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Rokojori
+{
+ public static class BasisExtensions
+ {
+ public static bool IsValid( this Basis self )
+ {
+ return self.Row0.IsValid() && self.Row1.IsValid() && self.Row2.IsValid();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Godot/Extensions/BasisExtensions.cs.uid b/Runtime/Godot/Extensions/BasisExtensions.cs.uid
new file mode 100644
index 0000000..9094e80
--- /dev/null
+++ b/Runtime/Godot/Extensions/BasisExtensions.cs.uid
@@ -0,0 +1 @@
+uid://m7jq7d5if1rb
diff --git a/Runtime/Godot/Extensions/ImageExtensions.cs b/Runtime/Godot/Extensions/ImageExtensions.cs
new file mode 100644
index 0000000..464fd95
--- /dev/null
+++ b/Runtime/Godot/Extensions/ImageExtensions.cs
@@ -0,0 +1,62 @@
+using Godot;
+namespace Rokojori
+{
+ public static class ImageExtensions
+ {
+
+ public enum EdgeMode
+ {
+ Clamp,
+ Repeat,
+ TransparentBlack,
+ }
+
+
+ public static Color GetPixel( this Image image, int x, int y, EdgeMode mode )
+ {
+ if ( x < 0 || y < 0 || x >= image.GetSize().X || y >= image.GetSize().Y )
+ {
+ if ( mode == EdgeMode.TransparentBlack )
+ {
+ return new Color( 0, 0, 0, 0 );
+ }
+
+ if ( mode == EdgeMode.Repeat )
+ {
+ x = MathX.Repeat( x, image.GetSize().X );
+ y = MathX.Repeat( y, image.GetSize().Y );
+ }
+
+ if ( mode == EdgeMode.Clamp )
+ {
+ x = Mathf.Clamp( x, 0, image.GetSize().X );
+ y = Mathf.Clamp( y, 0, image.GetSize().Y );
+ }
+ }
+
+ return image.GetPixel( x, y );
+ }
+
+
+ public static Color SampleNearest( this Image image, Vector2 uv, EdgeMode mode = EdgeMode.Clamp )
+ {
+ var pixelUV = uv * image.GetSize();
+ var roundedPixelUV = pixelUV.RoundToInt();
+ return image.GetPixel( roundedPixelUV.X, roundedPixelUV.Y, mode );
+ }
+
+ public static Color SampleLinear( this Image image, Vector2 uv, EdgeMode mode = EdgeMode.Clamp )
+ {
+ var pixelUV = uv * image.GetSize();
+ var lowUV = pixelUV.FloorToInt().Max( 0 );
+ var highUV = ( lowUV + Vector2I.One ).Min( image.GetSize() - Vector2I.One );
+
+ var mix = pixelUV - lowUV;
+
+ var xTop = ColorX.Lerp( image.GetPixel( lowUV.X, lowUV.Y, mode ), image.GetPixel( highUV.X, lowUV.Y, mode ), mix.X );
+ var xLow = ColorX.Lerp( image.GetPixel( highUV.X, lowUV.Y, mode ), image.GetPixel( highUV.X, highUV.Y, mode ), mix.X );
+
+ return ColorX.Lerp( xTop, xLow, mix.Y );
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Godot/Extensions/ImageExtensions.cs.uid b/Runtime/Godot/Extensions/ImageExtensions.cs.uid
new file mode 100644
index 0000000..34a8953
--- /dev/null
+++ b/Runtime/Godot/Extensions/ImageExtensions.cs.uid
@@ -0,0 +1 @@
+uid://m8jyxhsvq1kp
diff --git a/Runtime/Godot/Extensions/Node3DExtensions.cs b/Runtime/Godot/Extensions/Node3DExtensions.cs
new file mode 100644
index 0000000..e613692
--- /dev/null
+++ b/Runtime/Godot/Extensions/Node3DExtensions.cs
@@ -0,0 +1,310 @@
+using Godot;
+using System.Text;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Rokojori
+{
+ public static class Node3DExtensions
+ {
+ public static Vector3 ToLocalFromLocal( this Node3D self, Node3D from, Vector3 fromLocalPosition )
+ {
+ var world = from.ToGlobal( fromLocalPosition );
+ return self.ToLocal( world );
+ }
+
+ public static Vector3 ToLocalFromLocalDirection( this Node3D self, Node3D from, Vector3 fromLocalDirection )
+ {
+ var world = from.ToGlobalDirection( fromLocalDirection );
+ return self.ToLocalDirection( world );
+ }
+
+ public static Vector3 ToLocalDirection( this Node3D self, Vector3 globalDirection )
+ {
+ return self.GlobalTransform.Basis.Inverse() * globalDirection;
+ }
+
+ public static Vector3 ToGlobalDirection( this Node3D self, Vector3 localDirection )
+ {
+ return self.GlobalTransform.Basis * localDirection;
+ }
+
+ public static void LookTowards( this Node3D self, Vector3 direction )
+ {
+ self.LookAt( direction + self.GlobalPosition );
+ }
+
+ public static float DistanceTo( this Node3D self, Node3D other )
+ {
+ return self.DirectionTowards( other ).Length();
+ }
+
+ public static Vector3 DirectionTowards( this Node3D self, Node3D other )
+ {
+ return ( other.GlobalPosition - self.GlobalPosition );
+ }
+
+ public static Vector3 DirectionTowards( this Node3D self, Vector3 other )
+ {
+ return ( other - self.GlobalPosition );
+ }
+
+ public static bool IsInRange( this Node3D a, Node3D other, float distance )
+ {
+ return a.DistanceTo( other ) <= distance;
+ }
+
+ public static Vector3 GetLocalOrGlobalPosition( this Node3D node, bool global )
+ {
+ return global ? node.GlobalPosition : node.Position;
+ }
+
+ public static void SetLocalOrGlobalPosition( this Node3D node, Vector3 position, bool global )
+ {
+ if ( global )
+ {
+ node.GlobalPosition = position;
+ }
+ else
+ {
+ node.Position = position;
+ }
+ }
+
+ public static void SetLocalOrGlobalRotation( this Node3D node, Vector3 rotation, bool global )
+ {
+ if ( global )
+ {
+ node.GlobalRotation = rotation;
+ }
+ else
+ {
+ node.Rotation = rotation;
+ }
+ }
+
+ public static void SetGlobalPose( this Node3D node, Vector3 position, Quaternion rotation )
+ {
+ node.SetGlobalQuaternion( rotation );
+ node.GlobalPosition = position;
+ }
+
+ public static void SetGlobalPose( this Node3D node, Pose pose )
+ {
+ node.SetGlobalPose( pose.position, pose.rotation );
+ }
+
+ public static Pose GetGlobalPose( this Node3D node )
+ {
+ return Pose.From( node );
+ }
+
+ public static void CopyGlobalPoseFrom( this Node3D node, Node3D other )
+ {
+ node.SetGlobalPose( other.GetGlobalPose() );
+ }
+
+ public static void SetGlobalQuaternion( this Node3D node, Quaternion quaternion )
+ {
+ var localScale = node.Scale;
+ node.GlobalBasis = new Basis( quaternion );
+ node.Scale = localScale;
+ }
+
+ public static void SetLocalQuaternion( this Node3D node, Quaternion quaternion )
+ {
+ var localScale = node.Scale;
+ node.Basis = new Basis( quaternion );
+ node.Scale = localScale;
+ }
+
+ public static void LookTowards( this Node3D node, Vector3 forwardDirection, Vector3 upDirection, Quaternion rotation )
+ {
+ node.LookTowards( forwardDirection, upDirection );
+ node.SetGlobalQuaternion( node.GlobalQuaternion() * rotation );
+ }
+
+ public static void LookTowards( this Node3D node, Vector3 forward, Vector3 up, Vector3? up2 = null )
+ {
+ if ( forward == up )
+ {
+ up = up2 == null ? Vector3.Back : (Vector3)up2;
+ }
+
+ node.LookAt( forward + node.GlobalPosition, up );
+ }
+
+
+ public static Vector3 GetGlobalOffset( this Node3D node, Vector3 direction )
+ {
+ return direction.X * node.GlobalRight() +
+ direction.Y * node.GlobalUp() +
+ direction.Z * node.GlobalForward() ;
+ }
+
+ public static Vector3 GlobalForward( this Node3D node )
+ {
+ return -node.GlobalBasis.Z;
+ }
+
+ public static Vector3 GetPosition( this Node3D node, bool global = false )
+ {
+ return global ? node.GlobalPosition : node.Position;
+ }
+
+ public static Vector3 GlobalUp( this Node3D node )
+ {
+ return node.GlobalBasis.Y;
+ }
+
+
+ public static Vector3 GlobalRight( this Node3D node )
+ {
+ return node.GlobalBasis.X;
+ }
+
+ public static void SetGlobalX( this Node3D node, float x )
+ {
+ var gp = node.GlobalPosition;
+
+ gp.X = x;
+
+ node.GlobalPosition = gp;
+ }
+
+ public static void SetGlobalY( this Node3D node, float y )
+ {
+ var gp = node.GlobalPosition;
+
+ gp.Y = y;
+
+ node.GlobalPosition = gp;
+ }
+
+ public static void SetGlobalZ( this Node3D node, float z )
+ {
+ var gp = node.GlobalPosition;
+
+ gp.Z = z;
+
+ node.GlobalPosition = gp;
+ }
+
+ public static void SetLocalX( this Node3D node, float x )
+ {
+ var gp = node.Position;
+
+ gp.X = x;
+
+ node.Position = gp;
+ }
+
+ public static void SetLocalY( this Node3D node, float y )
+ {
+ var gp = node.Position;
+
+ gp.Y = y;
+
+ node.Position = gp;
+ }
+
+ public static void SetLocalZ( this Node3D node, float z )
+ {
+ var gp = node.Position;
+
+ gp.Z = z;
+
+ node.Position = gp;
+ }
+
+ public static Vector3 GetOrientationBasedGlobalOffset( this Node3D node, Vector3 offset )
+ {
+ return offset.X * node.GlobalRight() + offset.Y * node.GlobalUp() + offset.Z * node.GlobalForward();
+ }
+
+
+ public static Box3 GetWorldBox( this Node3D node, bool onlyVisible = true )
+ {
+ var aabb = GetWorldBounds( node, onlyVisible );
+
+ return aabb == null ? null : ( (Aabb)aabb).ToBox3();
+ }
+
+ public static Aabb? GetWorldBounds( this Node3D node, bool onlyVisible = true )
+ {
+ return node.GetWorldBoundsFrom( onlyVisible );
+ }
+
+ public static Aabb? GetWorldBoundsFrom( this Node3D node, bool onlyVisible = true )
+ {
+ Aabb? worldBounds = null;
+
+ Nodes.ForEach( node,
+ ( vi )=>
+ {
+ if ( onlyVisible && ! vi.IsVisibleInTree() )
+ {
+ return;
+ }
+
+ var nBounds = vi.GetAabb();
+
+ nBounds.Size *= Math3D.GetGlobalUniScale( vi );
+ nBounds.Position += vi.GlobalPosition;
+ nBounds.End += vi.GlobalPosition;
+
+ worldBounds = worldBounds == null ? nBounds : ( ((Aabb)worldBounds).Merge( nBounds ) );
+ }
+ );
+
+ return worldBounds;
+ }
+
+
+ public static Quaternion GlobalQuaternion( this Node3D self )
+ {
+ return self.GlobalBasis.GetRotationQuaternion();
+ }
+
+ public static Quaternion GlobalYawQuaterntion( this Node3D self )
+ {
+ return Math3D.RotateY( self.GlobalYawRadians() + Mathf.Pi );
+ }
+
+ public static float GlobalYawDegrees( this Node3D node3D )
+ {
+ return Math3D.GlobalYawDegrees( node3D.GlobalForward() );
+ }
+
+ public static float GlobalYawRadians( this Node3D node3D )
+ {
+ return Math3D.GlobalYaw( node3D.GlobalForward() );
+ }
+
+ public static Vector2 GlobalXZ( this Node3D n )
+ {
+ var v = n.GlobalPosition;
+ return new Vector2( v.X, v.Z );
+ }
+
+ public static void SetGlobalXZ( this Node3D n, Vector2 xz )
+ {
+ var p = n.GlobalPosition;
+ p.X = xz.X;
+ p.Z = xz.Y;
+
+ n.GlobalPosition = p;
+ }
+
+ public static void SetGlobalYaw( this Node3D n, float yawRadians )
+ {
+ n.SetGlobalQuaternion( Math3D.RotateY( yawRadians ) );
+ }
+
+ public static void SetGlobalYawDegrees( this Node3D n, float yawDegrees )
+ {
+ n.SetGlobalQuaternion( Math3D.RotateY( yawDegrees * MathX.DegreesToRadians ) );
+ }
+
+ }
+}
diff --git a/Runtime/Godot/Extensions/Node3DExtensions.cs.uid b/Runtime/Godot/Extensions/Node3DExtensions.cs.uid
new file mode 100644
index 0000000..e9d1215
--- /dev/null
+++ b/Runtime/Godot/Extensions/Node3DExtensions.cs.uid
@@ -0,0 +1 @@
+uid://bf32gapbxoe4x
diff --git a/Runtime/Godot/Extensions/QuaternionExtensions.cs b/Runtime/Godot/Extensions/QuaternionExtensions.cs
new file mode 100644
index 0000000..8c16b21
--- /dev/null
+++ b/Runtime/Godot/Extensions/QuaternionExtensions.cs
@@ -0,0 +1,12 @@
+using Godot;
+using System.Text;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Rokojori
+{
+ public static class QuaternionExtensions
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Godot/Extensions/QuaternionExtensions.cs.uid b/Runtime/Godot/Extensions/QuaternionExtensions.cs.uid
new file mode 100644
index 0000000..f32a987
--- /dev/null
+++ b/Runtime/Godot/Extensions/QuaternionExtensions.cs.uid
@@ -0,0 +1 @@
+uid://dkcrw7m7aw6ty
diff --git a/Runtime/Godot/Extensions/Transform3DExtensions.cs b/Runtime/Godot/Extensions/Transform3DExtensions.cs
new file mode 100644
index 0000000..6633f5b
--- /dev/null
+++ b/Runtime/Godot/Extensions/Transform3DExtensions.cs
@@ -0,0 +1,15 @@
+using Godot;
+using System.Text;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Rokojori
+{
+ public static class Transform3DExtensions
+ {
+ public static bool IsValid( this Transform3D self )
+ {
+ return self.Origin.IsValid() && self.Basis.IsValid();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Godot/Extensions/Transform3DExtensions.cs.uid b/Runtime/Godot/Extensions/Transform3DExtensions.cs.uid
new file mode 100644
index 0000000..4c0371c
--- /dev/null
+++ b/Runtime/Godot/Extensions/Transform3DExtensions.cs.uid
@@ -0,0 +1 @@
+uid://cdfiwablm4a6q
diff --git a/Runtime/Godot/GodotEditorHelper.cs b/Runtime/Godot/GodotEditorHelper.cs
index 9274c04..7d4e498 100644
--- a/Runtime/Godot/GodotEditorHelper.cs
+++ b/Runtime/Godot/GodotEditorHelper.cs
@@ -39,6 +39,14 @@ namespace Rokojori
var filesystem = EditorInterface.Singleton.GetResourceFilesystem();
filesystem.ReimportFiles( [ path ] );
+ filesystem.UpdateFile( path );
+
+ if ( path.ToLower().EndsWith( "gdshader" ) )
+ {
+ var shader = ResourceLoader.Load( path, null, ResourceLoader.CacheMode.Ignore );
+ EditorInterface.Singleton.EditResource( shader );
+ }
+
#endif
}
}
diff --git a/Runtime/Godot/NodeState.cs b/Runtime/Godot/NodeState.cs
index ac0f112..5d63386 100644
--- a/Runtime/Godot/NodeState.cs
+++ b/Runtime/Godot/NodeState.cs
@@ -116,7 +116,7 @@ namespace Rokojori
public static void Configure( Node n, bool processEnabled, bool inputEnabled, bool physicsEnabled, bool signalsEnabled,
Node.ProcessModeEnum processMode, bool visible )
{
- if ( n == null )
+ if ( n == null || ! Node.IsInstanceValid( n ) )
{
return;
}
diff --git a/Runtime/Godot/Nodes.cs b/Runtime/Godot/Nodes.cs
index fedad03..511a907 100644
--- a/Runtime/Godot/Nodes.cs
+++ b/Runtime/Godot/Nodes.cs
@@ -367,6 +367,22 @@ namespace Rokojori
return CreateChildIn( parent, name );
}
+
+ public static T CreateChild( this Node parent, PackedScene scene, string name = null ) where T:Node,new()
+ {
+ var instance = scene.Instantiate();
+
+ parent.AddChild( instance );
+ instance.Owner = parent.Owner;
+
+ if ( name != null )
+ {
+ instance.Name = name;
+ }
+
+ return instance;
+ }
+
public static T GetOrCreateChild( this Node parent, string name = null ) where T:Node,new()
{
var child = Nodes.GetDirectChild( parent );
@@ -387,7 +403,7 @@ namespace Rokojori
if ( rotation != null )
{
- Math3D.SetLocalQuaternion( c, (Quaternion)rotation );
+ c.SetLocalQuaternion( (Quaternion)rotation );
}
return c;
@@ -421,7 +437,7 @@ namespace Rokojori
if ( rotation != null )
{
- Math3D.SetGlobalQuaternion( c, (Quaternion)rotation );
+ c.SetGlobalQuaternion( (Quaternion)rotation );
}
return c;
@@ -435,7 +451,7 @@ namespace Rokojori
if ( rotation != null )
{
- Math3D.SetGlobalQuaternion( c, (Quaternion)rotation );
+ c.SetGlobalQuaternion( (Quaternion)rotation );
}
return c;
@@ -449,7 +465,7 @@ namespace Rokojori
if ( rotation != null )
{
- Math3D.SetGlobalQuaternion( c, (Quaternion)rotation );
+ c.SetGlobalQuaternion( (Quaternion)rotation );
}
return c;
@@ -677,6 +693,35 @@ namespace Rokojori
}
}
+ public static void CallInProcess( this Node node, System.Action action )
+ {
+ var tm = TimeLineManager.Get();
+
+ if ( ! tm.inProcess )
+ {
+ TimeLineManager.ScheduleCallback(
+ tm.realtimeTimeline,
+ ( cb ) =>
+ {
+ try
+ {
+ action();
+ }
+ catch ( System.Exception e )
+ {
+ node.LogError( e );
+ }
+
+ cb.done = true;
+ }
+ );
+ }
+ else
+ {
+ action();
+ }
+ }
+
public static void SelfDestroy( this Node node, bool queue = true )
{
var parent = node.GetParent();
@@ -773,6 +818,41 @@ namespace Rokojori
return list;
}
+ public static void AddChildAt( this Node parent, Node child, int index, bool setOwnership = true )
+ {
+ parent.AddChild( child );
+ parent.MoveChild( child, index );
+
+ if ( ! setOwnership )
+ {
+ return;
+ }
+
+ child.Owner = parent.Owner;
+ }
+
+ public static void AddSiblingBefore( this Node referenceSibling, Node siblingToInsert, bool includeInternal = false )
+ {
+ var parent = referenceSibling.GetParent();
+ var index = referenceSibling.GetIndex( includeInternal );
+ AddChildAt( parent, siblingToInsert, index );
+ }
+
+ public static void AddSiblingAfter( this Node referenceSibling, Node siblingToInsert, bool includeInternal = false )
+ {
+ var parent = referenceSibling.GetParent();
+ var index = referenceSibling.GetIndex( includeInternal );
+
+ AddChildAt( parent, siblingToInsert, index );
+ }
+
+ public static void Wrap( this Node reference, Node other )
+ {
+ other.AddSiblingBefore( reference );
+ other.RemoveFromParent();
+ reference.AddChild( other );
+ other.Owner = reference.Owner;
+ }
public static int NumDirectChildrenOf( this Node parent ) where T:Node
{
@@ -867,6 +947,28 @@ namespace Rokojori
}
}
+ public static void ForEachDirectChild( this Node parent, Predicate selector, Action action )
+ {
+ if ( parent == null || action == null )
+ {
+ return;
+ }
+
+ var numChildren = parent.GetChildCount();
+
+ for ( int i = 0; i < numChildren; i++ )
+ {
+ var node = parent.GetChild( i );
+
+ if ( ! selector( node ) )
+ {
+ continue;
+ }
+
+ action( node );
+ }
+ }
+
public static List MapDirectChildren( Node parent, System.Func mapper ) where T:Node
{
var list = new List();
diff --git a/Runtime/Interactions/CharacterController/CharacterController.cs b/Runtime/Interactions/CharacterController/CharacterController.cs
index 059f549..9d44048 100644
--- a/Runtime/Interactions/CharacterController/CharacterController.cs
+++ b/Runtime/Interactions/CharacterController/CharacterController.cs
@@ -56,25 +56,38 @@ namespace Rokojori
ProcessActions( (float) delta );
}
- // positionSmoother.CopyPosition( graphics, body, rotationSmoothingDuration, delta );
- // rotationSmoother.CopyRotation( graphics, body, positionSmoothingDuration, delta );
-
graphics.GlobalPosition = Smoothing.Apply( positionSmoothing, body.GlobalPosition, this.delta );
- graphics.SetGlobalQuaternion( Smoothing.Apply( rotationSmoothing, body.GetGlobalQuaternion(), this.delta ) );
+ graphics.SetGlobalQuaternion( Smoothing.Apply( rotationSmoothing, body.GlobalQuaternion(), this.delta ) );
+
if ( body.IsOnFloor() )
{
lastGroundedHeight = graphics.GlobalPosition.Y;
}
- var grounedPosition = graphics.GlobalPosition;
- grounedPosition.Y = lastGroundedHeight;
- groundedTransform.GlobalPosition = grounedPosition;
- groundedTransform.SetGlobalQuaternion( graphics.GetGlobalQuaternion() );
+
+ AssignGroundedTransform();
+
+
// Pose.CopyTo( body, graphics );
}
+ void AssignGroundedTransform()
+ {
+ if ( groundedTransform == null )
+ {
+ return;
+ }
+
+
+ var groundedPosition = graphics.GlobalPosition;
+ groundedPosition.Y = lastGroundedHeight;
+
+ groundedTransform.GlobalPosition = groundedPosition;
+ groundedTransform.SetGlobalQuaternion( graphics.GlobalQuaternion() );
+ }
+
public override void _PhysicsProcess( double delta )
{
if ( CharacterUpdateMode.Physics_Process == characterUpdateMode )
@@ -100,6 +113,8 @@ namespace Rokojori
return;
}
+ c.SetCharacterController( this );
+
Action.Trigger( c );
}
);
diff --git a/Runtime/Interactions/CharacterController/CharacterControllerAction.cs b/Runtime/Interactions/CharacterController/CharacterControllerAction.cs
index 9126c04..f1a1fc1 100644
--- a/Runtime/Interactions/CharacterController/CharacterControllerAction.cs
+++ b/Runtime/Interactions/CharacterController/CharacterControllerAction.cs
@@ -12,8 +12,8 @@ namespace Rokojori
[Export]
public bool enabled = true;
- [Export]
- public CharacterController controller;
+ CharacterController _controller;
+ public CharacterController controller => _controller;
[Export]
public Condition condition;
@@ -21,29 +21,41 @@ namespace Rokojori
[Export]
public SceneCondition sceneCondition;
+ public void SetCharacterController( CharacterController cc )
+ {
+ _controller = cc;
+ }
public CharacterBody3D body => controller.body;
- public void AddVelocity( Vector3 velocity )
+ public void AddVelocity( Vector3 velocity, float delta = -1 )
{
- body.Velocity += velocity * controller.delta;
+ delta = delta < 0 ? controller.delta : delta;
+
+ body.Velocity += velocity * delta;
}
- public void SetVelocity( Vector3 velocity )
+ public void SetScaledVelocity( float scale )
+ {
+ body.Velocity *= scale;
+ }
+
+ public void SetVelocity( Vector3 velocity, float delta = -1 )
{
- body.Velocity = velocity * controller.delta;
+ delta = delta < 0 ? controller.delta : delta;
+ body.Velocity = velocity * delta;
}
- public void Velocity( Vector3 velocity, bool replace )
+ public void Velocity( Vector3 velocity, bool replace, float delta = -1 )
{
if ( replace )
{
- SetVelocity( velocity );
+ SetVelocity( velocity, delta );
}
else
{
- AddVelocity( velocity );
+ AddVelocity( velocity, delta );
}
}
diff --git a/Runtime/Interactions/CharacterController/CharacterMovement.cs b/Runtime/Interactions/CharacterController/CharacterMovement.cs
index eca959b..bf5edca 100644
--- a/Runtime/Interactions/CharacterController/CharacterMovement.cs
+++ b/Runtime/Interactions/CharacterController/CharacterMovement.cs
@@ -32,7 +32,10 @@ namespace Rokojori
[ExportGroup("Movement")]
[Export]
- public float moveSpeed;
+ public float moveSpeed = 10f;
+
+ [Export]
+ public float minSpeed = 0f;
[Export]
public CharacterMovementType controllerMovementType;
@@ -43,6 +46,9 @@ namespace Rokojori
[Export]
public CharacterMovementType currentMovementType;
+ [Export]
+ public CharacterMovementType[] deviceMovementTypes = [];
+
[Export]
public Smoothing onFloorMovementSmoothing = new FrameSmoothing();
@@ -80,8 +86,15 @@ namespace Rokojori
protected CharacterMovementData characterMovementData = new CharacterMovementData();
+
+ [Export]
+ public bool lookAlwaysForward = false;
+ [Export]
+ public Smoothing lookAlwaysForwardSmoothing;
-
+ Vector3 _smoothedMovement;
+ public Vector3 smoothedMovement => _smoothedMovement;
+
protected override void _OnTrigger()
{
var onFloor = body.IsOnFloor();
@@ -89,8 +102,19 @@ namespace Rokojori
characterMovementData.Reset( this );
+ var sm = Unique.Get();
+ if ( sm == null )
+ {
+ return;
+ }
+
+ var activeDevice = sm.lastActiveDevice;
+
+ currentMovementType = deviceMovementTypes.FindNonNull( d => d.deviceSelector.Selects( activeDevice ) );
+
if ( currentMovementType == null )
{
+ // this.LogInfo( "No device found:", activeDevice == null ? "null" : activeDevice.GetType().Name );
return;
}
@@ -109,6 +133,9 @@ namespace Rokojori
if ( adjustRotation )
{
var nextRotation = Math3D.LookRotation( characterMovementData.forwardDirection );
+
+
+
var speed = MathX.Clamp01( characterMovementData.movement.Length() / moveSpeed );
if ( speed > 0 )
@@ -127,21 +154,29 @@ namespace Rokojori
rotation = rotationSmoothing.Smooth( nextRotation, controller.delta );
body.SetGlobalQuaternion( rotation );
}
+
+
}
- var smoothedMovement = Vector3.Zero;
+ if ( lookAlwaysForward )
+ {
+ var nextRotation = directionSource.GlobalYawQuaterntion();
+ body.SetGlobalQuaternion( Smoothing.Apply( lookAlwaysForwardSmoothing, nextRotation, controller.delta ) );
+ }
+
+ // var smoothedMovement = Vector3.Zero;
if ( onFloor )
{
- smoothedMovement = onFloorMovementSmoothing.Smooth( characterMovementData.movement, controller.delta );
+ _smoothedMovement = onFloorMovementSmoothing.Smooth( characterMovementData.movement, controller.delta );
}
else
{
- smoothedMovement = inAirMovementSmoothing.Smooth( characterMovementData.movement, controller.delta );
+ _smoothedMovement = inAirMovementSmoothing.Smooth( characterMovementData.movement, controller.delta );
}
var wasMoving = _moving;
- _moving = smoothedMovement.Length() > movingSpeedTreshold;
+ _moving = _smoothedMovement.Length() > movingSpeedTreshold;
if ( wasMoving != _moving )
{
@@ -155,7 +190,7 @@ namespace Rokojori
}
}
- Velocity( smoothedMovement, onFloor );
+ Velocity( _smoothedMovement, onFloor );
}
}
diff --git a/Runtime/Interactions/CharacterController/CharacterMovements/CharacterMovementType.cs b/Runtime/Interactions/CharacterController/CharacterMovements/CharacterMovementType.cs
index 0233b99..2f4d053 100644
--- a/Runtime/Interactions/CharacterController/CharacterMovements/CharacterMovementType.cs
+++ b/Runtime/Interactions/CharacterController/CharacterMovements/CharacterMovementType.cs
@@ -7,8 +7,11 @@ namespace Rokojori
{
[Tool]
[GlobalClass]
- public partial class CharacterMovementType:Resource
+ public abstract partial class CharacterMovementType:Resource
{
+ [Export]
+ public DefaultSensorDeviceSelector deviceSelector;
+
public virtual void ProcessMovement( CharacterMovementData characterMovementData )
{
diff --git a/Runtime/Interactions/CharacterController/CharacterMovements/StrafeMovementType.cs b/Runtime/Interactions/CharacterController/CharacterMovements/StrafeMovementType.cs
index 75ec1b1..b13f8a8 100644
--- a/Runtime/Interactions/CharacterController/CharacterMovements/StrafeMovementType.cs
+++ b/Runtime/Interactions/CharacterController/CharacterMovements/StrafeMovementType.cs
@@ -66,7 +66,7 @@ namespace Rokojori
var movement = forwardDirection * Sensors.PolarAxis( backwards, forward ) * characterMovement.moveSpeed;
- movement += rightDirection * Sensors.PolarAxis( strafeLeft, strafeRight ) * characterMovement.moveSpeed * strafeSpeedMultiply ;
+ movement += rightDirection * Sensors.PolarAxis( strafeLeft, strafeRight ) * characterMovement.moveSpeed * strafeSpeedMultiply;
characterMovementData.movement = movement;
characterMovementData.isMovingForward = forward.isActive;
diff --git a/Runtime/Interactions/CharacterController/ProcessVelocity.cs b/Runtime/Interactions/CharacterController/ProcessVelocity.cs
new file mode 100644
index 0000000..1869cb4
--- /dev/null
+++ b/Runtime/Interactions/CharacterController/ProcessVelocity.cs
@@ -0,0 +1,20 @@
+using Godot;
+using System.Collections;
+using System.Collections.Generic;
+using Godot.Collections;
+
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/CCMoveAndSlide.svg")]
+ public partial class ProcessVelocity:CharacterControllerAction
+ {
+ [Export]
+ public float velocityScale = 0.1f;
+
+ protected override void _OnTrigger()
+ {
+ SetScaledVelocity( velocityScale );
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Interactions/CharacterController/ProcessVelocity.cs.uid b/Runtime/Interactions/CharacterController/ProcessVelocity.cs.uid
new file mode 100644
index 0000000..ef9fd72
--- /dev/null
+++ b/Runtime/Interactions/CharacterController/ProcessVelocity.cs.uid
@@ -0,0 +1 @@
+uid://ch6tcwvvw2dl1
diff --git a/Runtime/Interactions/Collidable.cs b/Runtime/Interactions/Collidable.cs
new file mode 100644
index 0000000..e0af490
--- /dev/null
+++ b/Runtime/Interactions/Collidable.cs
@@ -0,0 +1,96 @@
+using Godot;
+using System.Collections;
+using System.Collections.Generic;
+using Godot.Collections;
+
+namespace Rokojori
+{
+ public enum CollisionPhase
+ {
+ Entered,
+ Inside,
+ Exit
+ }
+
+ [Tool]
+ [GlobalClass,Icon("res://addons/rokojori_action_library/Icons/Collidable.svg")]
+ public partial class Collidable:Node3D
+ {
+ [Export]
+ public CollisionFlag[] collisionTypes;
+
+ [Export]
+ public Action onEntered;
+
+ [Export]
+ public Node3D onEnteredColliderPose;
+
+ [Export]
+ public Action onInside;
+
+ [Export]
+ public Node3D onInsideColliderPose;
+
+ [Export]
+ public Action onExit;
+
+ [Export]
+ public Node3D onExitColliderPose;
+
+ public bool IsCollidingWith( Collider collider )
+ {
+ if ( ( collisionTypes == null || collisionTypes.Length == 0 ) && collider.collisionType == null )
+ {
+ return true;
+ }
+
+ if ( collisionTypes == null )
+ {
+ return false;
+ }
+
+ return collisionTypes.IndexOf( collider.collisionType ) != -1;
+ }
+
+ public void Collide( Collider collider, CollisionPhase phase )
+ {
+ _Collide( collider, phase );
+
+ if ( phase == CollisionPhase.Entered )
+ {
+ if ( onEnteredColliderPose != null )
+ {
+ onEnteredColliderPose.CopyGlobalPoseFrom( collider.area );
+ }
+
+ Action.Trigger( collider.onEntered );
+ Action.Trigger( onEntered );
+ }
+ else if ( phase == CollisionPhase.Inside )
+ {
+ if ( onInsideColliderPose != null )
+ {
+ onInsideColliderPose.CopyGlobalPoseFrom( collider.area );
+ }
+
+ Action.Trigger( collider.onInside );
+ Action.Trigger( onInside );
+ }
+ else if ( phase == CollisionPhase.Exit )
+ {
+ if ( onExitColliderPose != null )
+ {
+ onExitColliderPose.CopyGlobalPoseFrom( collider.area );
+ }
+
+ Action.Trigger( collider.onExit );
+ Action.Trigger( onExit );
+ }
+ }
+
+ protected virtual void _Collide( Collider collider, CollisionPhase phase )
+ {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Interactions/Collidable.cs.uid b/Runtime/Interactions/Collidable.cs.uid
new file mode 100644
index 0000000..40c77c8
--- /dev/null
+++ b/Runtime/Interactions/Collidable.cs.uid
@@ -0,0 +1 @@
+uid://dbgwebayabwd5
diff --git a/Runtime/Interactions/Collider.cs b/Runtime/Interactions/Collider.cs
new file mode 100644
index 0000000..87d97fb
--- /dev/null
+++ b/Runtime/Interactions/Collider.cs
@@ -0,0 +1,121 @@
+using Godot;
+using System.Collections;
+using System.Collections.Generic;
+
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass,Icon("res://addons/rokojori_action_library/Icons/Collider.svg")]
+ public partial class Collider:Node, iNodeState
+ {
+ [Export]
+ public Area3D area;
+
+ [Export]
+ public CollisionFlag collisionType;
+
+ [Export]
+ public Action onEntered;
+
+ [Export]
+ public Action onInside;
+
+ [Export]
+ public Action onExit;
+
+ Dictionary _inside = new Dictionary();
+
+ public void OnNodeStateChanged()
+ {
+ if ( ! IsProcessing() || ! IsPhysicsProcessing() || Node.ProcessModeEnum.Disabled == this.ProcessMode )
+ {
+ // this.LogInfo( "Clearing nodes" );
+ _inside.Clear();
+ }
+ }
+
+ public override void _Ready()
+ {
+ if ( area == null )
+ {
+ return;
+ }
+
+ area.AreaEntered += TriggerOnEnter;
+ area.BodyEntered += TriggerOnEnter;
+
+ area.AreaExited += TriggerOnExited;
+ area.BodyExited += TriggerOnExited;
+ }
+
+
+ void TriggerOnEnter( Node n )
+ {
+ if ( ! Math3D.IsValid( area.GlobalPosition ) )
+ {
+ return;
+ }
+
+ var collidable = n.Get();
+
+ if ( collidable == null || ! collidable.IsCollidingWith( this ) )
+ {
+ return;
+ }
+
+ collidable.Collide( this, CollisionPhase.Entered );
+
+ if ( onInside == null )
+ {
+ return;
+ }
+
+ var tm = Unique.Get();
+
+ if ( tm == null )
+ {
+ return;
+ }
+
+ var callback = ()=>
+ {
+ collidable.Collide( this, CollisionPhase.Inside );
+ };
+
+ _inside[ collidable ] = callback;
+ tm.AddProcessCallback( callback );
+
+ }
+
+ void TriggerOnExited( Node n )
+ {
+ var collidable = n.Get();
+
+ if ( collidable == null || ! collidable.IsCollidingWith( this ) )
+ {
+ return;
+ }
+
+ collidable.Collide( this, CollisionPhase.Exit );
+
+ if ( ! _inside.ContainsKey( collidable ) )
+ {
+ return;
+ }
+
+ var tm = Unique.Get();
+
+ var callback = _inside[ collidable ];
+ _inside.Remove( collidable );
+
+ if ( tm == null )
+ {
+ return;
+ }
+
+ tm.RemoveProcessCallback( callback );
+
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Interactions/Collider.cs.uid b/Runtime/Interactions/Collider.cs.uid
new file mode 100644
index 0000000..113f13f
--- /dev/null
+++ b/Runtime/Interactions/Collider.cs.uid
@@ -0,0 +1 @@
+uid://xnupkyu3042b
diff --git a/Runtime/Interactions/CollisionFlag.cs b/Runtime/Interactions/CollisionFlag.cs
new file mode 100644
index 0000000..a10ab58
--- /dev/null
+++ b/Runtime/Interactions/CollisionFlag.cs
@@ -0,0 +1,15 @@
+using Godot;
+using System.Collections;
+using System.Collections.Generic;
+using Godot.Collections;
+using System.Drawing;
+
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass,Icon("res://addons/rokojori_action_library/Icons/SelectorFlag.svg")]
+ public partial class CollisionFlag:SelectorFlag
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Interactions/CollisionFlag.cs.uid b/Runtime/Interactions/CollisionFlag.cs.uid
new file mode 100644
index 0000000..78fdaff
--- /dev/null
+++ b/Runtime/Interactions/CollisionFlag.cs.uid
@@ -0,0 +1 @@
+uid://crk6vntm10let
diff --git a/Runtime/Interactions/Grabber.cs b/Runtime/Interactions/Grabber.cs
index 1bd3d4f..c7ee540 100644
--- a/Runtime/Interactions/Grabber.cs
+++ b/Runtime/Interactions/Grabber.cs
@@ -86,18 +86,18 @@ namespace Rokojori
grabbable.SetGrabber( this );
- _callback = TimeLineManager.ScheduleCallback( timeLine,
- ( cb )=>
+ _callback = TimeLineManager.ScheduleCallback(timeLine,
+ (System.Action)(( cb )=>
{
- if ( cb != _callback )
+ if ( cb != _callback)
{
return;
}
- positionSmoothing.SetCurrent( grabbable.grabTarget.GlobalPosition );
- rotationSmoothing.SetCurrent( grabbable.grabTarget.GetGlobalQuaternion() );
+ positionSmoothing.SetCurrent(grabbable.grabTarget.GlobalPosition );
+ rotationSmoothing.SetCurrent(Node3DExtensions.GlobalQuaternion(grabbable.grabTarget));
UpdateGrabbable();
- }
+ })
);
Action.Trigger( onGrab );
@@ -121,7 +121,7 @@ namespace Rokojori
{
// this.LogInfo( "Grabbing", HierarchyName.Of( grabbable ) );
grabbable.grabTarget.GlobalPosition = Smoothing.Apply( positionSmoothing, grabOffset.GlobalPosition, timeLine.delta );
- grabbable.grabTarget.SetGlobalQuaternion( Smoothing.Apply( rotationSmoothing, grabOffset.GetGlobalQuaternion(), timeLine.delta ) );
+ grabbable.grabTarget.SetGlobalQuaternion( Smoothing.Apply( rotationSmoothing, grabOffset.GlobalQuaternion(), timeLine.delta ) );
grabbable.rigidBody3D.LinearVelocity = Vector3.Zero;
grabbable.rigidBody3D.AngularVelocity = Vector3.Zero;
}
diff --git a/Runtime/Interactions/MultiRayCaster.cs b/Runtime/Interactions/MultiRayCaster.cs
index 3f6cd91..821c970 100644
--- a/Runtime/Interactions/MultiRayCaster.cs
+++ b/Runtime/Interactions/MultiRayCaster.cs
@@ -132,7 +132,7 @@ namespace Rokojori
var excludes = new Array();
var from = GlobalPosition;
- var to = from + Math3D.GetGlobalForward( this ) * rayLength;
+ var to = from + this.GlobalForward() * rayLength;
this.to = to;
diff --git a/Runtime/Interactions/Pointer.cs b/Runtime/Interactions/Pointer.cs
index 1a679f7..743f95f 100644
--- a/Runtime/Interactions/Pointer.cs
+++ b/Runtime/Interactions/Pointer.cs
@@ -2,6 +2,7 @@ using Godot;
using System.Collections;
using System.Collections.Generic;
using Godot.Collections;
+using System.Drawing;
namespace Rokojori
{
@@ -19,6 +20,10 @@ namespace Rokojori
[Export]
public Pointable pointable;
+
+ public readonly EventSlot onPointerChange = new EventSlot();
+
+
[Export]
public bool printPointables = false;
@@ -56,6 +61,8 @@ namespace Rokojori
Highlight( HighlightActionType.Start, pointable );
}
+ onPointerChange.DispatchEvent( currentPointable );
+
if ( printPointables )
{
this.LogInfo( pointable );
diff --git a/Runtime/LOD/PointClouds/PointCloudGenerator.cs b/Runtime/LOD/PointClouds/PointCloudGenerator.cs
index 01da5cd..73accee 100644
--- a/Runtime/LOD/PointClouds/PointCloudGenerator.cs
+++ b/Runtime/LOD/PointClouds/PointCloudGenerator.cs
@@ -91,7 +91,7 @@ namespace Rokojori.PointClouds
}
sampler.materials = Materials.GetAll( mesh );
- sampler.albedoTexture = sampler.materials.Map( m => Texture2DPropertyName.albedoTexture );
+ sampler.albedoTexture = sampler.materials.Map( m => Sampler2DPropertyName.albedoTexture );
sampler.albedo = sampler.materials.Map( m => ColorPropertyName.albedo ); ;
var cloud = await sampler.SampleFromMesh( sampleMode, (ArrayMesh) mesh.Mesh, this );
diff --git a/Runtime/LOD/PointClouds/PointCloudOcTree.cs b/Runtime/LOD/PointClouds/PointCloudOcTree.cs
index a4891bb..6ff1a09 100644
--- a/Runtime/LOD/PointClouds/PointCloudOcTree.cs
+++ b/Runtime/LOD/PointClouds/PointCloudOcTree.cs
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace Rokojori.PointClouds
{
- public class PointCloudOcTree:OcTree
+ public class PointCloudOcTree:OcTree
{
List compressedNormals = new List()
{
diff --git a/Runtime/LOD/PointClouds/PointCloudSampler.cs b/Runtime/LOD/PointClouds/PointCloudSampler.cs
index 77826b1..6a5d548 100644
--- a/Runtime/LOD/PointClouds/PointCloudSampler.cs
+++ b/Runtime/LOD/PointClouds/PointCloudSampler.cs
@@ -19,7 +19,7 @@ namespace Rokojori.PointClouds
}
public List materials;
- public List albedoTexture;
+ public List albedoTexture;
public List albedo;
public float densityResolution = 0.2f;
@@ -286,7 +286,7 @@ namespace Rokojori.PointClouds
if ( image != null )
{
- color = image.Sample( uv, ColorX.EdgeMode.Repeat );
+ color = image.SampleLinear( uv, ImageExtensions.EdgeMode.Repeat );
}
@@ -360,7 +360,7 @@ namespace Rokojori.PointClouds
if ( image != null )
{
- color = image.Sample( uv, ColorX.EdgeMode.Repeat );
+ color = image.SampleLinear( uv, ImageExtensions.EdgeMode.Repeat );
}
diff --git a/Runtime/Logging/RJLog.cs b/Runtime/Logging/RJLog.cs
index caecd65..e042560 100644
--- a/Runtime/Logging/RJLog.cs
+++ b/Runtime/Logging/RJLog.cs
@@ -138,6 +138,13 @@ namespace Rokojori
GD.PrintRich( trace );
}
+ static void GDLogMessage( string message, string trace )
+ {
+ trace = "[color=#888888] " + trace + "[/color]" ;
+ GD.PrintRich("\n[b]" + message );
+ GD.PrintRich( trace );
+ }
+
static void LogMessageWithFullTrace( string message )
{
var trace = GetFullTrace();
@@ -225,6 +232,16 @@ namespace Rokojori
LogMessage( "[color=#55ffaa]" + HierarchyName.Of( resource ) + "[/color]\n" + GetLogString( objects ), 4 );
}
+ public static void GDLog( string trace, Node node, params object[] objects)
+ {
+ GDLogMessage( "[color=#55aaff]" + HierarchyName.Of( node ) + "[/color]\n" + GetLogString( objects ), trace );
+ }
+
+ public static void GDLog( string trace, Resource resource, params object[] objects)
+ {
+ GDLogMessage( "[color=#55ffaa]" + HierarchyName.Of( resource ) + "[/color]\n" + GetLogString( objects ), trace );
+ }
+
public static void Error( params object[] objects)
{
LogErrorMessage( GetLogString( objects ) );
diff --git a/Runtime/Math/Geometry/Circle.cs b/Runtime/Math/Geometry/Circle.cs
index e088cf0..2a45141 100644
--- a/Runtime/Math/Geometry/Circle.cs
+++ b/Runtime/Math/Geometry/Circle.cs
@@ -1,3 +1,4 @@
+using System;
using System.Collections;
using System.Collections.Generic;
using Godot;
@@ -8,7 +9,16 @@ namespace Rokojori
{
public Vector2 center = Vector2.Zero;
public float radius = 1;
-
+
+ public static Circle WithRadius( float radius = 1f )
+ {
+ var c = new Circle();
+ c.radius = radius;
+ return c;
+ }
+
+ public float circumference => radius * Mathf.Pi * 2;
+ public float area => Mathf.Pi * radius * radius;
}
}
\ No newline at end of file
diff --git a/Runtime/Math/Geometry/Pose.cs b/Runtime/Math/Geometry/Pose.cs
index ab17fd4..31e4122 100644
--- a/Runtime/Math/Geometry/Pose.cs
+++ b/Runtime/Math/Geometry/Pose.cs
@@ -173,7 +173,7 @@ namespace Rokojori
{
var p = new Pose();
p.position = node3D.GlobalPosition;
- p.rotation = node3D.GetGlobalQuaternion();
+ p.rotation = node3D.GlobalQuaternion();
return p;
}
@@ -181,14 +181,15 @@ namespace Rokojori
{
var p = new Pose();
p.position = - node3D.GlobalPosition;
- p.rotation = node3D.GetGlobalQuaternion().Inverse();
+ p.rotation = node3D.GlobalQuaternion().Inverse();
return p;
}
+
public Pose ToGlobal( Node3D n )
{
var p = new Pose();
- p.rotation = rotation * n.GetGlobalQuaternion();
+ p.rotation = rotation * n.GlobalQuaternion();
p.position = n.ToGlobal( position );
return p;
}
@@ -248,7 +249,7 @@ namespace Rokojori
public static void CopyTo( Node3D source, Node3D target )
{
target.GlobalPosition = source.GlobalPosition;
- target.SetGlobalQuaternion( source.GetGlobalQuaternion() );
+ target.SetGlobalQuaternion( source.GlobalQuaternion() );
}
public void Rotate( Quaternion rotation )
diff --git a/Runtime/Math/Geometry/SplineCurveCreator.cs b/Runtime/Math/Geometry/SplineCurveCreator.cs
index ca0cd2b..4ed8f54 100644
--- a/Runtime/Math/Geometry/SplineCurveCreator.cs
+++ b/Runtime/Math/Geometry/SplineCurveCreator.cs
@@ -49,7 +49,7 @@ namespace Rokojori
var splineCurvePoint = new SplineCurvePoint();
var splinePoint = splinePoints[ index ];
splineCurvePoint.position = splinePoint.GlobalPosition;
- splineCurvePoint.rotation = splinePoint.GetGlobalQuaternion();
+ splineCurvePoint.rotation = splinePoint.GlobalQuaternion();
splineCurvePoint.scale = splinePoint.Scale;
splineCurvePoint.twist = splinePoint.twist;
splineCurvePoint.weight = 1f;
diff --git a/Runtime/Math/Math3D.cs b/Runtime/Math/Math3D.cs
index 4067185..77a5212 100644
--- a/Runtime/Math/Math3D.cs
+++ b/Runtime/Math/Math3D.cs
@@ -33,6 +33,7 @@ namespace Rokojori
return LookingAtEachOther( fromDirection, to - from );
}
+
public static Vector4 Lerp( this Vector3 w, Vector4 x, Vector4 y, Vector4 z )
{
return w.X * x + w.Y * y + w.Z * z;
@@ -53,6 +54,11 @@ namespace Rokojori
{
return w.X * x + w.Y * y + w.Z * z;
}
+
+ public static Vector3 Clamp( Vector3 x, Vector3 min, Vector3 max )
+ {
+ return x.Clamp( min, max );
+ }
public static Vector3 ComputeAverage( List points )
@@ -132,6 +138,12 @@ namespace Rokojori
return trsf.ScaledLocal( scale );
}
+ public static Transform3D TRS( Vector3 translation, Vector3 eulerRotation, Vector3 scale )
+ {
+ var rotation = Quaternion.FromEuler( eulerRotation );
+ return TRS( translation, rotation, scale );
+ }
+
public static Transform3D TRS( Vector3 translation, Vector4 rotation, Vector3 scale )
{
var quaternion = new Quaternion( rotation.X, rotation.Y, rotation.Z, rotation.W );
@@ -353,28 +365,7 @@ namespace Rokojori
return LerpUnclamped( a, b, MathX.Clamp01( amount ) );
}
- public static Quaternion GetGlobalQuaternion( this Node3D node )
- {
- return GetGlobalRotationFrom( node );
- }
-
-
- public static Quaternion GetGlobalRotationFrom( Node3D node )
- {
- var quaternion = node.GlobalBasis.GetRotationQuaternion();
-
- return quaternion;
- }
-
- public static float GlobalYawDegrees( this Node3D node3D )
- {
- return GlobalYawDegrees( node3D.GlobalForward() );
- }
-
- public static float GlobalYawRadians( this Node3D node3D )
- {
- return Mathf.DegToRad( GlobalYawDegrees( node3D ) );
- }
+
public static Vector3 GetMin( List data, Func getPosition )
{
@@ -495,22 +486,7 @@ namespace Rokojori
public static Vector2 XZ( this Vector3 v )
{
return new Vector2( v.X, v.Z );
- }
-
- public static Vector2 GlobalXZ( this Node3D n )
- {
- var v = n.GlobalPosition;
- return new Vector2( v.X, v.Z );
- }
-
- public static void SetGlobalXZ( this Node3D n, Vector2 xz )
- {
- var p = n.GlobalPosition;
- p.X = xz.X;
- p.Z = xz.Y;
-
- n.GlobalPosition = p;
- }
+ }
public static Vector2 ZX( this Vector3 v )
{
@@ -670,7 +646,7 @@ namespace Rokojori
public static Quaternion RotateZ( float radians )
{
- if ( radians == 0 ) { return Quaternion.Identity; }
+ if ( radians == 0 || float.IsNaN( radians ) ) { return Quaternion.Identity; }
return Quaternion.FromEuler( new Vector3( 0, 0, radians ) );
}
@@ -709,47 +685,9 @@ namespace Rokojori
return Mathf.RadToDeg( GlobalPitch( direction ) );
}
- public static float GlobalDistanceTo( this Node3D a, Node3D other )
- {
- return ( a.GlobalPosition - other.GlobalPosition ).Length();
- }
-
- public static bool IsInRange( this Node3D a, Node3D other, float distance )
- {
- return a.GlobalDistanceTo( other ) <= distance;
- }
-
- public static Vector3 GetLocalOrGlobalPosition( this Node3D node, bool global )
- {
- return global ? node.GlobalPosition : node.Position;
- }
-
- public static void SetLocalOrGlobalPosition( this Node3D node, Vector3 position, bool global )
- {
- if ( global )
- {
- node.GlobalPosition = position;
- }
- else
- {
- node.Position = position;
- }
- }
+
- public static void SetGlobalQuaternion( this Node3D node, Quaternion quaternion )
- {
- var localScale = node.Scale;
- node.GlobalBasis = new Basis( quaternion );
- node.Scale = localScale;
- }
-
- public static void SetLocalQuaternion( this Node3D node, Quaternion quaternion )
- {
- var localScale = node.Scale;
- node.Basis = new Basis( quaternion );
- node.Scale = localScale;
- }
-
+
public static void SetGlobalRotationTo( Node3D node, Quaternion quaternion )
{
var forward = quaternion * Vector3.Forward;
@@ -758,24 +696,7 @@ namespace Rokojori
node.LookAt( node.GlobalPosition + forward, up );
}
- public static void LookTowards( this Node3D node, Vector3 forwardDirection, Vector3 upDirection, Quaternion rotation )
- {
- //forwardDirection = rotation * forwardDirection;
- //upDirection = rotation * upDirection;
-
- node.LookTowards( forwardDirection, upDirection );
- node.SetGlobalQuaternion( node.GetGlobalQuaternion() * rotation );
- }
-
- public static void LookTowards( this Node3D node, Vector3 forward, Vector3 up, Vector3? up2 = null )
- {
- if ( forward == up )
- {
- up = up2 == null ? Vector3.Back : (Vector3)up2;
- }
-
- node.LookAt( forward + node.GlobalPosition, up );
- }
+
public static bool IsZero( this Quaternion q )
{
@@ -832,32 +753,13 @@ namespace Rokojori
return Quaternion.Identity.Slerp( q, fraction );
}
- public static Vector3 GetGlobalOffset( this Node3D node, Vector3 direction )
- {
- return direction.X * node.GlobalRight() +
- direction.Y * node.GlobalUp() +
- direction.Z * node.GlobalForward() ;
- }
-
- public static Vector3 GlobalForward( this Node3D node )
- {
- return GetGlobalForward( node );
- }
-
- public static Vector3 GetGlobalForward( Node3D node )
- {
- return -node.GlobalBasis.Z;
- }
-
+
public static Vector3 GetGlobalScale( Node3D node )
{
return node.GlobalTransform.Basis.Scale;
}
- public static Vector3 GetPosition( this Node3D node, bool global = false )
- {
- return global ? node.GlobalPosition : node.Position;
- }
+
public static float GetGlobalUniScale( Node3D node )
{
@@ -865,29 +767,9 @@ namespace Rokojori
return MathX.Max( scale3.X, scale3.Y, scale3.Z );
}
- public static Vector3 GlobalUp( this Node3D node )
- {
- return GetGlobalUp( node );
- }
-
- public static Vector3 GetGlobalUp( Node3D node )
- {
- return node.GlobalBasis.Y;
- }
-
- public static Vector3 GlobalRight( this Node3D node )
- {
- return GetGlobalRight( node );
- }
-
- public static Vector3 GetGlobalRight( Node3D node )
- {
- return node.GlobalBasis.X;
- }
-
public static Vector3 GetYPlaneForward( Node3D node )
{
- var forward = GetGlobalForward( node );
+ var forward = node.GlobalForward();
forward.Y = 0;
@@ -896,71 +778,15 @@ namespace Rokojori
public static Vector3 GetYPlaneRight( Node3D node )
{
- var right = GetGlobalRight( node );
+ var right = node.GlobalRight();
right.Y = 0;
return right.Normalized();
}
- public static void SetGlobalX( this Node3D node, float x )
- {
- var gp = node.GlobalPosition;
+
- gp.X = x;
-
- node.GlobalPosition = gp;
- }
-
- public static void SetGlobalY( this Node3D node, float y )
- {
- var gp = node.GlobalPosition;
-
- gp.Y = y;
-
- node.GlobalPosition = gp;
- }
-
- public static void SetGlobalZ( this Node3D node, float z )
- {
- var gp = node.GlobalPosition;
-
- gp.Z = z;
-
- node.GlobalPosition = gp;
- }
-
- public static void SetLocalX( this Node3D node, float x )
- {
- var gp = node.Position;
-
- gp.X = x;
-
- node.Position = gp;
- }
-
- public static void SetLocalY( this Node3D node, float y )
- {
- var gp = node.Position;
-
- gp.Y = y;
-
- node.Position = gp;
- }
-
- public static void SetLocalZ( this Node3D node, float z )
- {
- var gp = node.Position;
-
- gp.Z = z;
-
- node.Position = gp;
- }
-
- public static Vector3 GetOrientationBasedGlobalOffset( this Node3D node, Vector3 offset )
- {
- return offset.X * node.GlobalRight() + offset.Y * node.GlobalUp() + offset.Z * node.GlobalForward();
- }
public static Vector3 Average( List vectors )
{
@@ -1004,42 +830,7 @@ namespace Rokojori
return (Box3) aabb;
}
- public static Box3 GetWorldBox( this Node3D node, bool onlyVisible = true )
- {
- var aabb = GetWorldBounds( node, onlyVisible );
-
- return aabb == null ? null : ( (Aabb)aabb).ToBox3();
- }
-
- public static Aabb? GetWorldBounds( this Node3D node, bool onlyVisible = true )
- {
- return GetWorldBoundsFrom( node, onlyVisible );
- }
-
- public static Aabb? GetWorldBoundsFrom( Node3D node, bool onlyVisible = true )
- {
- Aabb? worldBounds = null;
-
- Nodes.ForEach( node,
- ( vi )=>
- {
- if ( onlyVisible && ! vi.IsVisibleInTree() )
- {
- return;
- }
-
- var nBounds = vi.GetAabb();
-
- nBounds.Size *= GetGlobalUniScale( vi );
- nBounds.Position += vi.GlobalPosition;
- nBounds.End += vi.GlobalPosition;
-
- worldBounds = worldBounds == null ? nBounds : ( ((Aabb)worldBounds).Merge( nBounds ) );
- }
- );
-
- return worldBounds;
- }
+
}
}
\ No newline at end of file
diff --git a/Runtime/Math/MathX.cs b/Runtime/Math/MathX.cs
index 9562abc..81499c7 100644
--- a/Runtime/Math/MathX.cs
+++ b/Runtime/Math/MathX.cs
@@ -213,6 +213,19 @@ namespace Rokojori
}
+ public static Vector2I FlatIndexToMultiIndex( int index, Vector2I sizes )
+ {
+ var multiIndex = Vector2I.Zero;
+
+ multiIndex.Y = index % sizes.Y;
+ index /= sizes.Y;
+
+ multiIndex.X = index % sizes.X;
+
+ return multiIndex;
+ }
+
+
public static float AngleDelta( float degreesA, float degreesB)
diff --git a/Runtime/Math/Smoother.cs b/Runtime/Math/Smoother.cs
index 01098c0..e5f537e 100644
--- a/Runtime/Math/Smoother.cs
+++ b/Runtime/Math/Smoother.cs
@@ -97,7 +97,7 @@ namespace Rokojori
public void CopyRotation( Node3D source, Node3D target, float duration, float delta )
{
- target.SetGlobalQuaternion( SmoothForDuration( target.GetGlobalQuaternion(), source.GetGlobalQuaternion(), duration, delta ) );
+ target.SetGlobalQuaternion( SmoothForDuration( target.GlobalQuaternion(), source.GlobalQuaternion(), duration, delta ) );
}
public void CopyRotation( Node3D source, Node3D target, float duration, double delta )
diff --git a/Runtime/Physics/PhysicsBodies.cs b/Runtime/Physics/PhysicsBodies.cs
index ad1878f..eddeace 100644
--- a/Runtime/Physics/PhysicsBodies.cs
+++ b/Runtime/Physics/PhysicsBodies.cs
@@ -55,5 +55,34 @@ namespace Rokojori
return Vector3.Zero;
}
+
+
+ public static void SetVelocity( this PhysicsBody3D physicsBody3D, Vector3 velocity )
+ {
+ if ( physicsBody3D is RigidBody3D rb )
+ {
+ rb.LinearVelocity = velocity;
+ return;
+ }
+
+ if ( physicsBody3D is CharacterBody3D cb)
+ {
+ cb.Velocity = velocity;
+ return;
+ }
+
+ if ( physicsBody3D is PhysicalBone3D pb )
+ {
+ pb.LinearVelocity= velocity;
+ return;
+ }
+
+ if ( physicsBody3D is StaticBody3D sb )
+ {
+ sb.ConstantLinearVelocity= velocity;
+ return;
+ }
+
+ }
}
}
\ No newline at end of file
diff --git a/Runtime/Physics/Wind/Properties/rj_GlobalWind.tres b/Runtime/Physics/Wind/Properties/rj_GlobalWind.tres
new file mode 100644
index 0000000..63ad594
--- /dev/null
+++ b/Runtime/Physics/Wind/Properties/rj_GlobalWind.tres
@@ -0,0 +1,12 @@
+[gd_resource type="Resource" script_class="ShaderPropertyBlock" load_steps=6 format=3 uid="uid://bssrxwasqgpbd"]
+
+[ext_resource type="Script" uid="uid://by2xsdh6vbaja" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/Properties/ShaderPropertyBlock.cs" id="1_x3rvk"]
+[ext_resource type="Resource" uid="uid://c84w0b74mfgpr" path="res://addons/rokojori_action_library/Runtime/Physics/Wind/Properties/rj_GlobalWindDirectionProperty.tres" id="2_dcpws"]
+[ext_resource type="Resource" uid="uid://efmv0fcfxlqe" path="res://addons/rokojori_action_library/Runtime/Physics/Wind/Properties/rj_GlobalWindNoiseTextureProperty.tres" id="3_kcrsv"]
+[ext_resource type="Resource" uid="uid://bqm71chf8v7rs" path="res://addons/rokojori_action_library/Runtime/Physics/Wind/Properties/rj_GlobalWindPositionProperty.tres" id="4_owh4a"]
+[ext_resource type="Resource" uid="uid://dtmjjes2elpl0" path="res://addons/rokojori_action_library/Runtime/Physics/Wind/Properties/rj_GlobalWindSpeedProperty.tres" id="5_kcrsv"]
+
+[resource]
+script = ExtResource("1_x3rvk")
+shaderProperties = [ExtResource("2_dcpws"), ExtResource("3_kcrsv"), ExtResource("4_owh4a"), ExtResource("5_kcrsv")]
+metadata/_custom_type_script = "uid://by2xsdh6vbaja"
diff --git a/Runtime/Physics/Wind/Properties/rj_GlobalWindDirection.tres b/Runtime/Physics/Wind/Properties/rj_GlobalWindDirection.tres
new file mode 100644
index 0000000..fa8369c
--- /dev/null
+++ b/Runtime/Physics/Wind/Properties/rj_GlobalWindDirection.tres
@@ -0,0 +1,8 @@
+[gd_resource type="Resource" script_class="Vector2PropertyName" load_steps=2 format=3 uid="uid://cbiy1b6ify6lh"]
+
+[ext_resource type="Script" uid="uid://cebfjne1ewhnm" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/Vector2PropertyName.cs" id="1_g7w7o"]
+
+[resource]
+script = ExtResource("1_g7w7o")
+propertyName = "rj_GlobalWindDirection"
+metadata/_custom_type_script = "uid://cebfjne1ewhnm"
diff --git a/Runtime/Physics/Wind/Properties/rj_GlobalWindDirectionProperty.tres b/Runtime/Physics/Wind/Properties/rj_GlobalWindDirectionProperty.tres
new file mode 100644
index 0000000..5c69d68
--- /dev/null
+++ b/Runtime/Physics/Wind/Properties/rj_GlobalWindDirectionProperty.tres
@@ -0,0 +1,10 @@
+[gd_resource type="Resource" script_class="Vector2Property" load_steps=3 format=3 uid="uid://c84w0b74mfgpr"]
+
+[ext_resource type="Script" uid="uid://colw2dxvhfkxy" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/Properties/Vector2Property.cs" id="1_gdg5g"]
+[ext_resource type="Resource" uid="uid://cbiy1b6ify6lh" path="res://addons/rokojori_action_library/Runtime/Physics/Wind/Properties/rj_GlobalWindDirection.tres" id="1_xqqec"]
+
+[resource]
+script = ExtResource("1_gdg5g")
+propertyName = ExtResource("1_xqqec")
+value = Vector2(1, 0)
+metadata/_custom_type_script = "uid://colw2dxvhfkxy"
diff --git a/Runtime/Physics/Wind/Properties/rj_GlobalWindNoiseTexture.tres b/Runtime/Physics/Wind/Properties/rj_GlobalWindNoiseTexture.tres
new file mode 100644
index 0000000..fb0b528
--- /dev/null
+++ b/Runtime/Physics/Wind/Properties/rj_GlobalWindNoiseTexture.tres
@@ -0,0 +1,8 @@
+[gd_resource type="Resource" script_class="Sampler2DPropertyName" load_steps=2 format=3 uid="uid://bnjsr0w6xwkho"]
+
+[ext_resource type="Script" uid="uid://bsreukpi8eiyy" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/Sampler2DPropertyName.cs" id="1_prtqd"]
+
+[resource]
+script = ExtResource("1_prtqd")
+propertyName = "rj_GlobalWindNoiseTexture"
+metadata/_custom_type_script = "uid://bsreukpi8eiyy"
diff --git a/Runtime/Physics/Wind/Properties/rj_GlobalWindNoiseTextureProperty.tres b/Runtime/Physics/Wind/Properties/rj_GlobalWindNoiseTextureProperty.tres
new file mode 100644
index 0000000..804ad26
--- /dev/null
+++ b/Runtime/Physics/Wind/Properties/rj_GlobalWindNoiseTextureProperty.tres
@@ -0,0 +1,11 @@
+[gd_resource type="Resource" script_class="Sampler2DProperty" load_steps=4 format=3 uid="uid://efmv0fcfxlqe"]
+
+[ext_resource type="Resource" uid="uid://bnjsr0w6xwkho" path="res://addons/rokojori_action_library/Runtime/Physics/Wind/Properties/rj_GlobalWindNoiseTexture.tres" id="1_7ivdf"]
+[ext_resource type="Script" uid="uid://co43lpc6cforf" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/Properties/Sampler2DProperty.cs" id="2_ss2hx"]
+[ext_resource type="Texture2D" uid="uid://c30nul6romace" path="res://addons/rokojori_action_library/Runtime/Procedural/Noise/RGB 3D Noise.png" id="3_4n0un"]
+
+[resource]
+script = ExtResource("2_ss2hx")
+propertyName = ExtResource("1_7ivdf")
+value = ExtResource("3_4n0un")
+metadata/_custom_type_script = "uid://co43lpc6cforf"
diff --git a/Runtime/Physics/Wind/Properties/rj_GlobalWindPosition.tres b/Runtime/Physics/Wind/Properties/rj_GlobalWindPosition.tres
new file mode 100644
index 0000000..b83af5c
--- /dev/null
+++ b/Runtime/Physics/Wind/Properties/rj_GlobalWindPosition.tres
@@ -0,0 +1,8 @@
+[gd_resource type="Resource" script_class="Vector2PropertyName" load_steps=2 format=3 uid="uid://cqw5ebx5oq2p0"]
+
+[ext_resource type="Script" uid="uid://cebfjne1ewhnm" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/Vector2PropertyName.cs" id="1_xy81n"]
+
+[resource]
+script = ExtResource("1_xy81n")
+propertyName = "rj_GlobalWindPosition"
+metadata/_custom_type_script = "uid://cebfjne1ewhnm"
diff --git a/Runtime/Physics/Wind/Properties/rj_GlobalWindPositionProperty.tres b/Runtime/Physics/Wind/Properties/rj_GlobalWindPositionProperty.tres
new file mode 100644
index 0000000..56f60fd
--- /dev/null
+++ b/Runtime/Physics/Wind/Properties/rj_GlobalWindPositionProperty.tres
@@ -0,0 +1,9 @@
+[gd_resource type="Resource" script_class="Vector2Property" load_steps=3 format=3 uid="uid://bqm71chf8v7rs"]
+
+[ext_resource type="Resource" uid="uid://cqw5ebx5oq2p0" path="res://addons/rokojori_action_library/Runtime/Physics/Wind/Properties/rj_GlobalWindPosition.tres" id="1_laxhy"]
+[ext_resource type="Script" uid="uid://colw2dxvhfkxy" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/Properties/Vector2Property.cs" id="1_ujntv"]
+
+[resource]
+script = ExtResource("1_ujntv")
+propertyName = ExtResource("1_laxhy")
+metadata/_custom_type_script = "uid://colw2dxvhfkxy"
diff --git a/Runtime/Physics/Wind/Properties/rj_GlobalWindSpeed.tres b/Runtime/Physics/Wind/Properties/rj_GlobalWindSpeed.tres
new file mode 100644
index 0000000..5308839
--- /dev/null
+++ b/Runtime/Physics/Wind/Properties/rj_GlobalWindSpeed.tres
@@ -0,0 +1,8 @@
+[gd_resource type="Resource" script_class="FloatPropertyName" load_steps=2 format=3 uid="uid://bffjivxr8u7wy"]
+
+[ext_resource type="Script" uid="uid://jqgdm3r2u8xq" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/FloatPropertyName.cs" id="1_ljs1d"]
+
+[resource]
+script = ExtResource("1_ljs1d")
+propertyName = "rj_GlobalWindSpeed"
+metadata/_custom_type_script = "uid://jqgdm3r2u8xq"
diff --git a/Runtime/Physics/Wind/Properties/rj_GlobalWindSpeedProperty.tres b/Runtime/Physics/Wind/Properties/rj_GlobalWindSpeedProperty.tres
new file mode 100644
index 0000000..455a9ab
--- /dev/null
+++ b/Runtime/Physics/Wind/Properties/rj_GlobalWindSpeedProperty.tres
@@ -0,0 +1,9 @@
+[gd_resource type="Resource" script_class="FloatProperty" load_steps=3 format=3 uid="uid://dtmjjes2elpl0"]
+
+[ext_resource type="Script" uid="uid://cabo4a0q18w2o" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/Properties/FloatProperty.cs" id="1_4man4"]
+[ext_resource type="Resource" uid="uid://bffjivxr8u7wy" path="res://addons/rokojori_action_library/Runtime/Physics/Wind/Properties/rj_GlobalWindSpeed.tres" id="1_jny1i"]
+
+[resource]
+script = ExtResource("1_4man4")
+propertyName = ExtResource("1_jny1i")
+metadata/_custom_type_script = "uid://cabo4a0q18w2o"
diff --git a/Runtime/Physics/Wind/Speed/TextureKMHWindSpeed.cs b/Runtime/Physics/Wind/Speed/TextureKMHWindSpeed.cs
new file mode 100644
index 0000000..078a042
--- /dev/null
+++ b/Runtime/Physics/Wind/Speed/TextureKMHWindSpeed.cs
@@ -0,0 +1,37 @@
+
+using Godot;
+
+
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/WindManager.svg") ]
+ public partial class TextureKMHWindSpeed:WindSpeed
+ {
+ [Export]
+ public float km_hour = 10;
+
+ [Export]
+ public Vector2 textureSizeInMeters = new Vector2( 2048, 2048 );
+
+ public override float GetKMH()
+ {
+ return km_hour;
+ }
+
+ public override Vector2 GetNormalizedWindSpeedOffset( double delta, float minKMH, float maxKMH )
+ {
+ var clampedKM_Hour = Mathf.Clamp( km_hour, minKMH, maxKMH );
+ var km_min = clampedKM_Hour / 60f;
+ var km_sec = km_min / 60f;
+
+ var km_offset = (float)( delta * km_sec );
+ var m_offset = km_offset * 1000f;
+
+ return ( Vector2.One * m_offset ) / textureSizeInMeters;
+
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Physics/Wind/Speed/TextureKMHWindSpeed.cs.uid b/Runtime/Physics/Wind/Speed/TextureKMHWindSpeed.cs.uid
new file mode 100644
index 0000000..d29c7a2
--- /dev/null
+++ b/Runtime/Physics/Wind/Speed/TextureKMHWindSpeed.cs.uid
@@ -0,0 +1 @@
+uid://bqtjbr3babvd2
diff --git a/Runtime/Physics/Wind/Speed/WindSpeed.cs b/Runtime/Physics/Wind/Speed/WindSpeed.cs
new file mode 100644
index 0000000..5beba0f
--- /dev/null
+++ b/Runtime/Physics/Wind/Speed/WindSpeed.cs
@@ -0,0 +1,16 @@
+
+using Godot;
+
+
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/WindManager.svg") ]
+ public abstract partial class WindSpeed:Resource
+ {
+ public abstract Vector2 GetNormalizedWindSpeedOffset( double delta, float minKMH, float maxKMH );
+
+ public abstract float GetKMH();
+
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Physics/Wind/Speed/WindSpeed.cs.uid b/Runtime/Physics/Wind/Speed/WindSpeed.cs.uid
new file mode 100644
index 0000000..5ccd25f
--- /dev/null
+++ b/Runtime/Physics/Wind/Speed/WindSpeed.cs.uid
@@ -0,0 +1 @@
+uid://gbweyhm8dii5
diff --git a/Runtime/Physics/Wind/WindManager.cs b/Runtime/Physics/Wind/WindManager.cs
new file mode 100644
index 0000000..9b2c508
--- /dev/null
+++ b/Runtime/Physics/Wind/WindManager.cs
@@ -0,0 +1,71 @@
+
+using Godot;
+
+
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/WindManager.svg") ]
+ public partial class WindManager:Node
+ {
+ [Export]
+ public WindManagerData data;
+
+
+ public override void _Process( double delta )
+ {
+ var rm = Unique.Get();
+
+ if ( data == null || rm == null )
+ {
+ return;
+ }
+
+ UpdatePosition( rm, (float) delta );
+ UpdateDirection( rm, (float) delta );
+ UpdateSpeed( rm, (float) delta );
+ }
+
+
+ void UpdatePosition( RenderingManager rm, float delta )
+ {
+ var windPositionProperty = rm.data.GetGlobalPropertyByName( data.globalWindPositionPropertyName );
+
+ if ( windPositionProperty == null )
+ {
+ return;
+ }
+
+ var positionProperty = (Vector2Property) windPositionProperty;
+ var position = positionProperty.value;
+ position += -data.windSpeed.GetNormalizedWindSpeedOffset( delta, data.minimumScrollSpeedKMH, data.maximumScrollSpeedKMH ) * data.windDirection.Normalized();
+ positionProperty.value = position;
+ }
+
+ void UpdateDirection( RenderingManager rm, float delta )
+ {
+ var windDirectionProperty = rm.data.GetGlobalPropertyByName( data.globalWindDirectionPropertyName );
+
+ if ( windDirectionProperty == null )
+ {
+ return;
+ }
+
+ var directionProperty = (Vector2Property) windDirectionProperty;
+ directionProperty.value = data.windDirection.Normalized();
+ }
+
+ void UpdateSpeed( RenderingManager rm, float delta )
+ {
+ var windSpeedProperty = rm.data.GetGlobalPropertyByName( data.globalWindSpeeedPropertyName );
+
+ if ( windSpeedProperty == null )
+ {
+ return;
+ }
+
+ var speedProperty = (FloatProperty) windSpeedProperty;
+ speedProperty.value = data.windSpeed.GetKMH();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Physics/Wind/WindManager.cs.uid b/Runtime/Physics/Wind/WindManager.cs.uid
new file mode 100644
index 0000000..362debc
--- /dev/null
+++ b/Runtime/Physics/Wind/WindManager.cs.uid
@@ -0,0 +1 @@
+uid://4hkiet2dxff4
diff --git a/Runtime/Physics/Wind/WindManagerData.cs b/Runtime/Physics/Wind/WindManagerData.cs
new file mode 100644
index 0000000..7006f51
--- /dev/null
+++ b/Runtime/Physics/Wind/WindManagerData.cs
@@ -0,0 +1,33 @@
+
+using Godot;
+
+
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/WindManager.svg") ]
+ public partial class WindManagerData:Resource
+ {
+ [Export]
+ public Vector2 windDirection = new Vector2( 1, 0 );
+
+ [Export]
+ public WindSpeed windSpeed = new TextureKMHWindSpeed();
+
+ [Export]
+ public float minimumScrollSpeedKMH = 5;
+
+ [Export]
+ public float maximumScrollSpeedKMH = 100;
+
+ [Export]
+ public Vector2PropertyName globalWindPositionPropertyName;
+
+ [Export]
+ public Vector2PropertyName globalWindDirectionPropertyName;
+
+ [Export]
+ public FloatPropertyName globalWindSpeeedPropertyName;
+
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Physics/Wind/WindManagerData.cs.uid b/Runtime/Physics/Wind/WindManagerData.cs.uid
new file mode 100644
index 0000000..bfeebf9
--- /dev/null
+++ b/Runtime/Physics/Wind/WindManagerData.cs.uid
@@ -0,0 +1 @@
+uid://10mh4s2cbrwu
diff --git a/Runtime/Presets/Features/FeatureModuleList.cs b/Runtime/Presets/Features/FeatureModuleList.cs
new file mode 100644
index 0000000..968e63f
--- /dev/null
+++ b/Runtime/Presets/Features/FeatureModuleList.cs
@@ -0,0 +1,34 @@
+
+using Godot;
+using System.Threading.Tasks;
+
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass]
+ public partial class FeatureModuleList: FeatureModule
+ {
+ [Export]
+ public FeatureModule[] features = [];
+
+ public override async Task ProcessPass( PresetContext context )
+ {
+ if ( features == null )
+ {
+ return;
+ }
+
+ foreach ( var f in features )
+ {
+ if ( f == null )
+ {
+ continue;
+ }
+
+ await f.ProcessPass( context );
+ }
+
+ return;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Presets/Features/FeatureModuleList.cs.uid b/Runtime/Presets/Features/FeatureModuleList.cs.uid
new file mode 100644
index 0000000..14ef958
--- /dev/null
+++ b/Runtime/Presets/Features/FeatureModuleList.cs.uid
@@ -0,0 +1 @@
+uid://dp3hblyea1mle
diff --git a/Runtime/Procedural/Assets/Tree/TreeGenerator.cs b/Runtime/Procedural/Assets/Tree/TreeGenerator.cs
index 0069b43..5ad733d 100644
--- a/Runtime/Procedural/Assets/Tree/TreeGenerator.cs
+++ b/Runtime/Procedural/Assets/Tree/TreeGenerator.cs
@@ -390,7 +390,7 @@ namespace Rokojori
public Node3D structure;
- OcTree ocTree;
+ OcTree ocTree;
CustomTreeWalker walker;
async Task GenerateBranches()
@@ -414,7 +414,7 @@ namespace Rokojori
this.DestroyChildren();
- ocTree = new OcTree( GlobalPosition, rootHeight * 3 * maxLevel, 10 );
+ ocTree = new OcTree( GlobalPosition, rootHeight * 3 * maxLevel, 10 );
structure = this.CreateChild( "Tree Structure" );
@@ -497,11 +497,11 @@ namespace Rokojori
lastPoint.GlobalPosition = firstPoint.GlobalPosition;
- lastPoint.SetGlobalQuaternion( firstPoint.GetGlobalQuaternion() );
+ lastPoint.SetGlobalQuaternion( firstPoint.GlobalQuaternion() );
var additional = spline.CreateChild();
additional.GlobalPosition = lastPoint2.GlobalPosition;
- additional.SetGlobalQuaternion( lastPoint2.GetGlobalQuaternion() );
+ additional.SetGlobalQuaternion( lastPoint2.GlobalQuaternion() );
spline.ClearCurveCache();
spline.AutoOrientate();
diff --git a/Runtime/Procedural/Baking/DilateTexture.cs b/Runtime/Procedural/Baking/DilateTexture.cs
index d13b7da..26525ee 100644
--- a/Runtime/Procedural/Baking/DilateTexture.cs
+++ b/Runtime/Procedural/Baking/DilateTexture.cs
@@ -21,7 +21,7 @@ namespace Rokojori
public static readonly string dilateMaterialPath = "res://addons/rokojori_action_library/External/Imposter/materials/dilatate.material";
- public static Texture2DPropertyName alphaTex = Texture2DPropertyName.Create( "u_alpha_tex" );
+ public static Sampler2DPropertyName alphaTex = Sampler2DPropertyName.Create( "u_alpha_tex" );
public static BoolPropertyName alphaOverwrite = BoolPropertyName.Create( "u_alpha_overwrite" );
public async Task Create( Texture2D texture2D, Texture2D alphaMask = null )
diff --git a/Runtime/Procedural/Connectables/ConnectionPin.cs b/Runtime/Procedural/Connectables/ConnectionPin.cs
index 928ec39..55bf851 100644
--- a/Runtime/Procedural/Connectables/ConnectionPin.cs
+++ b/Runtime/Procedural/Connectables/ConnectionPin.cs
@@ -151,8 +151,8 @@ namespace Rokojori
public static void Connect( Node3D target, Node3D targetPin, Node3D sourcePin )
{
- var targetRotation = target.GetGlobalQuaternion();
- var targetPinRotation = targetPin.GetGlobalQuaternion();
+ var targetRotation = target.GlobalQuaternion();
+ var targetPinRotation = targetPin.GlobalQuaternion();
var pinToParent = targetPinRotation.GetDifference( targetRotation );
diff --git a/Runtime/Procedural/Connectables/ConnectionPinTester.cs b/Runtime/Procedural/Connectables/ConnectionPinTester.cs
index 21d1ae4..f1ff214 100644
--- a/Runtime/Procedural/Connectables/ConnectionPinTester.cs
+++ b/Runtime/Procedural/Connectables/ConnectionPinTester.cs
@@ -92,9 +92,9 @@ namespace Rokojori
update = false;
- var targetRotation = fromPin.GetGlobalQuaternion();
- var currentPinRotation = toPin.GetGlobalQuaternion();
- var parentRotation = applyingTarget.GetGlobalQuaternion();
+ var targetRotation = fromPin.GlobalQuaternion();
+ var currentPinRotation = toPin.GlobalQuaternion();
+ var parentRotation = applyingTarget.GlobalQuaternion();
var pinToParent = diff_reverse ?
@@ -137,9 +137,9 @@ namespace Rokojori
var eulerRads = eulerRotation / 180 * Mathf.Pi;
- var targetRotation = fromPin.GetGlobalQuaternion();
+ var targetRotation = fromPin.GlobalQuaternion();
- var currentRotation = toPin.GetGlobalQuaternion();
+ var currentRotation = toPin.GlobalQuaternion();
@@ -150,7 +150,7 @@ namespace Rokojori
Math3D.GetQuaternionDifference( targetRotation, currentRotation );
- var oldRotation = applyingTarget.GetGlobalQuaternion();
+ var oldRotation = applyingTarget.GlobalQuaternion();
var resultRotation = mult_reverse ? neededRotation * currentRotation :
oldRotation * neededRotation;
diff --git a/Runtime/Procedural/Mesh/MeshCombiner.cs b/Runtime/Procedural/Mesh/MeshCombiner.cs
index 3e6f255..f0e65ce 100644
--- a/Runtime/Procedural/Mesh/MeshCombiner.cs
+++ b/Runtime/Procedural/Mesh/MeshCombiner.cs
@@ -294,7 +294,7 @@ namespace Rokojori
var hasAlpha = hasAlebdoAlpha && t == "albedo";
- var name = Texture2DPropertyName.Create( t + "_texture" );
+ var name = Sampler2DPropertyName.Create( t + "_texture" );
var textures = Lists.Map( materials, m => name.Get( m ) );
var noTextures = textures.Find( t => t != null ) == null;
diff --git a/Runtime/Procedural/Mesh/MeshGeometry.cs b/Runtime/Procedural/Mesh/MeshGeometry.cs
index bc5f705..b89cdaf 100644
--- a/Runtime/Procedural/Mesh/MeshGeometry.cs
+++ b/Runtime/Procedural/Mesh/MeshGeometry.cs
@@ -1542,6 +1542,10 @@ namespace Rokojori
return mg;
}
+ public void SetColor( Color color )
+ {
+ this.colors = this.vertices.Map( v => color );
+ }
public ArrayMesh GenerateMesh(
Mesh.PrimitiveType type = Mesh.PrimitiveType.Triangles, ArrayMesh arrayMesh = null,
diff --git a/Runtime/Procedural/Noise/RGB 3D Noise.png.import b/Runtime/Procedural/Noise/RGB 3D Noise.png.import
index 9056d69..89db17b 100644
--- a/Runtime/Procedural/Noise/RGB 3D Noise.png.import
+++ b/Runtime/Procedural/Noise/RGB 3D Noise.png.import
@@ -3,20 +3,19 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://c30nul6romace"
-path.s3tc="res://.godot/imported/RGB 3D Noise.png-daebfe00d2f3fcd5d3bc528f8a3972e1.s3tc.ctex"
+path="res://.godot/imported/RGB 3D Noise.png-daebfe00d2f3fcd5d3bc528f8a3972e1.ctex"
metadata={
-"imported_formats": ["s3tc_bptc"],
-"vram_texture": true
+"vram_texture": false
}
[deps]
source_file="res://addons/rokojori_action_library/Runtime/Procedural/Noise/RGB 3D Noise.png"
-dest_files=["res://.godot/imported/RGB 3D Noise.png-daebfe00d2f3fcd5d3bc528f8a3972e1.s3tc.ctex"]
+dest_files=["res://.godot/imported/RGB 3D Noise.png-daebfe00d2f3fcd5d3bc528f8a3972e1.ctex"]
[params]
-compress/mode=2
+compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
diff --git a/Runtime/Procedural/Parametric/Plane/__PlaneMeshType__.cs b/Runtime/Procedural/Parametric/Plane/__PlaneMeshType__.cs
index d21a788..d093466 100644
--- a/Runtime/Procedural/Parametric/Plane/__PlaneMeshType__.cs
+++ b/Runtime/Procedural/Parametric/Plane/__PlaneMeshType__.cs
@@ -9,7 +9,7 @@ namespace Rokojori
{
[Tool]
[GlobalClass]
- public partial class __PlaneMeshType__:Resource
+ public abstract partial class __PlaneMeshType__:Resource
{
public virtual List GetMeshGeometries( float width, float height )
{
diff --git a/Runtime/Procedural/Parametric/QuadBillboards/QuadBillboardsFromMesh.cs b/Runtime/Procedural/Parametric/QuadBillboards/QuadBillboardsFromMesh.cs
index 31dbaad..2a618bc 100644
--- a/Runtime/Procedural/Parametric/QuadBillboards/QuadBillboardsFromMesh.cs
+++ b/Runtime/Procedural/Parametric/QuadBillboards/QuadBillboardsFromMesh.cs
@@ -83,7 +83,7 @@ namespace Rokojori
var d = new QuadBillboardData();
d.position = GlobalPosition - parent.GlobalPosition;
- d.rotation = this.GetGlobalQuaternion();
+ d.rotation = this.GlobalQuaternion();
d.scale = Scale;
d.visible = true;
diff --git a/Runtime/Procedural/Parametric/QuadBillboards/SingleQuadBillboard.cs b/Runtime/Procedural/Parametric/QuadBillboards/SingleQuadBillboard.cs
index 2d28e87..5ce2e20 100644
--- a/Runtime/Procedural/Parametric/QuadBillboards/SingleQuadBillboard.cs
+++ b/Runtime/Procedural/Parametric/QuadBillboards/SingleQuadBillboard.cs
@@ -30,7 +30,7 @@ namespace Rokojori
var parent = GetParent();
var d = new QuadBillboardData();
d.position = GlobalPosition - parent.GlobalPosition;
- d.rotation = this.GetGlobalQuaternion();
+ d.rotation = this.GlobalQuaternion();
d.scale = Scale;
d.visible = true;
diff --git a/Runtime/Procedural/Parametric/Spline/Spline.cs b/Runtime/Procedural/Parametric/Spline/Spline.cs
index 746722e..969938e 100644
--- a/Runtime/Procedural/Parametric/Spline/Spline.cs
+++ b/Runtime/Procedural/Parametric/Spline/Spline.cs
@@ -18,7 +18,26 @@ namespace Rokojori
, GizmoDrawer
#endif
- {
+ {
+
+ public static Spline Create( Node parent, List points, bool closed = false )
+ {
+ var spline = parent.CreateChild();
+
+ spline.closed = closed;
+ spline.autoOrienation = true;
+
+ points.ForEach(
+ ( p )=>
+ {
+ var sp = spline.CreateChild();
+ sp.GlobalPosition = p;
+ }
+ );
+
+ return spline;
+ }
+
[Export]
public bool closed = false;
diff --git a/Runtime/Procedural/Parametric/Spline/SplineMesh.cs b/Runtime/Procedural/Parametric/Spline/SplineMesh.cs
new file mode 100644
index 0000000..245ae8e
--- /dev/null
+++ b/Runtime/Procedural/Parametric/Spline/SplineMesh.cs
@@ -0,0 +1,84 @@
+
+using Godot;
+using Rokojori;
+using System.Collections.Generic;
+
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Spline.svg") ]
+ public partial class SplineMesh : Action
+ {
+ [Export]
+ public Spline spline;
+
+ [Export]
+ public float splineRadius = 0.5f;
+
+ [Export]
+ public float resolutionU = 0.1f;
+
+ [Export]
+ public int maxSegmentsU = 64;
+
+
+ [Export]
+ public float resolutionV = 0.5f;
+
+ [Export]
+ public int maxSegmentsV = 1024;
+
+ [Export]
+ public MeshInstance3D output;
+
+ [Export]
+ public bool undistortSplineSegments = false;
+
+ protected override void _OnTrigger()
+ {
+ CreateMesh();
+ }
+
+ public void CreateMesh()
+ {
+ var curve = spline.GetCurve();
+
+ var length = curve.ComputeLength( 100 );
+ var numPoints = Mathf.Clamp( length / resolutionU, 2, maxSegmentsU );
+
+ var uSegments = (int) ( Mathf.Clamp( splineRadius * 2f * 3.14f / resolutionV, 3, maxSegmentsV ) );
+ var vSegments = (int) ( numPoints - 1 );
+
+
+ var uvFunction = ( Vector2 uv ) =>
+ {
+ var t = undistortSplineSegments ? curve.ComputeTforNormalizedCurveLength( uv.Y, vSegments ) : uv.Y;
+ var index = curve.NormalizedToPointIndex( t );
+ var pose = curve.PoseAt( t );
+ var radiusSize = splineRadius;
+
+ var angle = uv.X * 2f * Mathf.Pi;
+ var circlePose = Pose.Create( Vector3.Zero, pose.rotation * Math3D.RotateZ( angle ) );
+
+ circlePose.rotation = circlePose.rotation.Normalized();
+ var circleStart = Vector3.Up * radiusSize;
+ var positionOnCircle = circlePose.Apply( circleStart );
+
+ return Pose.Create( positionOnCircle + pose.position, circlePose.rotation );
+ };
+
+ var mg = MeshGeometry.CreateFromUVFunction( uvFunction, uSegments, vSegments );
+ mg.Add( MeshGeometry.CreateCapUVFunction( uvFunction, uSegments, true ) );
+ mg.Add( MeshGeometry.CreateCapUVFunction( uvFunction, uSegments, false ) );
+
+ if ( output == null )
+ {
+ output = this.CreateChild( "Spline MeshInstance");
+ }
+
+ output.Mesh = mg.GenerateMesh();
+
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Procedural/Parametric/Spline/SplineMesh.cs.uid b/Runtime/Procedural/Parametric/Spline/SplineMesh.cs.uid
new file mode 100644
index 0000000..89e9f42
--- /dev/null
+++ b/Runtime/Procedural/Parametric/Spline/SplineMesh.cs.uid
@@ -0,0 +1 @@
+uid://dw2p3gdt848qc
diff --git a/Runtime/Procedural/Parametric/Tube/Tube.cs b/Runtime/Procedural/Parametric/Tube/Tube.cs
index f8d0632..4befd95 100644
--- a/Runtime/Procedural/Parametric/Tube/Tube.cs
+++ b/Runtime/Procedural/Parametric/Tube/Tube.cs
@@ -80,7 +80,7 @@ namespace Rokojori
public bool updateAlways;
-#if TOOLS
+ #if TOOLS
public void DrawGizmo( EditorNode3DGizmoPlugin gizmoPlugin, EditorNode3DGizmo gizmo )
{
@@ -142,6 +142,18 @@ namespace Rokojori
update = false;
+ UpdateMesh();
+
+ // this.LogInfo( "Updating mesh" );
+
+ UpdateGizmos();
+
+ }
+
+ #endif
+
+ public void UpdateMesh()
+ {
var mg = CreateMesh();
if ( output == null )
@@ -150,12 +162,7 @@ namespace Rokojori
}
output.Mesh = mg.GenerateMesh();
-
- UpdateGizmos();
-
}
-
-#endif
MeshGeometry CreateMesh()
{
diff --git a/Runtime/Procedural/Parametric/Tube/TubeGeometry.cs b/Runtime/Procedural/Parametric/Tube/TubeGeometry.cs
index 5b5a5ed..4bed050 100644
--- a/Runtime/Procedural/Parametric/Tube/TubeGeometry.cs
+++ b/Runtime/Procedural/Parametric/Tube/TubeGeometry.cs
@@ -113,6 +113,8 @@ namespace Rokojori
circlePose.rotation = circlePose.rotation.Normalized();
+
+ // RJLog.Log( circlePose.rotation, pose.rotation, radiusSize, angle, ">>", Math3D.RotateZ( angle ) );
var circleStart = Vector3.Up * radiusSize * scale;
diff --git a/Runtime/Procedural/Parametric/Tube/TubeGeometrySettings.cs b/Runtime/Procedural/Parametric/Tube/TubeGeometrySettings.cs
index 2357e54..0aa0ff4 100644
--- a/Runtime/Procedural/Parametric/Tube/TubeGeometrySettings.cs
+++ b/Runtime/Procedural/Parametric/Tube/TubeGeometrySettings.cs
@@ -22,7 +22,7 @@ namespace Rokojori
[Export]
public Curve twistCurve;
[Export]
- public float radius;
+ public float radius = 1f;
[Export]
public int radialSegments = 8;
[Export]
diff --git a/Runtime/Procedural/Points/PointData.cs b/Runtime/Procedural/Points/PointData.cs
index 4ac00ee..59576ef 100644
--- a/Runtime/Procedural/Points/PointData.cs
+++ b/Runtime/Procedural/Points/PointData.cs
@@ -22,7 +22,7 @@ namespace Rokojori
position : parent.ToGlobal( position );
public Quaternion globalRotation => useGlobalRotation || parent == null ?
- rotation : parent.GetGlobalQuaternion() * rotation;
+ rotation : parent.GlobalQuaternion() * rotation;
public Vector3 globalScale => parent == null ? scale : parent.Scale * scale;
diff --git a/Runtime/Procedural/Textures/TextureCombiner/TextureCombinerMaterialOutput.cs b/Runtime/Procedural/Textures/TextureCombiner/TextureCombinerMaterialOutput.cs
index d279381..adbe6e8 100644
--- a/Runtime/Procedural/Textures/TextureCombiner/TextureCombinerMaterialOutput.cs
+++ b/Runtime/Procedural/Textures/TextureCombiner/TextureCombinerMaterialOutput.cs
@@ -15,7 +15,7 @@ namespace Rokojori
public Material material;
[Export]
- public Texture2DPropertyName textureName;
+ public Sampler2DPropertyName textureName;
}
}
\ No newline at end of file
diff --git a/Runtime/Reallusion/Shaders/CCEyeMaterial.cs b/Runtime/Reallusion/Shaders/CCEyeMaterial.cs
index 0f9caea..d7268f3 100644
--- a/Runtime/Reallusion/Shaders/CCEyeMaterial.cs
+++ b/Runtime/Reallusion/Shaders/CCEyeMaterial.cs
@@ -10,8 +10,8 @@ namespace Rokojori
"res://addons/rokojori_action_library/Runtime/Reallusion/Shaders/CCEye.gdshader"
);
- public static readonly Texture2DPropertyName textureAlbedo = Texture2DPropertyName.Create( "texture_albedo" );
- public static readonly Texture2DPropertyName textureNormal = Texture2DPropertyName.Create( "texture_normal" );
+ public static readonly Sampler2DPropertyName textureAlbedo = Sampler2DPropertyName.Create( "texture_albedo" );
+ public static readonly Sampler2DPropertyName textureNormal = Sampler2DPropertyName.Create( "texture_normal" );
public static readonly FloatPropertyName normalScale = FloatPropertyName.Create( "normal_scale" );
public static readonly FloatPropertyName roughness = FloatPropertyName.Create( "roughness" );
public static readonly FloatPropertyName irisRange = FloatPropertyName.Create( "irisRange" );
diff --git a/Runtime/Reallusion/Shaders/CCPBROpacityMaterial.cs b/Runtime/Reallusion/Shaders/CCPBROpacityMaterial.cs
index d3c498b..55e352f 100644
--- a/Runtime/Reallusion/Shaders/CCPBROpacityMaterial.cs
+++ b/Runtime/Reallusion/Shaders/CCPBROpacityMaterial.cs
@@ -11,40 +11,40 @@ namespace Rokojori
);
public static readonly ColorPropertyName albedo = ColorPropertyName.Create( "albedo" );
- public static readonly Texture2DPropertyName textureAlbedo = Texture2DPropertyName.Create( "texture_albedo" );
+ public static readonly Sampler2DPropertyName textureAlbedo = Sampler2DPropertyName.Create( "texture_albedo" );
public static readonly Vector2IPropertyName albedoTextureSize = Vector2IPropertyName.Create( "albedo_texture_size" );
public static readonly FloatPropertyName pointSize = FloatPropertyName.Create( "point_size" );
- public static readonly Texture2DPropertyName textureOpacity = Texture2DPropertyName.Create( "texture_opacity" );
+ public static readonly Sampler2DPropertyName textureOpacity = Sampler2DPropertyName.Create( "texture_opacity" );
public static readonly FloatPropertyName opacity = FloatPropertyName.Create( "opacity" );
public static readonly FloatPropertyName roughness = FloatPropertyName.Create( "roughness" );
- public static readonly Texture2DPropertyName textureMetallic = Texture2DPropertyName.Create( "texture_metallic" );
+ public static readonly Sampler2DPropertyName textureMetallic = Sampler2DPropertyName.Create( "texture_metallic" );
public static readonly Vector4PropertyName metallicTextureChannel = Vector4PropertyName.Create( "metallic_texture_channel" );
- public static readonly Texture2DPropertyName textureRoughness = Texture2DPropertyName.Create( "texture_roughness" );
+ public static readonly Sampler2DPropertyName textureRoughness = Sampler2DPropertyName.Create( "texture_roughness" );
public static readonly FloatPropertyName specular = FloatPropertyName.Create( "specular" );
public static readonly FloatPropertyName metallic = FloatPropertyName.Create( "metallic" );
- public static readonly Texture2DPropertyName textureEmission = Texture2DPropertyName.Create( "texture_emission" );
+ public static readonly Sampler2DPropertyName textureEmission = Sampler2DPropertyName.Create( "texture_emission" );
public static readonly ColorPropertyName emission = ColorPropertyName.Create( "emission" );
public static readonly FloatPropertyName emissionEnergy = FloatPropertyName.Create( "emission_energy" );
- public static readonly Texture2DPropertyName textureNormal = Texture2DPropertyName.Create( "texture_normal" );
+ public static readonly Sampler2DPropertyName textureNormal = Sampler2DPropertyName.Create( "texture_normal" );
public static readonly FloatPropertyName normalScale = FloatPropertyName.Create( "normal_scale" );
public static readonly FloatPropertyName rim = FloatPropertyName.Create( "rim" );
public static readonly FloatPropertyName rimTint = FloatPropertyName.Create( "rim_tint" );
- public static readonly Texture2DPropertyName textureRim = Texture2DPropertyName.Create( "texture_rim" );
+ public static readonly Sampler2DPropertyName textureRim = Sampler2DPropertyName.Create( "texture_rim" );
public static readonly FloatPropertyName clearcoat = FloatPropertyName.Create( "clearcoat" );
public static readonly FloatPropertyName clearcoatRoughness = FloatPropertyName.Create( "clearcoat_roughness" );
- public static readonly Texture2DPropertyName textureClearcoat = Texture2DPropertyName.Create( "texture_clearcoat" );
- public static readonly Texture2DPropertyName textureAmbientOcclusion = Texture2DPropertyName.Create( "texture_ambient_occlusion" );
+ public static readonly Sampler2DPropertyName textureClearcoat = Sampler2DPropertyName.Create( "texture_clearcoat" );
+ public static readonly Sampler2DPropertyName textureAmbientOcclusion = Sampler2DPropertyName.Create( "texture_ambient_occlusion" );
public static readonly Vector4PropertyName aoTextureChannel = Vector4PropertyName.Create( "ao_texture_channel" );
public static readonly FloatPropertyName aoLightAffect = FloatPropertyName.Create( "ao_light_affect" );
public static readonly FloatPropertyName subsurfaceScatteringStrength = FloatPropertyName.Create( "subsurface_scattering_strength" );
- public static readonly Texture2DPropertyName textureSubsurfaceScattering = Texture2DPropertyName.Create( "texture_subsurface_scattering" );
+ public static readonly Sampler2DPropertyName textureSubsurfaceScattering = Sampler2DPropertyName.Create( "texture_subsurface_scattering" );
public static readonly ColorPropertyName transmittanceColor = ColorPropertyName.Create( "transmittance_color" );
public static readonly FloatPropertyName transmittanceDepth = FloatPropertyName.Create( "transmittance_depth" );
- public static readonly Texture2DPropertyName textureSubsurfaceTransmittance = Texture2DPropertyName.Create( "texture_subsurface_transmittance" );
+ public static readonly Sampler2DPropertyName textureSubsurfaceTransmittance = Sampler2DPropertyName.Create( "texture_subsurface_transmittance" );
public static readonly FloatPropertyName transmittanceBoost = FloatPropertyName.Create( "transmittance_boost" );
public static readonly ColorPropertyName backlight = ColorPropertyName.Create( "backlight" );
- public static readonly Texture2DPropertyName textureBacklight = Texture2DPropertyName.Create( "texture_backlight" );
- public static readonly Texture2DPropertyName textureHeightmap = Texture2DPropertyName.Create( "texture_heightmap" );
+ public static readonly Sampler2DPropertyName textureBacklight = Sampler2DPropertyName.Create( "texture_backlight" );
+ public static readonly Sampler2DPropertyName textureHeightmap = Sampler2DPropertyName.Create( "texture_heightmap" );
public static readonly FloatPropertyName heightmapScale = FloatPropertyName.Create( "heightmap_scale" );
public static readonly IntPropertyName heightmapMinLayers = IntPropertyName.Create( "heightmap_min_layers" );
public static readonly IntPropertyName heightmapMaxLayers = IntPropertyName.Create( "heightmap_max_layers" );
diff --git a/Runtime/Reallusion/Shaders/CCSkinMaterial.cs b/Runtime/Reallusion/Shaders/CCSkinMaterial.cs
index 7c022b6..3b4f601 100644
--- a/Runtime/Reallusion/Shaders/CCSkinMaterial.cs
+++ b/Runtime/Reallusion/Shaders/CCSkinMaterial.cs
@@ -11,8 +11,8 @@ namespace Rokojori
);
public static readonly ColorPropertyName albedo = ColorPropertyName.Create( "albedo" );
- public static readonly Texture2DPropertyName textureAlbedo = Texture2DPropertyName.Create( "texture_albedo" );
- public static readonly Texture2DPropertyName textureAlbedoNoise = Texture2DPropertyName.Create( "texture_albedoNoise" );
+ public static readonly Sampler2DPropertyName textureAlbedo = Sampler2DPropertyName.Create( "texture_albedo" );
+ public static readonly Sampler2DPropertyName textureAlbedoNoise = Sampler2DPropertyName.Create( "texture_albedoNoise" );
public static readonly FloatPropertyName albedoNoise = FloatPropertyName.Create( "albedoNoise" );
public static readonly FloatPropertyName albedoNoiseOffset = FloatPropertyName.Create( "albedoNoiseOffset" );
public static readonly FloatPropertyName albedoNoiseUvScale = FloatPropertyName.Create( "albedoNoiseUVScale" );
@@ -21,20 +21,20 @@ namespace Rokojori
public static readonly FloatPropertyName roughnessOffset = FloatPropertyName.Create( "roughnessOffset" );
public static readonly FloatPropertyName roughnessOverwriteAmount = FloatPropertyName.Create( "roughnessOverwriteAmount" );
public static readonly FloatPropertyName roughnessOverwriteValue = FloatPropertyName.Create( "roughnessOverwriteValue" );
- public static readonly Texture2DPropertyName textureRoughness = Texture2DPropertyName.Create( "texture_roughness" );
+ public static readonly Sampler2DPropertyName textureRoughness = Sampler2DPropertyName.Create( "texture_roughness" );
public static readonly FloatPropertyName specular = FloatPropertyName.Create( "specular" );
- public static readonly Texture2DPropertyName textureSpecular = Texture2DPropertyName.Create( "texture_specular" );
- public static readonly Texture2DPropertyName textureNormal = Texture2DPropertyName.Create( "texture_normal" );
+ public static readonly Sampler2DPropertyName textureSpecular = Sampler2DPropertyName.Create( "texture_specular" );
+ public static readonly Sampler2DPropertyName textureNormal = Sampler2DPropertyName.Create( "texture_normal" );
public static readonly FloatPropertyName normalScale = FloatPropertyName.Create( "normal_scale" );
public static readonly FloatPropertyName rim = FloatPropertyName.Create( "rim" );
public static readonly FloatPropertyName rimTint = FloatPropertyName.Create( "rim_tint" );
- public static readonly Texture2DPropertyName textureAmbientOcclusion = Texture2DPropertyName.Create( "texture_ambient_occlusion" );
+ public static readonly Sampler2DPropertyName textureAmbientOcclusion = Sampler2DPropertyName.Create( "texture_ambient_occlusion" );
public static readonly FloatPropertyName aoLightAffect = FloatPropertyName.Create( "ao_light_affect" );
- public static readonly Texture2DPropertyName microNormalTexture = Texture2DPropertyName.Create( "microNormalTexture" );
- public static readonly Texture2DPropertyName microNormalMaskTexture = Texture2DPropertyName.Create( "microNormalMaskTexture" );
+ public static readonly Sampler2DPropertyName microNormalTexture = Sampler2DPropertyName.Create( "microNormalTexture" );
+ public static readonly Sampler2DPropertyName microNormalMaskTexture = Sampler2DPropertyName.Create( "microNormalMaskTexture" );
public static readonly FloatPropertyName microNormalScale = FloatPropertyName.Create( "microNormalScale" );
public static readonly FloatPropertyName subsurfaceScatteringStrength = FloatPropertyName.Create( "subsurface_scattering_strength" );
- public static readonly Texture2DPropertyName textureSubsurfaceScattering = Texture2DPropertyName.Create( "texture_subsurface_scattering" );
+ public static readonly Sampler2DPropertyName textureSubsurfaceScattering = Sampler2DPropertyName.Create( "texture_subsurface_scattering" );
public static readonly Vector3PropertyName uv1Scale = Vector3PropertyName.Create( "uv1_scale" );
public static readonly Vector3PropertyName uv1Offset = Vector3PropertyName.Create( "uv1_offset" );
public static readonly Vector3PropertyName uv2Scale = Vector3PropertyName.Create( "uv2_scale" );
diff --git a/Runtime/Reallusion/Shaders/CCSkinTransmissiveMaterial.cs b/Runtime/Reallusion/Shaders/CCSkinTransmissiveMaterial.cs
index f015fbf..3a05d28 100644
--- a/Runtime/Reallusion/Shaders/CCSkinTransmissiveMaterial.cs
+++ b/Runtime/Reallusion/Shaders/CCSkinTransmissiveMaterial.cs
@@ -11,8 +11,8 @@ namespace Rokojori
);
public static readonly ColorPropertyName albedo = ColorPropertyName.Create( "albedo" );
- public static readonly Texture2DPropertyName textureAlbedo = Texture2DPropertyName.Create( "texture_albedo" );
- public static readonly Texture2DPropertyName textureAlbedoNoise = Texture2DPropertyName.Create( "texture_albedoNoise" );
+ public static readonly Sampler2DPropertyName textureAlbedo = Sampler2DPropertyName.Create( "texture_albedo" );
+ public static readonly Sampler2DPropertyName textureAlbedoNoise = Sampler2DPropertyName.Create( "texture_albedoNoise" );
public static readonly FloatPropertyName albedoNoise = FloatPropertyName.Create( "albedoNoise" );
public static readonly FloatPropertyName albedoNoiseOffset = FloatPropertyName.Create( "albedoNoiseOffset" );
public static readonly FloatPropertyName albedoNoiseUvScale = FloatPropertyName.Create( "albedoNoiseUVScale" );
@@ -21,24 +21,24 @@ namespace Rokojori
public static readonly FloatPropertyName roughnessOffset = FloatPropertyName.Create( "roughnessOffset" );
public static readonly FloatPropertyName roughnessOverwriteAmount = FloatPropertyName.Create( "roughnessOverwriteAmount" );
public static readonly FloatPropertyName roughnessOverwriteValue = FloatPropertyName.Create( "roughnessOverwriteValue" );
- public static readonly Texture2DPropertyName textureRoughness = Texture2DPropertyName.Create( "texture_roughness" );
+ public static readonly Sampler2DPropertyName textureRoughness = Sampler2DPropertyName.Create( "texture_roughness" );
public static readonly FloatPropertyName specular = FloatPropertyName.Create( "specular" );
- public static readonly Texture2DPropertyName textureSpecular = Texture2DPropertyName.Create( "texture_specular" );
- public static readonly Texture2DPropertyName textureNormal = Texture2DPropertyName.Create( "texture_normal" );
+ public static readonly Sampler2DPropertyName textureSpecular = Sampler2DPropertyName.Create( "texture_specular" );
+ public static readonly Sampler2DPropertyName textureNormal = Sampler2DPropertyName.Create( "texture_normal" );
public static readonly FloatPropertyName normalScale = FloatPropertyName.Create( "normal_scale" );
public static readonly FloatPropertyName rim = FloatPropertyName.Create( "rim" );
public static readonly FloatPropertyName rimTint = FloatPropertyName.Create( "rim_tint" );
- public static readonly Texture2DPropertyName textureAmbientOcclusion = Texture2DPropertyName.Create( "texture_ambient_occlusion" );
+ public static readonly Sampler2DPropertyName textureAmbientOcclusion = Sampler2DPropertyName.Create( "texture_ambient_occlusion" );
public static readonly FloatPropertyName aoLightAffect = FloatPropertyName.Create( "ao_light_affect" );
- public static readonly Texture2DPropertyName microNormalTexture = Texture2DPropertyName.Create( "microNormalTexture" );
- public static readonly Texture2DPropertyName microNormalMaskTexture = Texture2DPropertyName.Create( "microNormalMaskTexture" );
+ public static readonly Sampler2DPropertyName microNormalTexture = Sampler2DPropertyName.Create( "microNormalTexture" );
+ public static readonly Sampler2DPropertyName microNormalMaskTexture = Sampler2DPropertyName.Create( "microNormalMaskTexture" );
public static readonly FloatPropertyName microNormalScale = FloatPropertyName.Create( "microNormalScale" );
public static readonly FloatPropertyName subsurfaceScatteringStrength = FloatPropertyName.Create( "subsurface_scattering_strength" );
- public static readonly Texture2DPropertyName textureSubsurfaceScattering = Texture2DPropertyName.Create( "texture_subsurface_scattering" );
+ public static readonly Sampler2DPropertyName textureSubsurfaceScattering = Sampler2DPropertyName.Create( "texture_subsurface_scattering" );
public static readonly BoolPropertyName transmissionEnabled = BoolPropertyName.Create( "transmissionEnabled" );
public static readonly ColorPropertyName transmittanceColor = ColorPropertyName.Create( "transmittance_color" );
public static readonly FloatPropertyName transmittanceDepth = FloatPropertyName.Create( "transmittance_depth" );
- public static readonly Texture2DPropertyName textureSubsurfaceTransmittance = Texture2DPropertyName.Create( "texture_subsurface_transmittance" );
+ public static readonly Sampler2DPropertyName textureSubsurfaceTransmittance = Sampler2DPropertyName.Create( "texture_subsurface_transmittance" );
public static readonly FloatPropertyName transmittanceBoost = FloatPropertyName.Create( "transmittance_boost" );
public static readonly Vector3PropertyName uv1Scale = Vector3PropertyName.Create( "uv1_scale" );
public static readonly Vector3PropertyName uv1Offset = Vector3PropertyName.Create( "uv1_offset" );
diff --git a/Runtime/Reallusion/Shaders/Hair/Variants/CCHairAlphaBackMaterial.cs b/Runtime/Reallusion/Shaders/Hair/Variants/CCHairAlphaBackMaterial.cs
index fc91bfc..f710ee3 100644
--- a/Runtime/Reallusion/Shaders/Hair/Variants/CCHairAlphaBackMaterial.cs
+++ b/Runtime/Reallusion/Shaders/Hair/Variants/CCHairAlphaBackMaterial.cs
@@ -12,17 +12,17 @@ namespace Rokojori
public static readonly BoolPropertyName enabled = BoolPropertyName.Create( "enabled" );
public static readonly ColorPropertyName albedo = ColorPropertyName.Create( "albedo" );
- public static readonly Texture2DPropertyName textureAlbedo = Texture2DPropertyName.Create( "texture_albedo" );
+ public static readonly Sampler2DPropertyName textureAlbedo = Sampler2DPropertyName.Create( "texture_albedo" );
public static readonly Vector3PropertyName hslOffset = Vector3PropertyName.Create( "hslOffset" );
- public static readonly Texture2DPropertyName textureBlend = Texture2DPropertyName.Create( "texture_blend" );
+ public static readonly Sampler2DPropertyName textureBlend = Sampler2DPropertyName.Create( "texture_blend" );
public static readonly FloatPropertyName blendAmount = FloatPropertyName.Create( "blendAmount" );
public static readonly FloatPropertyName naturalColors = FloatPropertyName.Create( "naturalColors" );
- public static readonly Texture2DPropertyName textureOpacity = Texture2DPropertyName.Create( "texture_opacity" );
+ public static readonly Sampler2DPropertyName textureOpacity = Sampler2DPropertyName.Create( "texture_opacity" );
public static readonly FloatPropertyName opacity = FloatPropertyName.Create( "opacity" );
public static readonly FloatPropertyName opacityGamma = FloatPropertyName.Create( "opacityGamma" );
- public static readonly Texture2DPropertyName rootMap = Texture2DPropertyName.Create( "rootMap" );
- public static readonly Texture2DPropertyName flowMap = Texture2DPropertyName.Create( "flowMap" );
- public static readonly Texture2DPropertyName idMap = Texture2DPropertyName.Create( "idMap" );
+ public static readonly Sampler2DPropertyName rootMap = Sampler2DPropertyName.Create( "rootMap" );
+ public static readonly Sampler2DPropertyName flowMap = Sampler2DPropertyName.Create( "flowMap" );
+ public static readonly Sampler2DPropertyName idMap = Sampler2DPropertyName.Create( "idMap" );
public static readonly FloatPropertyName diffuseStrength = FloatPropertyName.Create( "diffuseStrength" );
public static readonly FloatPropertyName vertexColorStrength = FloatPropertyName.Create( "vertexColorStrength" );
public static readonly ColorPropertyName vertexGreyToColor = ColorPropertyName.Create( "vertexGreyToColor" );
@@ -50,22 +50,22 @@ namespace Rokojori
public static readonly FloatPropertyName highlightBInvert = FloatPropertyName.Create( "highlightBInvert" );
public static readonly FloatPropertyName roughness = FloatPropertyName.Create( "roughness" );
public static readonly FloatPropertyName roughnessOffset = FloatPropertyName.Create( "roughnessOffset" );
- public static readonly Texture2DPropertyName textureRoughness = Texture2DPropertyName.Create( "texture_roughness" );
+ public static readonly Sampler2DPropertyName textureRoughness = Sampler2DPropertyName.Create( "texture_roughness" );
public static readonly FloatPropertyName metallic = FloatPropertyName.Create( "metallic" );
public static readonly FloatPropertyName metallicOffset = FloatPropertyName.Create( "metallicOffset" );
- public static readonly Texture2DPropertyName textureMetallic = Texture2DPropertyName.Create( "texture_metallic" );
+ public static readonly Sampler2DPropertyName textureMetallic = Sampler2DPropertyName.Create( "texture_metallic" );
public static readonly FloatPropertyName specular = FloatPropertyName.Create( "specular" );
public static readonly FloatPropertyName specularOpacityAmount = FloatPropertyName.Create( "specularOpacityAmount" );
public static readonly FloatPropertyName specularOpacityGamma = FloatPropertyName.Create( "specularOpacityGamma" );
public static readonly FloatPropertyName anisotropyRatio = FloatPropertyName.Create( "anisotropy_ratio" );
- public static readonly Texture2DPropertyName textureEmission = Texture2DPropertyName.Create( "texture_emission" );
+ public static readonly Sampler2DPropertyName textureEmission = Sampler2DPropertyName.Create( "texture_emission" );
public static readonly ColorPropertyName emission = ColorPropertyName.Create( "emission" );
public static readonly FloatPropertyName emissionEnergy = FloatPropertyName.Create( "emission_energy" );
public static readonly ColorPropertyName backlight = ColorPropertyName.Create( "backlight" );
public static readonly FloatPropertyName albedoToBacklightAmount = FloatPropertyName.Create( "albedoToBacklightAmount" );
- public static readonly Texture2DPropertyName textureBacklight = Texture2DPropertyName.Create( "texture_backlight" );
+ public static readonly Sampler2DPropertyName textureBacklight = Sampler2DPropertyName.Create( "texture_backlight" );
public static readonly FloatPropertyName subsurfaceScatteringStrength = FloatPropertyName.Create( "subsurface_scattering_strength" );
- public static readonly Texture2DPropertyName textureAmbientOcclusion = Texture2DPropertyName.Create( "texture_ambient_occlusion" );
+ public static readonly Sampler2DPropertyName textureAmbientOcclusion = Sampler2DPropertyName.Create( "texture_ambient_occlusion" );
public static readonly FloatPropertyName aoLightAffect = FloatPropertyName.Create( "ao_light_affect" );
public static readonly FloatPropertyName ambientOcclusion = FloatPropertyName.Create( "ambientOcclusion" );
public static readonly FloatPropertyName aoGamma = FloatPropertyName.Create( "aoGamma" );
diff --git a/Runtime/Reallusion/Shaders/Hair/Variants/CCHairAlphaMaterial.cs b/Runtime/Reallusion/Shaders/Hair/Variants/CCHairAlphaMaterial.cs
index 1ab46cf..f69fa27 100644
--- a/Runtime/Reallusion/Shaders/Hair/Variants/CCHairAlphaMaterial.cs
+++ b/Runtime/Reallusion/Shaders/Hair/Variants/CCHairAlphaMaterial.cs
@@ -12,17 +12,17 @@ namespace Rokojori
public static readonly BoolPropertyName enabled = BoolPropertyName.Create( "enabled" );
public static readonly ColorPropertyName albedo = ColorPropertyName.Create( "albedo" );
- public static readonly Texture2DPropertyName textureAlbedo = Texture2DPropertyName.Create( "texture_albedo" );
+ public static readonly Sampler2DPropertyName textureAlbedo = Sampler2DPropertyName.Create( "texture_albedo" );
public static readonly Vector3PropertyName hslOffset = Vector3PropertyName.Create( "hslOffset" );
- public static readonly Texture2DPropertyName textureBlend = Texture2DPropertyName.Create( "texture_blend" );
+ public static readonly Sampler2DPropertyName textureBlend = Sampler2DPropertyName.Create( "texture_blend" );
public static readonly FloatPropertyName blendAmount = FloatPropertyName.Create( "blendAmount" );
public static readonly FloatPropertyName naturalColors = FloatPropertyName.Create( "naturalColors" );
- public static readonly Texture2DPropertyName textureOpacity = Texture2DPropertyName.Create( "texture_opacity" );
+ public static readonly Sampler2DPropertyName textureOpacity = Sampler2DPropertyName.Create( "texture_opacity" );
public static readonly FloatPropertyName opacity = FloatPropertyName.Create( "opacity" );
public static readonly FloatPropertyName opacityGamma = FloatPropertyName.Create( "opacityGamma" );
- public static readonly Texture2DPropertyName rootMap = Texture2DPropertyName.Create( "rootMap" );
- public static readonly Texture2DPropertyName flowMap = Texture2DPropertyName.Create( "flowMap" );
- public static readonly Texture2DPropertyName idMap = Texture2DPropertyName.Create( "idMap" );
+ public static readonly Sampler2DPropertyName rootMap = Sampler2DPropertyName.Create( "rootMap" );
+ public static readonly Sampler2DPropertyName flowMap = Sampler2DPropertyName.Create( "flowMap" );
+ public static readonly Sampler2DPropertyName idMap = Sampler2DPropertyName.Create( "idMap" );
public static readonly FloatPropertyName diffuseStrength = FloatPropertyName.Create( "diffuseStrength" );
public static readonly FloatPropertyName vertexColorStrength = FloatPropertyName.Create( "vertexColorStrength" );
public static readonly ColorPropertyName vertexGreyToColor = ColorPropertyName.Create( "vertexGreyToColor" );
@@ -50,22 +50,22 @@ namespace Rokojori
public static readonly FloatPropertyName highlightBInvert = FloatPropertyName.Create( "highlightBInvert" );
public static readonly FloatPropertyName roughness = FloatPropertyName.Create( "roughness" );
public static readonly FloatPropertyName roughnessOffset = FloatPropertyName.Create( "roughnessOffset" );
- public static readonly Texture2DPropertyName textureRoughness = Texture2DPropertyName.Create( "texture_roughness" );
+ public static readonly Sampler2DPropertyName textureRoughness = Sampler2DPropertyName.Create( "texture_roughness" );
public static readonly FloatPropertyName metallic = FloatPropertyName.Create( "metallic" );
public static readonly FloatPropertyName metallicOffset = FloatPropertyName.Create( "metallicOffset" );
- public static readonly Texture2DPropertyName textureMetallic = Texture2DPropertyName.Create( "texture_metallic" );
+ public static readonly Sampler2DPropertyName textureMetallic = Sampler2DPropertyName.Create( "texture_metallic" );
public static readonly FloatPropertyName specular = FloatPropertyName.Create( "specular" );
public static readonly FloatPropertyName specularOpacityAmount = FloatPropertyName.Create( "specularOpacityAmount" );
public static readonly FloatPropertyName specularOpacityGamma = FloatPropertyName.Create( "specularOpacityGamma" );
public static readonly FloatPropertyName anisotropyRatio = FloatPropertyName.Create( "anisotropy_ratio" );
- public static readonly Texture2DPropertyName textureEmission = Texture2DPropertyName.Create( "texture_emission" );
+ public static readonly Sampler2DPropertyName textureEmission = Sampler2DPropertyName.Create( "texture_emission" );
public static readonly ColorPropertyName emission = ColorPropertyName.Create( "emission" );
public static readonly FloatPropertyName emissionEnergy = FloatPropertyName.Create( "emission_energy" );
public static readonly ColorPropertyName backlight = ColorPropertyName.Create( "backlight" );
public static readonly FloatPropertyName albedoToBacklightAmount = FloatPropertyName.Create( "albedoToBacklightAmount" );
- public static readonly Texture2DPropertyName textureBacklight = Texture2DPropertyName.Create( "texture_backlight" );
+ public static readonly Sampler2DPropertyName textureBacklight = Sampler2DPropertyName.Create( "texture_backlight" );
public static readonly FloatPropertyName subsurfaceScatteringStrength = FloatPropertyName.Create( "subsurface_scattering_strength" );
- public static readonly Texture2DPropertyName textureAmbientOcclusion = Texture2DPropertyName.Create( "texture_ambient_occlusion" );
+ public static readonly Sampler2DPropertyName textureAmbientOcclusion = Sampler2DPropertyName.Create( "texture_ambient_occlusion" );
public static readonly FloatPropertyName aoLightAffect = FloatPropertyName.Create( "ao_light_affect" );
public static readonly FloatPropertyName ambientOcclusion = FloatPropertyName.Create( "ambientOcclusion" );
public static readonly FloatPropertyName aoGamma = FloatPropertyName.Create( "aoGamma" );
diff --git a/Runtime/Reallusion/Shaders/Hair/Variants/CCHairDiscardMaterial.cs b/Runtime/Reallusion/Shaders/Hair/Variants/CCHairDiscardMaterial.cs
index c30f23c..823a288 100644
--- a/Runtime/Reallusion/Shaders/Hair/Variants/CCHairDiscardMaterial.cs
+++ b/Runtime/Reallusion/Shaders/Hair/Variants/CCHairDiscardMaterial.cs
@@ -12,18 +12,18 @@ namespace Rokojori
public static readonly BoolPropertyName enabled = BoolPropertyName.Create( "enabled" );
public static readonly ColorPropertyName albedo = ColorPropertyName.Create( "albedo" );
- public static readonly Texture2DPropertyName textureAlbedo = Texture2DPropertyName.Create( "texture_albedo" );
+ public static readonly Sampler2DPropertyName textureAlbedo = Sampler2DPropertyName.Create( "texture_albedo" );
public static readonly Vector3PropertyName hslOffset = Vector3PropertyName.Create( "hslOffset" );
- public static readonly Texture2DPropertyName textureBlend = Texture2DPropertyName.Create( "texture_blend" );
+ public static readonly Sampler2DPropertyName textureBlend = Sampler2DPropertyName.Create( "texture_blend" );
public static readonly FloatPropertyName blendAmount = FloatPropertyName.Create( "blendAmount" );
public static readonly FloatPropertyName naturalColors = FloatPropertyName.Create( "naturalColors" );
- public static readonly Texture2DPropertyName textureOpacity = Texture2DPropertyName.Create( "texture_opacity" );
+ public static readonly Sampler2DPropertyName textureOpacity = Sampler2DPropertyName.Create( "texture_opacity" );
public static readonly FloatPropertyName opacity = FloatPropertyName.Create( "opacity" );
public static readonly FloatPropertyName opacityGamma = FloatPropertyName.Create( "opacityGamma" );
public static readonly FloatPropertyName alphaDiscardTreshold = FloatPropertyName.Create( "alphaDiscardTreshold" );
- public static readonly Texture2DPropertyName rootMap = Texture2DPropertyName.Create( "rootMap" );
- public static readonly Texture2DPropertyName flowMap = Texture2DPropertyName.Create( "flowMap" );
- public static readonly Texture2DPropertyName idMap = Texture2DPropertyName.Create( "idMap" );
+ public static readonly Sampler2DPropertyName rootMap = Sampler2DPropertyName.Create( "rootMap" );
+ public static readonly Sampler2DPropertyName flowMap = Sampler2DPropertyName.Create( "flowMap" );
+ public static readonly Sampler2DPropertyName idMap = Sampler2DPropertyName.Create( "idMap" );
public static readonly FloatPropertyName diffuseStrength = FloatPropertyName.Create( "diffuseStrength" );
public static readonly FloatPropertyName vertexColorStrength = FloatPropertyName.Create( "vertexColorStrength" );
public static readonly ColorPropertyName vertexGreyToColor = ColorPropertyName.Create( "vertexGreyToColor" );
@@ -51,22 +51,22 @@ namespace Rokojori
public static readonly FloatPropertyName highlightBInvert = FloatPropertyName.Create( "highlightBInvert" );
public static readonly FloatPropertyName roughness = FloatPropertyName.Create( "roughness" );
public static readonly FloatPropertyName roughnessOffset = FloatPropertyName.Create( "roughnessOffset" );
- public static readonly Texture2DPropertyName textureRoughness = Texture2DPropertyName.Create( "texture_roughness" );
+ public static readonly Sampler2DPropertyName textureRoughness = Sampler2DPropertyName.Create( "texture_roughness" );
public static readonly FloatPropertyName metallic = FloatPropertyName.Create( "metallic" );
public static readonly FloatPropertyName metallicOffset = FloatPropertyName.Create( "metallicOffset" );
- public static readonly Texture2DPropertyName textureMetallic = Texture2DPropertyName.Create( "texture_metallic" );
+ public static readonly Sampler2DPropertyName textureMetallic = Sampler2DPropertyName.Create( "texture_metallic" );
public static readonly FloatPropertyName specular = FloatPropertyName.Create( "specular" );
public static readonly FloatPropertyName specularOpacityAmount = FloatPropertyName.Create( "specularOpacityAmount" );
public static readonly FloatPropertyName specularOpacityGamma = FloatPropertyName.Create( "specularOpacityGamma" );
public static readonly FloatPropertyName anisotropyRatio = FloatPropertyName.Create( "anisotropy_ratio" );
- public static readonly Texture2DPropertyName textureEmission = Texture2DPropertyName.Create( "texture_emission" );
+ public static readonly Sampler2DPropertyName textureEmission = Sampler2DPropertyName.Create( "texture_emission" );
public static readonly ColorPropertyName emission = ColorPropertyName.Create( "emission" );
public static readonly FloatPropertyName emissionEnergy = FloatPropertyName.Create( "emission_energy" );
public static readonly ColorPropertyName backlight = ColorPropertyName.Create( "backlight" );
public static readonly FloatPropertyName albedoToBacklightAmount = FloatPropertyName.Create( "albedoToBacklightAmount" );
- public static readonly Texture2DPropertyName textureBacklight = Texture2DPropertyName.Create( "texture_backlight" );
+ public static readonly Sampler2DPropertyName textureBacklight = Sampler2DPropertyName.Create( "texture_backlight" );
public static readonly FloatPropertyName subsurfaceScatteringStrength = FloatPropertyName.Create( "subsurface_scattering_strength" );
- public static readonly Texture2DPropertyName textureAmbientOcclusion = Texture2DPropertyName.Create( "texture_ambient_occlusion" );
+ public static readonly Sampler2DPropertyName textureAmbientOcclusion = Sampler2DPropertyName.Create( "texture_ambient_occlusion" );
public static readonly FloatPropertyName aoLightAffect = FloatPropertyName.Create( "ao_light_affect" );
public static readonly FloatPropertyName ambientOcclusion = FloatPropertyName.Create( "ambientOcclusion" );
public static readonly FloatPropertyName aoGamma = FloatPropertyName.Create( "aoGamma" );
diff --git a/Runtime/Reallusion/Shaders/Hair/Variants/CCHairMaterial.cs b/Runtime/Reallusion/Shaders/Hair/Variants/CCHairMaterial.cs
index 4e8b303..51df7e0 100644
--- a/Runtime/Reallusion/Shaders/Hair/Variants/CCHairMaterial.cs
+++ b/Runtime/Reallusion/Shaders/Hair/Variants/CCHairMaterial.cs
@@ -12,18 +12,18 @@ namespace Rokojori
public static readonly BoolPropertyName enabled = BoolPropertyName.Create( "enabled" );
public static readonly ColorPropertyName albedo = ColorPropertyName.Create( "albedo" );
- public static readonly Texture2DPropertyName textureAlbedo = Texture2DPropertyName.Create( "texture_albedo" );
+ public static readonly Sampler2DPropertyName textureAlbedo = Sampler2DPropertyName.Create( "texture_albedo" );
public static readonly Vector3PropertyName hslOffset = Vector3PropertyName.Create( "hslOffset" );
- public static readonly Texture2DPropertyName textureBlend = Texture2DPropertyName.Create( "texture_blend" );
+ public static readonly Sampler2DPropertyName textureBlend = Sampler2DPropertyName.Create( "texture_blend" );
public static readonly FloatPropertyName blendAmount = FloatPropertyName.Create( "blendAmount" );
public static readonly FloatPropertyName naturalColors = FloatPropertyName.Create( "naturalColors" );
- public static readonly Texture2DPropertyName textureOpacity = Texture2DPropertyName.Create( "texture_opacity" );
+ public static readonly Sampler2DPropertyName textureOpacity = Sampler2DPropertyName.Create( "texture_opacity" );
public static readonly FloatPropertyName opacity = FloatPropertyName.Create( "opacity" );
public static readonly FloatPropertyName opacityGamma = FloatPropertyName.Create( "opacityGamma" );
public static readonly FloatPropertyName alphaDiscardTreshold = FloatPropertyName.Create( "alphaDiscardTreshold" );
- public static readonly Texture2DPropertyName rootMap = Texture2DPropertyName.Create( "rootMap" );
- public static readonly Texture2DPropertyName flowMap = Texture2DPropertyName.Create( "flowMap" );
- public static readonly Texture2DPropertyName idMap = Texture2DPropertyName.Create( "idMap" );
+ public static readonly Sampler2DPropertyName rootMap = Sampler2DPropertyName.Create( "rootMap" );
+ public static readonly Sampler2DPropertyName flowMap = Sampler2DPropertyName.Create( "flowMap" );
+ public static readonly Sampler2DPropertyName idMap = Sampler2DPropertyName.Create( "idMap" );
public static readonly FloatPropertyName diffuseStrength = FloatPropertyName.Create( "diffuseStrength" );
public static readonly FloatPropertyName vertexColorStrength = FloatPropertyName.Create( "vertexColorStrength" );
public static readonly ColorPropertyName vertexGreyToColor = ColorPropertyName.Create( "vertexGreyToColor" );
@@ -51,22 +51,22 @@ namespace Rokojori
public static readonly FloatPropertyName highlightBInvert = FloatPropertyName.Create( "highlightBInvert" );
public static readonly FloatPropertyName roughness = FloatPropertyName.Create( "roughness" );
public static readonly FloatPropertyName roughnessOffset = FloatPropertyName.Create( "roughnessOffset" );
- public static readonly Texture2DPropertyName textureRoughness = Texture2DPropertyName.Create( "texture_roughness" );
+ public static readonly Sampler2DPropertyName textureRoughness = Sampler2DPropertyName.Create( "texture_roughness" );
public static readonly FloatPropertyName metallic = FloatPropertyName.Create( "metallic" );
public static readonly FloatPropertyName metallicOffset = FloatPropertyName.Create( "metallicOffset" );
- public static readonly Texture2DPropertyName textureMetallic = Texture2DPropertyName.Create( "texture_metallic" );
+ public static readonly Sampler2DPropertyName textureMetallic = Sampler2DPropertyName.Create( "texture_metallic" );
public static readonly FloatPropertyName specular = FloatPropertyName.Create( "specular" );
public static readonly FloatPropertyName specularOpacityAmount = FloatPropertyName.Create( "specularOpacityAmount" );
public static readonly FloatPropertyName specularOpacityGamma = FloatPropertyName.Create( "specularOpacityGamma" );
public static readonly FloatPropertyName anisotropyRatio = FloatPropertyName.Create( "anisotropy_ratio" );
- public static readonly Texture2DPropertyName textureEmission = Texture2DPropertyName.Create( "texture_emission" );
+ public static readonly Sampler2DPropertyName textureEmission = Sampler2DPropertyName.Create( "texture_emission" );
public static readonly ColorPropertyName emission = ColorPropertyName.Create( "emission" );
public static readonly FloatPropertyName emissionEnergy = FloatPropertyName.Create( "emission_energy" );
public static readonly ColorPropertyName backlight = ColorPropertyName.Create( "backlight" );
public static readonly FloatPropertyName albedoToBacklightAmount = FloatPropertyName.Create( "albedoToBacklightAmount" );
- public static readonly Texture2DPropertyName textureBacklight = Texture2DPropertyName.Create( "texture_backlight" );
+ public static readonly Sampler2DPropertyName textureBacklight = Sampler2DPropertyName.Create( "texture_backlight" );
public static readonly FloatPropertyName subsurfaceScatteringStrength = FloatPropertyName.Create( "subsurface_scattering_strength" );
- public static readonly Texture2DPropertyName textureAmbientOcclusion = Texture2DPropertyName.Create( "texture_ambient_occlusion" );
+ public static readonly Sampler2DPropertyName textureAmbientOcclusion = Sampler2DPropertyName.Create( "texture_ambient_occlusion" );
public static readonly FloatPropertyName aoLightAffect = FloatPropertyName.Create( "ao_light_affect" );
public static readonly FloatPropertyName ambientOcclusion = FloatPropertyName.Create( "ambientOcclusion" );
public static readonly FloatPropertyName aoGamma = FloatPropertyName.Create( "aoGamma" );
diff --git a/Runtime/Reallusion/Shaders/Hair/Variants/CCHairScissorMaterial.cs b/Runtime/Reallusion/Shaders/Hair/Variants/CCHairScissorMaterial.cs
index 836471a..d8e6faa 100644
--- a/Runtime/Reallusion/Shaders/Hair/Variants/CCHairScissorMaterial.cs
+++ b/Runtime/Reallusion/Shaders/Hair/Variants/CCHairScissorMaterial.cs
@@ -12,18 +12,18 @@ namespace Rokojori
public static readonly BoolPropertyName enabled = BoolPropertyName.Create( "enabled" );
public static readonly ColorPropertyName albedo = ColorPropertyName.Create( "albedo" );
- public static readonly Texture2DPropertyName textureAlbedo = Texture2DPropertyName.Create( "texture_albedo" );
+ public static readonly Sampler2DPropertyName textureAlbedo = Sampler2DPropertyName.Create( "texture_albedo" );
public static readonly Vector3PropertyName hslOffset = Vector3PropertyName.Create( "hslOffset" );
- public static readonly Texture2DPropertyName textureBlend = Texture2DPropertyName.Create( "texture_blend" );
+ public static readonly Sampler2DPropertyName textureBlend = Sampler2DPropertyName.Create( "texture_blend" );
public static readonly FloatPropertyName blendAmount = FloatPropertyName.Create( "blendAmount" );
public static readonly FloatPropertyName naturalColors = FloatPropertyName.Create( "naturalColors" );
- public static readonly Texture2DPropertyName textureOpacity = Texture2DPropertyName.Create( "texture_opacity" );
+ public static readonly Sampler2DPropertyName textureOpacity = Sampler2DPropertyName.Create( "texture_opacity" );
public static readonly FloatPropertyName opacity = FloatPropertyName.Create( "opacity" );
public static readonly FloatPropertyName opacityGamma = FloatPropertyName.Create( "opacityGamma" );
public static readonly FloatPropertyName alphaScissorTreshold = FloatPropertyName.Create( "alphaScissorTreshold" );
- public static readonly Texture2DPropertyName rootMap = Texture2DPropertyName.Create( "rootMap" );
- public static readonly Texture2DPropertyName flowMap = Texture2DPropertyName.Create( "flowMap" );
- public static readonly Texture2DPropertyName idMap = Texture2DPropertyName.Create( "idMap" );
+ public static readonly Sampler2DPropertyName rootMap = Sampler2DPropertyName.Create( "rootMap" );
+ public static readonly Sampler2DPropertyName flowMap = Sampler2DPropertyName.Create( "flowMap" );
+ public static readonly Sampler2DPropertyName idMap = Sampler2DPropertyName.Create( "idMap" );
public static readonly FloatPropertyName diffuseStrength = FloatPropertyName.Create( "diffuseStrength" );
public static readonly FloatPropertyName vertexColorStrength = FloatPropertyName.Create( "vertexColorStrength" );
public static readonly ColorPropertyName vertexGreyToColor = ColorPropertyName.Create( "vertexGreyToColor" );
@@ -51,22 +51,22 @@ namespace Rokojori
public static readonly FloatPropertyName highlightBInvert = FloatPropertyName.Create( "highlightBInvert" );
public static readonly FloatPropertyName roughness = FloatPropertyName.Create( "roughness" );
public static readonly FloatPropertyName roughnessOffset = FloatPropertyName.Create( "roughnessOffset" );
- public static readonly Texture2DPropertyName textureRoughness = Texture2DPropertyName.Create( "texture_roughness" );
+ public static readonly Sampler2DPropertyName textureRoughness = Sampler2DPropertyName.Create( "texture_roughness" );
public static readonly FloatPropertyName metallic = FloatPropertyName.Create( "metallic" );
public static readonly FloatPropertyName metallicOffset = FloatPropertyName.Create( "metallicOffset" );
- public static readonly Texture2DPropertyName textureMetallic = Texture2DPropertyName.Create( "texture_metallic" );
+ public static readonly Sampler2DPropertyName textureMetallic = Sampler2DPropertyName.Create( "texture_metallic" );
public static readonly FloatPropertyName specular = FloatPropertyName.Create( "specular" );
public static readonly FloatPropertyName specularOpacityAmount = FloatPropertyName.Create( "specularOpacityAmount" );
public static readonly FloatPropertyName specularOpacityGamma = FloatPropertyName.Create( "specularOpacityGamma" );
public static readonly FloatPropertyName anisotropyRatio = FloatPropertyName.Create( "anisotropy_ratio" );
- public static readonly Texture2DPropertyName textureEmission = Texture2DPropertyName.Create( "texture_emission" );
+ public static readonly Sampler2DPropertyName textureEmission = Sampler2DPropertyName.Create( "texture_emission" );
public static readonly ColorPropertyName emission = ColorPropertyName.Create( "emission" );
public static readonly FloatPropertyName emissionEnergy = FloatPropertyName.Create( "emission_energy" );
public static readonly ColorPropertyName backlight = ColorPropertyName.Create( "backlight" );
public static readonly FloatPropertyName albedoToBacklightAmount = FloatPropertyName.Create( "albedoToBacklightAmount" );
- public static readonly Texture2DPropertyName textureBacklight = Texture2DPropertyName.Create( "texture_backlight" );
+ public static readonly Sampler2DPropertyName textureBacklight = Sampler2DPropertyName.Create( "texture_backlight" );
public static readonly FloatPropertyName subsurfaceScatteringStrength = FloatPropertyName.Create( "subsurface_scattering_strength" );
- public static readonly Texture2DPropertyName textureAmbientOcclusion = Texture2DPropertyName.Create( "texture_ambient_occlusion" );
+ public static readonly Sampler2DPropertyName textureAmbientOcclusion = Sampler2DPropertyName.Create( "texture_ambient_occlusion" );
public static readonly FloatPropertyName aoLightAffect = FloatPropertyName.Create( "ao_light_affect" );
public static readonly FloatPropertyName ambientOcclusion = FloatPropertyName.Create( "ambientOcclusion" );
public static readonly FloatPropertyName aoGamma = FloatPropertyName.Create( "aoGamma" );
diff --git a/Runtime/Reallusion/Shaders/Hair/Variants/CCHairShadowMaterial.cs b/Runtime/Reallusion/Shaders/Hair/Variants/CCHairShadowMaterial.cs
index 2374d11..625e8f7 100644
--- a/Runtime/Reallusion/Shaders/Hair/Variants/CCHairShadowMaterial.cs
+++ b/Runtime/Reallusion/Shaders/Hair/Variants/CCHairShadowMaterial.cs
@@ -12,12 +12,12 @@ namespace Rokojori
public static readonly BoolPropertyName enabled = BoolPropertyName.Create( "enabled" );
public static readonly ColorPropertyName albedo = ColorPropertyName.Create( "albedo" );
- public static readonly Texture2DPropertyName textureAlbedo = Texture2DPropertyName.Create( "texture_albedo" );
+ public static readonly Sampler2DPropertyName textureAlbedo = Sampler2DPropertyName.Create( "texture_albedo" );
public static readonly Vector3PropertyName hslOffset = Vector3PropertyName.Create( "hslOffset" );
- public static readonly Texture2DPropertyName textureBlend = Texture2DPropertyName.Create( "texture_blend" );
+ public static readonly Sampler2DPropertyName textureBlend = Sampler2DPropertyName.Create( "texture_blend" );
public static readonly FloatPropertyName blendAmount = FloatPropertyName.Create( "blendAmount" );
public static readonly FloatPropertyName naturalColors = FloatPropertyName.Create( "naturalColors" );
- public static readonly Texture2DPropertyName textureOpacity = Texture2DPropertyName.Create( "texture_opacity" );
+ public static readonly Sampler2DPropertyName textureOpacity = Sampler2DPropertyName.Create( "texture_opacity" );
public static readonly FloatPropertyName opacity = FloatPropertyName.Create( "opacity" );
public static readonly FloatPropertyName opacityGamma = FloatPropertyName.Create( "opacityGamma" );
public static readonly FloatPropertyName opacityFarScale = FloatPropertyName.Create( "opacityFarScale" );
@@ -27,9 +27,9 @@ namespace Rokojori
public static readonly FloatPropertyName opacityFarRange = FloatPropertyName.Create( "opacityFarRange" );
public static readonly FloatPropertyName opacityFarPower = FloatPropertyName.Create( "opacityFarPower" );
public static readonly FloatPropertyName extending = FloatPropertyName.Create( "extending" );
- public static readonly Texture2DPropertyName rootMap = Texture2DPropertyName.Create( "rootMap" );
- public static readonly Texture2DPropertyName flowMap = Texture2DPropertyName.Create( "flowMap" );
- public static readonly Texture2DPropertyName idMap = Texture2DPropertyName.Create( "idMap" );
+ public static readonly Sampler2DPropertyName rootMap = Sampler2DPropertyName.Create( "rootMap" );
+ public static readonly Sampler2DPropertyName flowMap = Sampler2DPropertyName.Create( "flowMap" );
+ public static readonly Sampler2DPropertyName idMap = Sampler2DPropertyName.Create( "idMap" );
public static readonly FloatPropertyName diffuseStrength = FloatPropertyName.Create( "diffuseStrength" );
public static readonly FloatPropertyName vertexColorStrength = FloatPropertyName.Create( "vertexColorStrength" );
public static readonly ColorPropertyName vertexGreyToColor = ColorPropertyName.Create( "vertexGreyToColor" );
@@ -57,22 +57,22 @@ namespace Rokojori
public static readonly FloatPropertyName highlightBInvert = FloatPropertyName.Create( "highlightBInvert" );
public static readonly FloatPropertyName roughness = FloatPropertyName.Create( "roughness" );
public static readonly FloatPropertyName roughnessOffset = FloatPropertyName.Create( "roughnessOffset" );
- public static readonly Texture2DPropertyName textureRoughness = Texture2DPropertyName.Create( "texture_roughness" );
+ public static readonly Sampler2DPropertyName textureRoughness = Sampler2DPropertyName.Create( "texture_roughness" );
public static readonly FloatPropertyName metallic = FloatPropertyName.Create( "metallic" );
public static readonly FloatPropertyName metallicOffset = FloatPropertyName.Create( "metallicOffset" );
- public static readonly Texture2DPropertyName textureMetallic = Texture2DPropertyName.Create( "texture_metallic" );
+ public static readonly Sampler2DPropertyName textureMetallic = Sampler2DPropertyName.Create( "texture_metallic" );
public static readonly FloatPropertyName specular = FloatPropertyName.Create( "specular" );
public static readonly FloatPropertyName specularOpacityAmount = FloatPropertyName.Create( "specularOpacityAmount" );
public static readonly FloatPropertyName specularOpacityGamma = FloatPropertyName.Create( "specularOpacityGamma" );
public static readonly FloatPropertyName anisotropyRatio = FloatPropertyName.Create( "anisotropy_ratio" );
- public static readonly Texture2DPropertyName textureEmission = Texture2DPropertyName.Create( "texture_emission" );
+ public static readonly Sampler2DPropertyName textureEmission = Sampler2DPropertyName.Create( "texture_emission" );
public static readonly ColorPropertyName emission = ColorPropertyName.Create( "emission" );
public static readonly FloatPropertyName emissionEnergy = FloatPropertyName.Create( "emission_energy" );
public static readonly ColorPropertyName backlight = ColorPropertyName.Create( "backlight" );
public static readonly FloatPropertyName albedoToBacklightAmount = FloatPropertyName.Create( "albedoToBacklightAmount" );
- public static readonly Texture2DPropertyName textureBacklight = Texture2DPropertyName.Create( "texture_backlight" );
+ public static readonly Sampler2DPropertyName textureBacklight = Sampler2DPropertyName.Create( "texture_backlight" );
public static readonly FloatPropertyName subsurfaceScatteringStrength = FloatPropertyName.Create( "subsurface_scattering_strength" );
- public static readonly Texture2DPropertyName textureAmbientOcclusion = Texture2DPropertyName.Create( "texture_ambient_occlusion" );
+ public static readonly Sampler2DPropertyName textureAmbientOcclusion = Sampler2DPropertyName.Create( "texture_ambient_occlusion" );
public static readonly FloatPropertyName aoLightAffect = FloatPropertyName.Create( "ao_light_affect" );
public static readonly FloatPropertyName ambientOcclusion = FloatPropertyName.Create( "ambientOcclusion" );
public static readonly FloatPropertyName aoGamma = FloatPropertyName.Create( "aoGamma" );
diff --git a/Runtime/Rendering/Assets/Foliage/FoliageData.cs b/Runtime/Rendering/Assets/Foliage/FoliageData.cs
index 76c7eca..80d0e98 100644
--- a/Runtime/Rendering/Assets/Foliage/FoliageData.cs
+++ b/Runtime/Rendering/Assets/Foliage/FoliageData.cs
@@ -224,10 +224,26 @@ namespace Rokojori
[ExportGroup("Scale")]
+ [Export]
+ public float uniScaleMin = 1.0f;
+
+ [Export]
+ public float uniScaleMax = 1.0f;
+
+ [Export]
+ public float uniScaleVarianceContrastScale = 1f;
+
+ [Export]
+ public float uniScaleVarianceContrastCenter = 0.5f;
+
+ [Export]
+ public Vector2 uniScaleVarianceOffset = new Vector2( 0.5f, 0.5f );
+
[Export]
public Vector3 scaleVarianceMinScale = Vector3.One;
[Export]
public Vector3 scaleVarianceMaxScale = Vector3.One;
+
[Export]
public float scaleVarianceScale = 1f;
[Export]
@@ -249,13 +265,42 @@ namespace Rokojori
[Export]
public float occupancyVarianceScale = 1f;
+
[Export]
public Vector2 occupancyVarianceOffset = Vector2.Zero;
+ [ExportGroup("Colliders")]
+
+ [Export]
+ public bool collidersEnabled = false;
+
+ [Export]
+ public int numMaxColliders = 0;
+
+ [Export]
+ public Shape3D colliderShape;
+
+ [Export]
+ public Vector3 colliderOffset = Vector3.Zero;
+
+ [Export]
+ public float colliderCellSize = 50f;
+
+ [Export]
+ public float colliderScaleOffset = 1.0f;
+
+ [Export]
+ public bool updateCollidersAlways = false;
+
public virtual void Initialize( FoliageRenderLayer renderLayer )
{
var particles = renderLayer.renderer.CreateChild( renderLayer.data.layerName );
+ if ( collidersEnabled )
+ {
+ renderLayer.collidersContainer = particles.CreateChild( "Colliders" );
+ }
+
renderLayer.gpuParticles3D = particles;
var processMaterial = new GPUFoliageShaderMaterial();
diff --git a/Runtime/Rendering/Assets/Foliage/FoliageMaterialOverrides/CustomMaterialOverride.cs b/Runtime/Rendering/Assets/Foliage/FoliageMaterialOverrides/CustomMaterialOverride.cs
new file mode 100644
index 0000000..9df9e78
--- /dev/null
+++ b/Runtime/Rendering/Assets/Foliage/FoliageMaterialOverrides/CustomMaterialOverride.cs
@@ -0,0 +1,55 @@
+using System.Collections;
+using System.Collections.Generic;
+using Godot;
+using System;
+using System.Threading.Tasks;
+
+
+
+namespace Rokojori
+{
+ /**
+
+
+ Resource to create foliage material overrides with custom materials
+
+
+
+
+
+
+
+ */
+
+ [Tool]
+ [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Scatterer.svg") ]
+ public partial class CustomMaterialOverride:FoliageMaterialOverride
+ {
+ [Export]
+ public Material customMaterial;
+
+ [Export]
+ public bool createDuplicate = true;
+
+ public override void CreateFoliageOverideMaterial( FoliageRenderLayer foliageRenderLayer )
+ {
+ var gpuParticles3D = foliageRenderLayer.gpuParticles3D;
+
+ var overrideMaterial = createDuplicate ? (Material)customMaterial.Duplicate() : customMaterial;
+ gpuParticles3D.MaterialOverride = overrideMaterial;
+
+ UpdateFoliageOverideMaterial( foliageRenderLayer );
+ }
+
+ public override void UpdateFoliageOverideMaterial( FoliageRenderLayer foliageRenderLayer )
+ {
+
+ }
+
+ public override Material GetOverrideMaterial( FoliageRenderLayer foliageRenderLayer )
+ {
+ var material = foliageRenderLayer.gpuParticles3D.MaterialOverride;
+ return material;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Rendering/Assets/Foliage/FoliageMaterialOverrides/CustomMaterialOverride.cs.uid b/Runtime/Rendering/Assets/Foliage/FoliageMaterialOverrides/CustomMaterialOverride.cs.uid
new file mode 100644
index 0000000..3d2dfd0
--- /dev/null
+++ b/Runtime/Rendering/Assets/Foliage/FoliageMaterialOverrides/CustomMaterialOverride.cs.uid
@@ -0,0 +1 @@
+uid://bnabp0o8rg7pc
diff --git a/Runtime/Rendering/Assets/Foliage/FoliageMaterialOverrides/StandardMaterialOverride.cs b/Runtime/Rendering/Assets/Foliage/FoliageMaterialOverrides/StandardMaterialOverride.cs
index 2c5fe2b..5cdaabd 100644
--- a/Runtime/Rendering/Assets/Foliage/FoliageMaterialOverrides/StandardMaterialOverride.cs
+++ b/Runtime/Rendering/Assets/Foliage/FoliageMaterialOverrides/StandardMaterialOverride.cs
@@ -8,10 +8,10 @@ using System.Threading.Tasks;
namespace Rokojori
{
- /**
+ /**
- Abstract archetype resource to create foliage material overrides
+ Resource to create foliage material overrides with standard material
diff --git a/Runtime/Rendering/Assets/Foliage/FoliageRenderLayer.cs b/Runtime/Rendering/Assets/Foliage/FoliageRenderLayer.cs
index 118ba37..0452ec9 100644
--- a/Runtime/Rendering/Assets/Foliage/FoliageRenderLayer.cs
+++ b/Runtime/Rendering/Assets/Foliage/FoliageRenderLayer.cs
@@ -30,8 +30,120 @@ namespace Rokojori
public int subLayerIndex = -1;
public GpuParticles3D gpuParticles3D;
public GPUFoliageShaderMaterial gpuFoliageShaderMaterial;
+ public Node3D collidersContainer;
+
float _lastCellSize = -1;
float _lastMaxVisibility = -1;
+
+ Vector2I lastCameraPosition;
+
+
+ public void UpdateColliders()
+ {
+ if ( ! data.collidersEnabled )
+ {
+ return;
+ }
+
+ var cameraPosition = gpuFoliageShaderMaterial.cameraPosition.GetCached();
+ var camXZ = cameraPosition.XZ();
+ var floored = (Vector2I) Math2D.SnapFloored( camXZ, data.colliderCellSize * Vector2.One );
+
+ if ( floored == lastCameraPosition && ! data.updateCollidersAlways )
+ {
+ return;
+ }
+
+ lastCameraPosition = floored;
+
+ // collidersContainer.LogInfo( "Updating Colliders:", lastCameraPosition );
+
+ var side = numParticlesPerSide();
+
+ var num = side * side;
+ var list = new List( num );
+ var centerDistance = new Dictionary();
+
+ var numInvalid = 0;
+
+ for ( int i = 0; i < num; i ++ )
+ {
+ var trsf = ComputeTransform( i );
+
+ if ( ! trsf.IsValid() )
+ {
+ if ( numInvalid == 0 )
+ {
+ RJLog.Log( trsf );
+ }
+
+ numInvalid ++;
+
+
+ continue;
+ }
+
+ list.Add( trsf );
+
+ var distance = ( trsf.Origin.XZ() - camXZ ).Length();
+ centerDistance[ trsf ] = distance;
+ }
+
+ list.Sort(
+ ( a, b )=>
+ {
+ var dA = centerDistance[ a ];
+ var dB = centerDistance[ b ];
+
+ return Mathf.Sign( dA - dB );
+ }
+ );
+
+ if ( numInvalid > 0 )
+ {
+ RJLog.Log( "Invalud:", numInvalid );
+ }
+
+ CreateCollidersPool();
+
+ for ( int i = 0; i < data.numMaxColliders; i++ )
+ {
+ var child = (StaticBody3D) collidersContainer.GetChild( i );
+
+ NodeState.SetEnabledState( child, i < list.Count );
+
+ if ( i < list.Count )
+ {
+ child.GlobalTransform = list[ i ];
+ }
+ }
+
+
+
+
+
+
+ }
+
+ void CreateCollidersPool()
+ {
+ if ( data.numMaxColliders == collidersContainer.GetChildCount() )
+ {
+ return;
+ }
+
+ collidersContainer.DestroyChildren();
+
+ for ( int i = 0; i < data.numMaxColliders; i++ )
+ {
+ var staticBody = collidersContainer.CreateChild( "Collider Body " + i );
+ var shape3D = staticBody.CreateChild( "Collision Shape " + i );
+ shape3D.Shape = data.colliderShape;
+ }
+ }
+
+
+
public static FoliageRenderLayer Create( FoliageRenderer renderer, FoliageData data, int subIndex = -1 )
{
@@ -48,7 +160,7 @@ namespace Rokojori
public void Update( double delta )
{
- if ( gpuFoliageShaderMaterial == null )
+ if ( gpuFoliageShaderMaterial == null || data == null )
{
return;
}
@@ -65,7 +177,7 @@ namespace Rokojori
return;
}
- gpuFoliageShaderMaterial.cameraPosition.Set( renderer.GetAssignedCamera().GlobalPosition );
+ gpuFoliageShaderMaterial.cameraPosition.SetCached( renderer.GetAssignedCamera().GlobalPosition );
if ( ! data.updateSettings )
{
@@ -80,10 +192,16 @@ namespace Rokojori
var material = data.materialOverride != null ?
data.materialOverride.GetOverrideMaterial( this ) :
- gpuParticles3D.DrawPass1.SurfaceGetMaterial( 0 );
+ gpuParticles3D?.DrawPass1?.SurfaceGetMaterial( 0 );
+
+ if ( material == null )
+ {
+ return;
+ }
data.materialOverride?.translucencySettings?.ApplyTranslucency( material, this );
+ UpdateColliders();
// if ( data.overwriteAlphaScissorToDepthPrepass && gpuParticles3D.DrawPass1.SurfaceGetMaterial( 0 ) is StandardMaterial3D standardDrawMaterial )
// {
@@ -112,6 +230,15 @@ namespace Rokojori
}
+ public int numParticlesPerSide()
+ {
+ var cellSize = FoliageQualitySettings.GetCellSize( renderer.quality, renderer.qualitySettingsAll, data.qualitySettings, data.GetCellSize( subLayerIndex ) );
+ var visibilityRange = FoliageQualitySettings.GetVisibilityRange( renderer.quality, renderer.qualitySettingsAll, data.qualitySettings, data.GetVisibilityRange( subLayerIndex ) );
+
+
+ return Mathf.CeilToInt( visibilityRange / cellSize ) * 2;
+ }
+
void UpdateProcessMaterial()
{
var cellSize = FoliageQualitySettings.GetCellSize( renderer.quality, renderer.qualitySettingsAll, data.qualitySettings, data.GetCellSize( subLayerIndex ) );
@@ -124,63 +251,255 @@ namespace Rokojori
_lastCellSize = cellSize;
_lastMaxVisibility = visibilityRange;
- gpuFoliageShaderMaterial.cellSize.Set( cellSize );
+ gpuFoliageShaderMaterial.cellSize.SetCached( cellSize );
gpuParticles3D.Amount = sizeInt * sizeInt;
- gpuFoliageShaderMaterial.width.Set( sizeInt );
- gpuFoliageShaderMaterial.height.Set( sizeInt );
+ gpuFoliageShaderMaterial.width.SetCached( sizeInt );
+ gpuFoliageShaderMaterial.height.SetCached( sizeInt );
}
var hideStart = visibilityRange - ( visibilityRange * data.GetVisibilityFadeRelative( subLayerIndex ) + data.GetVisibilityFadeAbsolute( subLayerIndex ) );
- gpuFoliageShaderMaterial.hideMax.Set( visibilityRange );
- gpuFoliageShaderMaterial.hideStart.Set( hideStart );
- gpuFoliageShaderMaterial.hideOffset.Set( data.GetVisibilityFadeHidingOffset( subLayerIndex ) );
+ gpuFoliageShaderMaterial.hideMax.SetCached( visibilityRange );
+ gpuFoliageShaderMaterial.hideStart.SetCached( hideStart );
+ gpuFoliageShaderMaterial.hideOffset.SetCached( data.GetVisibilityFadeHidingOffset( subLayerIndex ) );
- gpuFoliageShaderMaterial.mapCenter.Set( renderer.globalMapSizeXZ );
- gpuFoliageShaderMaterial.mapSize.Set( renderer.globalMapSizeXZ );
+ gpuFoliageShaderMaterial.mapCenter.SetCached( renderer.globalMapSizeXZ );
+ gpuFoliageShaderMaterial.mapSize.SetCached( renderer.globalMapSizeXZ );
- gpuFoliageShaderMaterial.heightMap.Set( renderer.heightMap );
- gpuFoliageShaderMaterial.minHeight.Set( renderer.minHeight );
- gpuFoliageShaderMaterial.maxHeight.Set( renderer.maxHeight );
+ gpuFoliageShaderMaterial.heightMap.SetCached( renderer.heightMap );
+ gpuFoliageShaderMaterial.minHeight.SetCached( renderer.minHeight );
+ gpuFoliageShaderMaterial.maxHeight.SetCached( renderer.maxHeight );
- gpuFoliageShaderMaterial.coverageMap.Set( renderer.coverageMap );
+ gpuFoliageShaderMaterial.coverageMap.SetCached( renderer.coverageMap );
- gpuFoliageShaderMaterial.positionVariance.Set( renderer.noise );
- gpuFoliageShaderMaterial.rotationVariance.Set( renderer.noise );
- gpuFoliageShaderMaterial.scaleVariance.Set( renderer.noise );
- gpuFoliageShaderMaterial.occupancyVariance.Set( renderer.noise );
+ gpuFoliageShaderMaterial.positionVariance.SetCached( renderer.noise );
+ gpuFoliageShaderMaterial.rotationVariance.SetCached( renderer.noise );
+ gpuFoliageShaderMaterial.scaleVariance.SetCached( renderer.noise );
+ gpuFoliageShaderMaterial.occupancyVariance.SetCached( renderer.noise );
- gpuFoliageShaderMaterial.maxPositionOffset.Set( data.positionVarianceAbsoluteOffset + data.positionVarianceCellSizeRelativeOffset * cellSize );
- gpuFoliageShaderMaterial.positionOffset.Set( data.GetPositionOffset( subLayerIndex ) );
- gpuFoliageShaderMaterial.positionUvScale.Set( Vector2.One * data.positionVarianceScale );
- gpuFoliageShaderMaterial.positionUvOffset.Set( Vector2.One * data.positionVarianceOffset );
+ gpuFoliageShaderMaterial.maxPositionOffset.SetCached( data.positionVarianceAbsoluteOffset + data.positionVarianceCellSizeRelativeOffset * cellSize );
+ gpuFoliageShaderMaterial.positionOffset.SetCached( data.GetPositionOffset( subLayerIndex ) );
+ gpuFoliageShaderMaterial.positionUvScale.SetCached( Vector2.One * data.positionVarianceScale );
+ gpuFoliageShaderMaterial.positionUvOffset.SetCached( Vector2.One * data.positionVarianceOffset );
- gpuFoliageShaderMaterial.minRotation.Set( data.rotationMin );
- gpuFoliageShaderMaterial.maxRotation.Set( data.rotationMax );
- gpuFoliageShaderMaterial.rotationUvScale.Set( Vector2.One * data.rotationVarianceScale );
- gpuFoliageShaderMaterial.rotationUvOffset.Set( Vector2.One * data.rotationVarianceOffset );
+ gpuFoliageShaderMaterial.minRotation.SetCached( data.rotationMin );
+ gpuFoliageShaderMaterial.maxRotation.SetCached( data.rotationMax );
+ gpuFoliageShaderMaterial.rotationUvScale.SetCached( Vector2.One * data.rotationVarianceScale );
+ gpuFoliageShaderMaterial.rotationUvOffset.SetCached( Vector2.One * data.rotationVarianceOffset );
- gpuFoliageShaderMaterial.minScale.Set( data.scaleVarianceMinScale );
- gpuFoliageShaderMaterial.maxScale.Set( data.scaleVarianceMaxScale );
- gpuFoliageShaderMaterial.scaleUvScale.Set( Vector2.One * data.scaleVarianceScale );
- gpuFoliageShaderMaterial.scaleUvOffset.Set( Vector2.One * data.scaleVarianceOffset );
+ gpuFoliageShaderMaterial.minScale.SetCached( data.scaleVarianceMinScale );
+ gpuFoliageShaderMaterial.maxScale.SetCached( data.scaleVarianceMaxScale );
- gpuFoliageShaderMaterial.occupancyAmount.Set( data.occupancyVarianceAmount );
- gpuFoliageShaderMaterial.occupancyPower.Set( data.occupancyVariancePower );
- gpuFoliageShaderMaterial.occupancyTreshold.Set( data.occupancyTreshold );
+ gpuFoliageShaderMaterial.uniScaleMin.SetCached( data.uniScaleMin );
+ gpuFoliageShaderMaterial.uniScaleMax.SetCached( data.uniScaleMax );
+ gpuFoliageShaderMaterial.scaleVarianceContrastScale.SetCached( data.uniScaleVarianceContrastScale );
+ gpuFoliageShaderMaterial.scaleVarianceContrastCenter.SetCached( data.uniScaleVarianceContrastCenter );
+ // gpuFoliageShaderMaterial.uniScaleMax.Set( data.uniScaleVarianceOffset );
- gpuFoliageShaderMaterial.occupancyHideOffset.Set( data.occupancyHideOffset );
- gpuFoliageShaderMaterial.occupancyHideScale.Set( data.occupancyHideScale );
+ gpuFoliageShaderMaterial.uniScaleUvOffset.SetCached( data.uniScaleVarianceOffset );
- gpuFoliageShaderMaterial.occupancyUvScale.Set( Vector2.One * data.occupancyVarianceScale );
- gpuFoliageShaderMaterial.occupancyUvOffset.Set( Vector2.One * data.occupancyVarianceOffset );
+ gpuFoliageShaderMaterial.scaleUvScale.SetCached( Vector2.One * data.scaleVarianceScale );
+ gpuFoliageShaderMaterial.scaleUvOffset.SetCached( Vector2.One * data.scaleVarianceOffset );
+
+ gpuFoliageShaderMaterial.occupancyAmount.SetCached( data.occupancyVarianceAmount );
+ gpuFoliageShaderMaterial.occupancyPower.SetCached( data.occupancyVariancePower );
+ gpuFoliageShaderMaterial.occupancyTreshold.SetCached( data.occupancyTreshold );
+
+ gpuFoliageShaderMaterial.occupancyHideOffset.SetCached( data.occupancyHideOffset );
+ gpuFoliageShaderMaterial.occupancyHideScale.SetCached( data.occupancyHideScale );
+
+ gpuFoliageShaderMaterial.occupancyUvScale.SetCached( Vector2.One * data.occupancyVarianceScale );
+ gpuFoliageShaderMaterial.occupancyUvOffset.SetCached( Vector2.One * data.occupancyVarianceOffset );
if ( data.GetSort( subLayerIndex ) )
{
gpuParticles3D.DrawOrder = GpuParticles3D.DrawOrderEnum.ViewDepth;
}
}
+
+ Vector2 IndexToPosition( int index, int width, int height )
+ {
+ int x = index % width;
+ int y = index / height;
+
+ return new Vector2( x, y );
+ }
+
+ Vector2 rotate_v2( Vector2 uv, float angle )
+ {
+ float s = Mathf.Sin( angle );
+ float c = Mathf.Cos( angle );
+
+
+ float x = uv.X;
+ float y = uv.Y;
+
+ uv.Y = c * x - s * y;
+ uv.Y = s * x + c * y;
+
+ return uv;
+ }
+
+ Vector2 tilingOffset( Vector2 uv, Vector2 scale, Vector2 offset )
+ {
+ return uv * scale + offset;
+ }
+
+
+ public Vector4 textureLod( Texture2D texture2D, Vector2 uv, int lod )
+ {
+ if ( texture2D == null )
+ {
+ return Vector4.One;
+ }
+
+ var image = texture2D.GetImage();
+ var color = image.SampleNearest( uv );
+
+ return color.ToVector4();
+ // return color.LinearToSRGB().ToVector4();
+ }
+
+ public Transform3D ComputeTransform( int INDEX )
+ {
+
+ // gpuFoliageShaderMaterial.(\w+).+;
+ // var $1 = m.$1.GetCached();
+ var m = gpuFoliageShaderMaterial;
+
+ var yaw = m.yaw.GetCached();
+ var width = m.width.GetCached();
+ var height = m.height.GetCached();
+ var cellSize = m.cellSize.GetCached();
+ var cameraPosition = m.cameraPosition.GetCached();
+
+ var heightOffset = m.heightOffset.GetCached();
+
+ var hideStart = m.hideStart.GetCached();
+ var hideMax = m.hideMax.GetCached();
+ var hideOffset = m.hideOffset.GetCached();
+
+ var mapSize = m.mapSize.GetCached();
+ var mapCenter = m.mapCenter.GetCached();
+
+ var positionUVScale = m.positionUvScale.GetCached();
+ var positionUVOffset = m.positionUvOffset.GetCached();
+ var maxPositionOffset = m.maxPositionOffset.GetCached();
+
+ var positionVariance = m.positionVariance.Get();
+ var positionOffset = m.positionOffset.GetCached();
+
+ var minRotation = m.minRotation.GetCached();
+ var maxRotation = m.maxRotation.GetCached();
+ var rotationUVScale = m.rotationUvScale.GetCached();
+ var rotationUVOffset = m.rotationUvOffset.GetCached();
+
+ var rotationVariance = m.rotationVariance.Get();
+
+ var scaleVariance = m.scaleVariance.Get();
+
+ var minScale = m.minScale.GetCached();
+ var maxScale = m.maxScale.GetCached();
+
+ var uniScaleMin = m.uniScaleMin.GetCached();
+ var uniScaleMax = m.uniScaleMax.GetCached();
+ var scaleVarianceContrastScale = m.scaleVarianceContrastScale.GetCached();
+ var scaleVarianceContrastCenter = m.scaleVarianceContrastCenter.GetCached();
+
+ var uniScaleUVOffset = m.uniScaleUvOffset.GetCached();
+
+ var scaleUVScale = m.scaleUvScale.GetCached();
+ var scaleUVOffset = m.scaleUvOffset.GetCached();
+
+ var occupancyAmount = m.occupancyAmount.GetCached();
+ var occupancyPower = m.occupancyPower.GetCached();
+ var occupancyTreshold = m.occupancyTreshold.GetCached();
+
+ var occupancyHideOffset = m.occupancyHideOffset.GetCached();
+ var occupancyHideScale = m.occupancyHideScale.GetCached();
+
+ var occupancyUVScale = m.occupancyUvScale.GetCached();
+ var occupancyUVOffset = m.occupancyUvOffset.GetCached();
+
+ var heightMap = renderer.heightMap;
+ var occupancyVariance = renderer.noise;
+ var coverageMap = renderer.coverageMap;
+
+ var minHeight = renderer.minHeight;
+ var maxHeight = renderer.maxHeight;
+
+ var discardTreshold = 0.01f;
+ var discardOffset = 1000000f;
+
+ Vector2 position = IndexToPosition( INDEX, width, height );
+ float rotation = Mathf.Round( 4.0f * yaw / 360.0f ) * Mathf.Pi / 2.0f;
+
+ Vector3 snappedCameraPosition = new Vector3(
+ Mathf.Floor( cameraPosition.X / cellSize ) * cellSize,
+ 0,
+ Mathf.Floor( cameraPosition.Z/ cellSize ) * cellSize
+ );
+
+ Vector2 origin = new Vector2( width/2.0f, height/2.0f );
+ position -= origin;
+
+ position = rotate_v2( position, rotation ) * cellSize;
+
+
+ Vector3 position3D = new Vector3( position.X, heightOffset, position.Y ) + snappedCameraPosition;
+
+ float d = ( position3D - cameraPosition ).Length();
+ float yOffset = MathX.RemapClamped( d, hideStart, hideMax, 0, hideOffset );
+ position3D.Y += yOffset;
+
+
+ Vector2 mapOffset = mapCenter - mapSize/2.0f;
+ Vector2 uv = ( new Vector2( position3D.X, position3D.Z ) - mapOffset ) / mapSize;
+
+
+
+ Vector3 offset = (textureLod( positionVariance, tilingOffset( uv, positionUVScale, positionUVOffset ), 0 ).rgb() - new Vector3(0.5f,0.5f,0.5f) ) * maxPositionOffset;
+ position3D += offset + positionOffset;
+ Vector3 rotSampled = textureLod( rotationVariance, tilingOffset( uv, rotationUVScale, rotationUVOffset ), 0 ).rgb();
+ Vector3 rot = ( rotSampled * ( maxRotation - minRotation ) + minRotation ) * Mathf.Pi * 2.0f;
+ // rot.Y = round( 4.0 * rot.Y / PI * 2.0 ) / 4.0 * PI * 2.0;
+ Vector3 sca = textureLod( scaleVariance, tilingOffset( uv, scaleUVScale, scaleUVOffset ), 0 ).rgb();
+ sca = ( sca - Vector3.One * scaleVarianceContrastCenter ) * scaleVarianceContrastScale + Vector3.One * scaleVarianceContrastCenter;
+ sca = Math3D.Clamp( sca, Vector3.Zero, Vector3.One );
+ sca = sca * ( maxScale - minScale ) + minScale;
+
+ float uniScale = textureLod( scaleVariance, tilingOffset( uv + uniScaleUVOffset, scaleUVScale, scaleUVOffset ), 0 ).r();
+ uniScale = ( uniScale - scaleVarianceContrastCenter ) * scaleVarianceContrastScale + scaleVarianceContrastCenter;
+ uniScale = Mathf.Clamp( uniScale, 0.0f, 1.0f );
+ uniScale = uniScale * ( uniScaleMax - uniScaleMin ) + uniScaleMin;
+
+ sca *= uniScale;
+ Vector2 uv2 = ( new Vector2( position3D.X, position3D.Z ) - mapOffset ) / mapSize;
+ float sampledHeight = textureLod( heightMap, uv2, 0 ).r();
+ float occ = textureLod( occupancyVariance, tilingOffset( uv2, occupancyUVScale, occupancyUVOffset ), 0 ).r();
+ float sampledCoverage = textureLod( coverageMap, uv2, 0 ).r();
+
+ occ = Mathf.Clamp( ( occ - occupancyTreshold ) * occupancyPower + occupancyTreshold, 0.0f, 1.0f );
+ occ = 1.0f - occ;
+
+ occ = Mathf.Min( occ, 1.0f - sampledCoverage );
+
+ sca *= Mathf.Lerp( 1.0f, occupancyHideScale , occ * occupancyAmount );
+
+ float combinedOcc = occ * occupancyAmount; ;
+ position3D.Y += combinedOcc * occupancyHideOffset;
+ position3D.Y += Mathf.Lerp( minHeight, maxHeight, sampledHeight );
+
+ if ( combinedOcc >= ( 1.0f - MathX.Clamp01( discardTreshold ) ) )
+ {
+ position3D.Y += discardOffset;
+ }
+
+ position3D += data.colliderOffset;
+
+ return Math3D.TRS( position3D, rot, sca );
+ }
}
}
\ No newline at end of file
diff --git a/Runtime/Rendering/Assets/Foliage/FoliageRenderer.cs b/Runtime/Rendering/Assets/Foliage/FoliageRenderer.cs
index 89f7f7e..6e59e59 100644
--- a/Runtime/Rendering/Assets/Foliage/FoliageRenderer.cs
+++ b/Runtime/Rendering/Assets/Foliage/FoliageRenderer.cs
@@ -121,9 +121,6 @@ namespace Rokojori
public bool updateLayers = true;
-
-
-
Camera3D _assignedCamera;
@@ -139,13 +136,33 @@ namespace Rokojori
{
var numLayers = 0;
- foliage.ForEach( fd => numLayers += fd.numLayers );
+ foliage.ForEach( fd => numLayers += fd == null ? 0 : fd.numLayers );
return numLayers;
}
}
+ Dictionary _buffer = new Dictionary();
+
+ Dictionary _bufferedImages = new Dictionary();
+
+ // public Color
+ // public TextureCombinerBuffer GetTextureBuffer( Texture2D texture2D )
+ // {
+ // texture2D.GetImage()
+ // // if ( ! _bufferedImages.ContainsKey( texture2D ) )
+ // // {
+ // // // var tcb = TextureCombinerBuffer.From( texture2D );
+ // // // _buffer[ texture2D ] = tcb;
+
+ // // var image = texture2D.GetImage();
+ // // image.GetPixel
+ // // }
+
+ // // return _buffer[ texture2D ];
+ // }
+
public override void _Process( double delta )
{
_assignedCamera = null;
diff --git a/Runtime/Rendering/Assets/Foliage/GPUFoliageShader.gdshader b/Runtime/Rendering/Assets/Foliage/GPUFoliageShader.gdshader
index b20487f..f867ee9 100644
--- a/Runtime/Rendering/Assets/Foliage/GPUFoliageShader.gdshader
+++ b/Runtime/Rendering/Assets/Foliage/GPUFoliageShader.gdshader
@@ -9,7 +9,7 @@ uniform float cellSize = 1.0;
uniform int width = 10;
uniform int height = 10;
-uniform sampler2D positionVariance;
+uniform sampler2D positionVariance;
uniform vec3 maxPositionOffset = vec3(0,0,0);
uniform vec3 positionOffset = vec3(0,0,0);
uniform vec2 positionUVScale = vec2( 1.0, 1.0 );
@@ -20,15 +20,22 @@ uniform float minHeight = 0;
uniform float maxHeight = 100;
-uniform sampler2D rotationVariance;
+uniform sampler2D rotationVariance;
uniform vec3 minRotation = vec3( 0, 0, 0 );
uniform vec3 maxRotation = vec3( 0, 1, 0 );
uniform vec2 rotationUVScale = vec2( 1.0, 1.0 );
uniform vec2 rotationUVOffset = vec2( 1.0, 1.0 );
uniform sampler2D scaleVariance;
+uniform float scaleVarianceContrastScale = 1.0;
+uniform float scaleVarianceContrastCenter = 0.5;
+
uniform vec3 minScale = vec3( 1, 1, 1 );
uniform vec3 maxScale = vec3( 1, 1, 1 );
+uniform float uniScaleMin = 1.0;
+uniform float uniScaleMax = 1.0;
+uniform vec2 uniScaleUVOffset = vec2( 0.5, 0.5 );
+
uniform vec2 scaleUVScale = vec2( 1.0, 1.0 );
uniform vec2 scaleUVOffset = vec2( 1.0, 1.0 );
@@ -38,7 +45,7 @@ uniform float occupancyTreshold = 0.5;
uniform float occupancyHideOffset = -3;
uniform float occupancyHideScale = 0.1;
-uniform sampler2D occupancyVariance;
+uniform sampler2D occupancyVariance;
uniform vec2 occupancyUVScale = vec2( 1.0, 1.0 );
uniform vec2 occupancyUVOffset = vec2( 1.0, 1.0 );
@@ -98,8 +105,16 @@ void process()
vec3 rot = ( rotSampled * ( maxRotation - minRotation ) + minRotation ) * PI * 2.0;
// rot.y = round( 4.0 * rot.y / PI * 2.0 ) / 4.0 * PI * 2.0;
vec3 sca = textureLod( scaleVariance, tilingOffset( uv, scaleUVScale, scaleUVOffset ), 0 ).rgb;
+ sca = ( sca - scaleVarianceContrastCenter ) * scaleVarianceContrastScale + scaleVarianceContrastCenter;
+ sca = clamp( sca, vec3( 0.0 ), vec3( 1.0 ) );
sca = sca * ( maxScale - minScale ) + minScale;
+ float uniScale = textureLod( scaleVariance, tilingOffset( uv + uniScaleUVOffset, scaleUVScale, scaleUVOffset ), 0 ).r;
+ uniScale = ( uniScale - scaleVarianceContrastCenter ) * scaleVarianceContrastScale + scaleVarianceContrastCenter;
+ uniScale = clamp( uniScale, 0.0, 1.0 );
+ uniScale = uniScale * ( uniScaleMax - uniScaleMin ) + uniScaleMin;
+
+ sca *= uniScale;
vec2 uv2 = ( vec2( position3D.x, position3D.z ) - mapOffset ) / mapSize;
float sampledHeight = textureLod( heightMap, uv2, 0 ).r;
float occ = textureLod( occupancyVariance, tilingOffset( uv2, occupancyUVScale, occupancyUVOffset ), 0 ).r;
diff --git a/Runtime/Rendering/Assets/Foliage/GPUFoliageShaderMaterial.cs b/Runtime/Rendering/Assets/Foliage/GPUFoliageShaderMaterial.cs
index d129b13..fbf11f9 100644
--- a/Runtime/Rendering/Assets/Foliage/GPUFoliageShaderMaterial.cs
+++ b/Runtime/Rendering/Assets/Foliage/GPUFoliageShaderMaterial.cs
@@ -15,23 +15,28 @@ namespace Rokojori
public static readonly FloatPropertyName cellSize = FloatPropertyName.Create( "cellSize" );
public static readonly IntPropertyName width = IntPropertyName.Create( "width" );
public static readonly IntPropertyName height = IntPropertyName.Create( "height" );
- public static readonly Texture2DPropertyName positionVariance = Texture2DPropertyName.Create( "positionVariance" );
+ public static readonly Sampler2DPropertyName positionVariance = Sampler2DPropertyName.Create( "positionVariance" );
public static readonly Vector3PropertyName maxPositionOffset = Vector3PropertyName.Create( "maxPositionOffset" );
public static readonly Vector3PropertyName positionOffset = Vector3PropertyName.Create( "positionOffset" );
public static readonly Vector2PropertyName positionUvScale = Vector2PropertyName.Create( "positionUVScale" );
public static readonly Vector2PropertyName positionUvOffset = Vector2PropertyName.Create( "positionUVOffset" );
public static readonly FloatPropertyName heightOffset = FloatPropertyName.Create( "heightOffset" );
- public static readonly Texture2DPropertyName heightMap = Texture2DPropertyName.Create( "heightMap" );
+ public static readonly Sampler2DPropertyName heightMap = Sampler2DPropertyName.Create( "heightMap" );
public static readonly FloatPropertyName minHeight = FloatPropertyName.Create( "minHeight" );
public static readonly FloatPropertyName maxHeight = FloatPropertyName.Create( "maxHeight" );
- public static readonly Texture2DPropertyName rotationVariance = Texture2DPropertyName.Create( "rotationVariance" );
+ public static readonly Sampler2DPropertyName rotationVariance = Sampler2DPropertyName.Create( "rotationVariance" );
public static readonly Vector3PropertyName minRotation = Vector3PropertyName.Create( "minRotation" );
public static readonly Vector3PropertyName maxRotation = Vector3PropertyName.Create( "maxRotation" );
public static readonly Vector2PropertyName rotationUvScale = Vector2PropertyName.Create( "rotationUVScale" );
public static readonly Vector2PropertyName rotationUvOffset = Vector2PropertyName.Create( "rotationUVOffset" );
- public static readonly Texture2DPropertyName scaleVariance = Texture2DPropertyName.Create( "scaleVariance" );
+ public static readonly Sampler2DPropertyName scaleVariance = Sampler2DPropertyName.Create( "scaleVariance" );
+ public static readonly FloatPropertyName scaleVarianceContrastScale = FloatPropertyName.Create( "scaleVarianceContrastScale" );
+ public static readonly FloatPropertyName scaleVarianceContrastCenter = FloatPropertyName.Create( "scaleVarianceContrastCenter" );
public static readonly Vector3PropertyName minScale = Vector3PropertyName.Create( "minScale" );
public static readonly Vector3PropertyName maxScale = Vector3PropertyName.Create( "maxScale" );
+ public static readonly FloatPropertyName uniScaleMin = FloatPropertyName.Create( "uniScaleMin" );
+ public static readonly FloatPropertyName uniScaleMax = FloatPropertyName.Create( "uniScaleMax" );
+ public static readonly Vector2PropertyName uniScaleUvOffset = Vector2PropertyName.Create( "uniScaleUVOffset" );
public static readonly Vector2PropertyName scaleUvScale = Vector2PropertyName.Create( "scaleUVScale" );
public static readonly Vector2PropertyName scaleUvOffset = Vector2PropertyName.Create( "scaleUVOffset" );
public static readonly FloatPropertyName occupancyAmount = FloatPropertyName.Create( "occupancyAmount" );
@@ -39,13 +44,16 @@ namespace Rokojori
public static readonly FloatPropertyName occupancyTreshold = FloatPropertyName.Create( "occupancyTreshold" );
public static readonly FloatPropertyName occupancyHideOffset = FloatPropertyName.Create( "occupancyHideOffset" );
public static readonly FloatPropertyName occupancyHideScale = FloatPropertyName.Create( "occupancyHideScale" );
- public static readonly Texture2DPropertyName occupancyVariance = Texture2DPropertyName.Create( "occupancyVariance" );
+ public static readonly Sampler2DPropertyName occupancyVariance = Sampler2DPropertyName.Create( "occupancyVariance" );
public static readonly Vector2PropertyName occupancyUvScale = Vector2PropertyName.Create( "occupancyUVScale" );
public static readonly Vector2PropertyName occupancyUvOffset = Vector2PropertyName.Create( "occupancyUVOffset" );
public static readonly FloatPropertyName hideStart = FloatPropertyName.Create( "hideStart" );
public static readonly FloatPropertyName hideMax = FloatPropertyName.Create( "hideMax" );
public static readonly FloatPropertyName hideOffset = FloatPropertyName.Create( "hideOffset" );
- public static readonly Texture2DPropertyName coverageMap = Texture2DPropertyName.Create( "coverageMap" );
+ public static readonly FloatPropertyName discardTreshold = FloatPropertyName.Create( "discardTreshold" );
+ public static readonly FloatPropertyName discardOffset = FloatPropertyName.Create( "discardOffset" );
+ public static readonly Sampler2DPropertyName coverageMap = Sampler2DPropertyName.Create( "coverageMap" );
+ public static readonly Sampler2DPropertyName colorMap = Sampler2DPropertyName.Create( "colorMap" );
public static readonly Vector2PropertyName mapSize = Vector2PropertyName.Create( "mapSize" );
public static readonly Vector2PropertyName mapCenter = Vector2PropertyName.Create( "mapCenter" );
@@ -76,8 +84,13 @@ namespace Rokojori
public readonly CustomMaterialProperty rotationUvScale;
public readonly CustomMaterialProperty rotationUvOffset;
public readonly CustomMaterialProperty scaleVariance;
+ public readonly CustomMaterialProperty scaleVarianceContrastScale;
+ public readonly CustomMaterialProperty scaleVarianceContrastCenter;
public readonly CustomMaterialProperty minScale;
public readonly CustomMaterialProperty maxScale;
+ public readonly CustomMaterialProperty uniScaleMin;
+ public readonly CustomMaterialProperty uniScaleMax;
+ public readonly CustomMaterialProperty uniScaleUvOffset;
public readonly CustomMaterialProperty scaleUvScale;
public readonly CustomMaterialProperty scaleUvOffset;
public readonly CustomMaterialProperty occupancyAmount;
@@ -91,7 +104,10 @@ namespace Rokojori
public readonly CustomMaterialProperty hideStart;
public readonly CustomMaterialProperty hideMax;
public readonly CustomMaterialProperty hideOffset;
+ public readonly CustomMaterialProperty discardTreshold;
+ public readonly CustomMaterialProperty discardOffset;
public readonly CustomMaterialProperty coverageMap;
+ public readonly CustomMaterialProperty colorMap;
public readonly CustomMaterialProperty mapSize;
public readonly CustomMaterialProperty mapCenter;
@@ -119,8 +135,13 @@ namespace Rokojori
rotationUvScale = new CustomMaterialProperty( this, GPUFoliageShaderShader.rotationUvScale );
rotationUvOffset = new CustomMaterialProperty( this, GPUFoliageShaderShader.rotationUvOffset );
scaleVariance = new CustomMaterialProperty( this, GPUFoliageShaderShader.scaleVariance );
+ scaleVarianceContrastScale = new CustomMaterialProperty( this, GPUFoliageShaderShader.scaleVarianceContrastScale );
+ scaleVarianceContrastCenter = new CustomMaterialProperty( this, GPUFoliageShaderShader.scaleVarianceContrastCenter );
minScale = new CustomMaterialProperty( this, GPUFoliageShaderShader.minScale );
maxScale = new CustomMaterialProperty( this, GPUFoliageShaderShader.maxScale );
+ uniScaleMin = new CustomMaterialProperty( this, GPUFoliageShaderShader.uniScaleMin );
+ uniScaleMax = new CustomMaterialProperty( this, GPUFoliageShaderShader.uniScaleMax );
+ uniScaleUvOffset = new CustomMaterialProperty( this, GPUFoliageShaderShader.uniScaleUvOffset );
scaleUvScale = new CustomMaterialProperty( this, GPUFoliageShaderShader.scaleUvScale );
scaleUvOffset = new CustomMaterialProperty( this, GPUFoliageShaderShader.scaleUvOffset );
occupancyAmount = new CustomMaterialProperty( this, GPUFoliageShaderShader.occupancyAmount );
@@ -134,7 +155,10 @@ namespace Rokojori
hideStart = new CustomMaterialProperty( this, GPUFoliageShaderShader.hideStart );
hideMax = new CustomMaterialProperty( this, GPUFoliageShaderShader.hideMax );
hideOffset = new CustomMaterialProperty( this, GPUFoliageShaderShader.hideOffset );
+ discardTreshold = new CustomMaterialProperty( this, GPUFoliageShaderShader.discardTreshold );
+ discardOffset = new CustomMaterialProperty( this, GPUFoliageShaderShader.discardOffset );
coverageMap = new CustomMaterialProperty( this, GPUFoliageShaderShader.coverageMap );
+ colorMap = new CustomMaterialProperty( this, GPUFoliageShaderShader.colorMap );
mapSize = new CustomMaterialProperty( this, GPUFoliageShaderShader.mapSize );
mapCenter = new CustomMaterialProperty( this, GPUFoliageShaderShader.mapCenter );
}
diff --git a/Runtime/Rendering/Assets/Terrain/TriplanerHeightMapTerrain.gdshader b/Runtime/Rendering/Assets/Terrain/TriplanarHeightMapTerrain.gdshader
similarity index 100%
rename from Runtime/Rendering/Assets/Terrain/TriplanerHeightMapTerrain.gdshader
rename to Runtime/Rendering/Assets/Terrain/TriplanarHeightMapTerrain.gdshader
diff --git a/Runtime/Rendering/Assets/Terrain/TriplanerHeightMapTerrain.gdshader.uid b/Runtime/Rendering/Assets/Terrain/TriplanarHeightMapTerrain.gdshader.uid
similarity index 100%
rename from Runtime/Rendering/Assets/Terrain/TriplanerHeightMapTerrain.gdshader.uid
rename to Runtime/Rendering/Assets/Terrain/TriplanarHeightMapTerrain.gdshader.uid
diff --git a/Runtime/Rendering/AssignedShaderProperty.cs b/Runtime/Rendering/AssignedShaderProperty.cs
new file mode 100644
index 0000000..5a71f71
--- /dev/null
+++ b/Runtime/Rendering/AssignedShaderProperty.cs
@@ -0,0 +1,37 @@
+
+using System.Diagnostics;
+using System.Collections;
+using System.Collections.Generic;
+using System;
+using Godot;
+
+
+namespace Rokojori
+{
+ public class AssignedShaderProperty
+ {
+ public ShaderProperty property;
+ public Variant value;
+
+ public static AssignedShaderProperty From( ShaderProperty sp )
+ {
+ var asp = new AssignedShaderProperty();
+ asp.property = sp;
+ return asp;
+ }
+
+ public void Update()
+ {
+ if ( (object)value == (object)property.GetValue() )
+ {
+ return;
+ }
+
+ property.ApplyGlobal();
+ value = property.GetValue();
+
+
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Rendering/AssignedShaderProperty.cs.uid b/Runtime/Rendering/AssignedShaderProperty.cs.uid
new file mode 100644
index 0000000..fe0f1f8
--- /dev/null
+++ b/Runtime/Rendering/AssignedShaderProperty.cs.uid
@@ -0,0 +1 @@
+uid://bdubr6ashwv12
diff --git a/Runtime/Rendering/RenderingManager.cs b/Runtime/Rendering/RenderingManager.cs
index 3f99202..35d8ade 100644
--- a/Runtime/Rendering/RenderingManager.cs
+++ b/Runtime/Rendering/RenderingManager.cs
@@ -4,16 +4,105 @@ using System.Collections;
using System.Collections.Generic;
using System;
using Godot;
+using System.Linq;
namespace Rokojori
{
- [Tool]
+
+ [Tool]
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/RenderingManager.svg") ]
public partial class RenderingManager:Node
{
+ [ExportToolButton( "Ensure Global Shader Properties")]
+ public Callable ensureGlobalShaderPropertiesButton => Callable.From(
+ ()=>
+ {
+ EnsureGlobalShaderProperties();
+ }
+ );
+
+ void EnsureGlobalShaderProperties()
+ {
+ for ( int i = 0; i < data.numGlobalShaderProperties; i++ )
+ {
+ var p = data.GetGlobalShaderPropertyAt( i );
+
+ if ( p == null )
+ {
+ continue;
+ }
+
+ p.AddAsGlobalUniform();
+
+ }
+ }
+
+
[Export]
- public RenderingManagerData data;
+ public bool ensureGlobalShaderPropertiesOnReady = true;
+
+ [Export]
+ public RenderingManagerData data = new RenderingManagerData();
+
+ List _assignedProperties = new List();
+
+ public override void _Ready()
+ {
+ if ( ! ensureGlobalShaderPropertiesOnReady )
+ {
+ return;
+ }
+
+ EnsureGlobalShaderProperties();
+
+ }
+
+ public override void _Process( double delta )
+ {
+ UpdateProperties();
+ }
+
+ void UpdateProperties()
+ {
+
+ if ( data == null )
+ {
+ return;
+ }
+
+ if ( _assignedProperties.Count != data.numGlobalShaderProperties )
+ {
+ CreatePropertyList();
+ }
+
+
+
+ for ( int i = 0; i < data.numGlobalShaderProperties; i++ )
+ {
+ var p = data.GetGlobalShaderPropertyAt( i );
+
+ if ( p != _assignedProperties[ i ].property )
+ {
+ _assignedProperties.Clear();
+ CreatePropertyList();
+ UpdateProperties();
+ return;
+ }
+
+ _assignedProperties[ i ].Update();
+ }
+ }
+
+ void CreatePropertyList()
+ {
+ _assignedProperties.Clear();
+
+ for ( int i = 0; i < data.numGlobalShaderProperties; i++ )
+ {
+ _assignedProperties.Add( AssignedShaderProperty.From( data.GetGlobalShaderPropertyAt( i ) ) );
+ }
+ }
public static int GetStencilReferenceIndex( StencilLayer stencilLayer )
{
diff --git a/Runtime/Rendering/RenderingManagerData.cs b/Runtime/Rendering/RenderingManagerData.cs
index 08e03f4..7317f23 100644
--- a/Runtime/Rendering/RenderingManagerData.cs
+++ b/Runtime/Rendering/RenderingManagerData.cs
@@ -13,13 +13,69 @@ namespace Rokojori
public partial class RenderingManagerData:Resource
{
[Export]
- public RenderingPriority[] renderingPriorities;
-
+ public RenderingPriority[] renderingPriorities = [];
[Export]
- public StencilLayer[] stencilLayers;
+ public StencilLayer[] stencilLayers = [];
[Export]
- public ShaderProperty[] globalShaderProperties;
+ public ShaderPropertyBlock[] globalShaderPropertyBlocks = [];
+
+ [Export]
+ public ShaderProperty[] globalShaderProperties = [];
+
+ public ShaderProperty GetGlobalPropertyByName( ShaderPropertyName name )
+ {
+ var numProps = numGlobalShaderProperties;
+ for ( int i = 0; i < numProps; i++ )
+ {
+ var p = GetGlobalShaderPropertyAt( i );
+
+ if ( p != null && p.GetPropertyName() == name )
+ {
+ return p;
+ }
+
+ }
+
+ return null;
+ }
+
+ public int numGlobalShaderProperties
+ {
+ get
+ {
+ var num = 0;
+
+
+ globalShaderPropertyBlocks.ForEach( b => num += b.shaderProperties.Length );
+
+ num += globalShaderProperties.Length;
+ return num;
+ }
+ }
+
+ public ShaderProperty GetGlobalShaderPropertyAt( int index )
+ {
+ var offset = 0;
+
+ for ( int i = 0; i < globalShaderPropertyBlocks.Length; i++ )
+ {
+ if ( globalShaderPropertyBlocks[ i ] == null )
+ {
+ continue;
+ }
+ var blockLength = globalShaderPropertyBlocks[ i ].shaderProperties.Length;
+
+ if ( offset <= index & index < offset + blockLength )
+ {
+ return globalShaderPropertyBlocks[ i ].shaderProperties[ index - offset ];
+ }
+
+ offset += blockLength;
+ }
+
+ return globalShaderProperties[ index - offset ];
+ }
}
}
\ No newline at end of file
diff --git a/Runtime/Rendering/TextureAttributes/AssignTextureAttributesTexture.cs b/Runtime/Rendering/TextureAttributes/AssignTextureAttributesTexture.cs
new file mode 100644
index 0000000..d98e36a
--- /dev/null
+++ b/Runtime/Rendering/TextureAttributes/AssignTextureAttributesTexture.cs
@@ -0,0 +1,27 @@
+
+using Godot;
+using Rokojori;
+using System.Collections.Generic;
+
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass]
+ public partial class AssignTextureAttributesTexture:Action
+ {
+ [Export]
+ public TextureAttributes textureAttributes;
+
+ [Export]
+ public Material material;
+
+ [Export]
+ public Sampler2DPropertyName texturePropertyName;
+
+ protected override void _OnTrigger()
+ {
+ texturePropertyName.Set( material, textureAttributes.texture );
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Rendering/TextureAttributes/AssignTextureAttributesTexture.cs.uid b/Runtime/Rendering/TextureAttributes/AssignTextureAttributesTexture.cs.uid
new file mode 100644
index 0000000..b0e12e4
--- /dev/null
+++ b/Runtime/Rendering/TextureAttributes/AssignTextureAttributesTexture.cs.uid
@@ -0,0 +1 @@
+uid://drd58qb2u7vwr
diff --git a/Runtime/Rendering/TextureAttributes/SetTextureAttributeChannel.cs b/Runtime/Rendering/TextureAttributes/SetTextureAttributeChannel.cs
new file mode 100644
index 0000000..3b3241a
--- /dev/null
+++ b/Runtime/Rendering/TextureAttributes/SetTextureAttributeChannel.cs
@@ -0,0 +1,43 @@
+
+using Godot;
+using Rokojori;
+using System.Collections.Generic;
+
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass]
+ public partial class SetTextureAttributeChannel:Action
+ {
+ [Export]
+ public TextureAttributes textureAttributes;
+
+ [Export]
+ public int index = 0;
+
+ [Export]
+ public float value = 1;
+
+ [Export]
+ public TextureAttributes.Channel channel = TextureAttributes.Channel.Red;
+
+ protected override void _OnTrigger()
+ {
+ var ta = textureAttributes;
+
+ if ( ta == null )
+ {
+ ta = Unique.Get();
+ }
+
+ if ( ta == null )
+ {
+ this.LogInfo( "No attributes found..." );
+ return;
+ }
+
+ this.LogInfo( "Index", index, "Value:", value, "Channel:", channel );
+ ta.SetChannel( index, value, channel );
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Rendering/TextureAttributes/SetTextureAttributeChannel.cs.uid b/Runtime/Rendering/TextureAttributes/SetTextureAttributeChannel.cs.uid
new file mode 100644
index 0000000..69fea1a
--- /dev/null
+++ b/Runtime/Rendering/TextureAttributes/SetTextureAttributeChannel.cs.uid
@@ -0,0 +1 @@
+uid://b751wl58yqkn3
diff --git a/Runtime/Rendering/TextureAttributes/TextureAttributes.cs b/Runtime/Rendering/TextureAttributes/TextureAttributes.cs
new file mode 100644
index 0000000..f7aa0fb
--- /dev/null
+++ b/Runtime/Rendering/TextureAttributes/TextureAttributes.cs
@@ -0,0 +1,178 @@
+
+using Godot;
+using Rokojori;
+using System.Collections.Generic;
+
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass]
+ public partial class TextureAttributes:Node
+ {
+ public enum Size
+ {
+ _16,
+ _32,
+ _64,
+ _128,
+ _256,
+ _512,
+ _1024,
+ _2048
+ }
+
+ public enum Channel
+ {
+ Red, Green, Blue, Alpha
+ }
+
+ [Export]
+ public Size sizeType =Size._64;
+
+ [Export]
+ public Image image;
+
+ [Export]
+ public Image.Format format = Image.Format.Rgb8;
+
+ [Export]
+ public ImageTexture texture;
+
+ [Export]
+ public Color fillColor;
+
+ List> _updates = new List>();
+
+ public int size => _size;
+ int _size = -1;
+
+ [Export]
+ public bool autoUpdate = true;
+
+ [ExportToolButton( "Create") ]
+ public Callable createButton => Callable.From(
+ ()=>{ Create(); }
+ );
+
+ [ExportGroup( "Testing" )]
+ [Export]
+ public int testIndex;
+ [Export]
+ public Color allValue = new Color( 0, 0, 0 );
+
+ [Export]
+ public Color testValue = new Color( 1, 1, 1 );
+
+
+ [ExportToolButton( "Test") ]
+ public Callable testButton => Callable.From(
+ ()=>{ Test(); }
+ );
+
+
+
+ public void Test()
+ {
+ UpdateSize();
+
+ image.Fill( allValue );
+
+ var testUV = GetUV( testIndex );
+
+ this.LogInfo( "index", testIndex, "uv", testUV, "value:", testValue );
+ image.SetPixelv( testUV, testValue );
+
+ texture.Update( image );
+ }
+
+ public override void _Process( double delta )
+ {
+ if ( ! autoUpdate )
+ {
+ return;
+ }
+
+ if ( _updates.Count > 0 )
+ {
+ UpdateSize();
+ Flush();
+ }
+
+ }
+
+ void UpdateSize()
+ {
+ _size = Mathf.RoundToInt( Mathf.Pow( 2, 4 + (int)(sizeType) ) );
+ }
+
+ public void Create()
+ {
+ UpdateSize();
+
+ image = Image.CreateEmpty( _size, _size, false, format );
+ image.Fill( new Color( 0, 0, 0, 0 ) );
+
+ texture = ImageTexture.CreateFromImage( image );
+
+ }
+
+ public Vector2I GetUV( int index )
+ {
+ return new Vector2I( index % _size, index / _size );
+ }
+
+ public void SetColor( int index, Color value )
+ {
+ Update(
+ ( Image i ) =>
+ {
+ var uv = GetUV( index );
+ i.SetPixelv( uv, value );
+ }
+ );
+ }
+
+ public void SetChannel( int index, float value, Channel channel )
+ {
+ Update(
+ ( Image i ) =>
+ {
+ var uv = GetUV( index );
+ var currentValue = i.GetPixelv( uv );
+
+ if ( channel == Channel.Red )
+ {
+ currentValue.R = value;
+ }
+ else if ( channel == Channel.Green )
+ {
+ currentValue.G = value;
+ }
+ else if ( channel == Channel.Blue )
+ {
+ currentValue.B = value;
+ }
+ else if ( channel == Channel.Alpha )
+ {
+ currentValue.A = value;
+ }
+
+ i.SetPixelv( uv, currentValue );
+ }
+ );
+ }
+
+ public void Update( System.Action action )
+ {
+ _updates.Add( action );
+ }
+
+ public void Flush()
+ {
+ _updates.ForEach( u => u( image ) );
+ _updates.Clear();
+ texture.Update( image );
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/Runtime/Rendering/TextureAttributes/TextureAttributes.cs.uid b/Runtime/Rendering/TextureAttributes/TextureAttributes.cs.uid
new file mode 100644
index 0000000..d23c38e
--- /dev/null
+++ b/Runtime/Rendering/TextureAttributes/TextureAttributes.cs.uid
@@ -0,0 +1 @@
+uid://r5veisahx0in
diff --git a/Runtime/Selectors/FlagSelector.cs b/Runtime/Selectors/FlagSelector.cs
index cec835f..77f36d7 100644
--- a/Runtime/Selectors/FlagSelector.cs
+++ b/Runtime/Selectors/FlagSelector.cs
@@ -26,9 +26,28 @@ namespace Rokojori
public FlagMode mode = FlagMode.Needs_One_Flag;
[Export]
-
public TreeIteratorType iteratorType = TreeIteratorType.DirectChildren;
+ bool SelectsSelectable( Selectable s )
+ {
+ var numPresent = 0;
+
+ for ( int i = 0; i < flag.Length; i++ )
+ {
+ if ( Array.IndexOf( s.flags, flag[ i ] ) != -1 )
+ {
+ numPresent ++;
+ }
+ }
+
+ if ( numPresent == flag.Length || mode == FlagMode.Needs_One_Flag && numPresent > 0 )
+ {
+ return true;
+ }
+
+ return false;
+ }
+
public override bool Selects( Node node )
{
var iterator = TreeIterator.GetIterator( iteratorType, node, NodesWalker.Get() );
@@ -41,22 +60,13 @@ namespace Rokojori
if ( it is Selectable s )
{
- var numPresent = 0;
+ var selects = SelectsSelectable( s );
- for ( int i = 0; i < flag.Length; i++ )
- {
- if ( Array.IndexOf( s.flags, flag[ i ] ) != -1 )
- {
- numPresent ++;
- }
- }
-
- if ( numPresent == flag.Length || mode == FlagMode.Needs_One_Flag && numPresent > 0 )
+ if ( selects )
{
return true;
}
-
}
}
diff --git a/Runtime/Selectors/Selector.cs b/Runtime/Selectors/Selector.cs
index 03768ef..317a0e8 100644
--- a/Runtime/Selectors/Selector.cs
+++ b/Runtime/Selectors/Selector.cs
@@ -10,7 +10,7 @@ namespace Rokojori
{
[Tool]
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Selector.svg")]
- public partial class Selector:Resource
+ public abstract partial class Selector:Resource
{
public virtual bool Selects( Node node )
{
diff --git a/Runtime/Selectors/SelectorFlag.cs b/Runtime/Selectors/SelectorFlag.cs
index f27f943..59cedb5 100644
--- a/Runtime/Selectors/SelectorFlag.cs
+++ b/Runtime/Selectors/SelectorFlag.cs
@@ -9,7 +9,7 @@ using Godot;
namespace Rokojori
{
[Tool]
- [GlobalClass]
+ [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Selector.svg")]
public partial class SelectorFlag:Resource
{
public override string ToString()
diff --git a/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Default - Keyboard & Mouse.tres b/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Default - Keyboard & Mouse.tres
index f96da17..ee3b79d 100644
--- a/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Default - Keyboard & Mouse.tres
+++ b/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Default - Keyboard & Mouse.tres
@@ -1,6 +1,6 @@
-[gd_resource type="Resource" script_class="SensorGroup" load_steps=13 format=3 uid="uid://c5rvf5v86ybks"]
+[gd_resource type="Resource" script_class="SensorGroup" load_steps=20 format=3 uid="uid://c5rvf5v86ybks"]
-[ext_resource type="Script" path="res://addons/rokojori_action_library/Runtime/Sensors/SensorGroup.cs" id="1_168ay"]
+[ext_resource type="Script" uid="uid://da4bhmvkury2" path="res://addons/rokojori_action_library/Runtime/Sensors/SensorGroup.cs" id="1_168ay"]
[ext_resource type="Resource" uid="uid://ci42d04kv03yx" path="res://addons/rokojori_action_library/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Button Left.tres" id="2_fxahp"]
[ext_resource type="Resource" uid="uid://b8u374emi528p" path="res://addons/rokojori_action_library/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Button Middle.tres" id="3_6x0mm"]
[ext_resource type="Resource" uid="uid://cbqyav0cnehoq" path="res://addons/rokojori_action_library/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Button Right.tres" id="4_4gj3k"]
@@ -8,11 +8,18 @@
[ext_resource type="Resource" uid="uid://b52horrdbgyaa" path="res://addons/rokojori_action_library/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Wheel Up.tres" id="6_3kcki"]
[ext_resource type="Resource" uid="uid://mbnb46tah4i7" path="res://addons/rokojori_action_library/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Movement/Move Forward.tres" id="7_1jado"]
[ext_resource type="Resource" uid="uid://c5ueac4xt7oyb" path="res://addons/rokojori_action_library/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Movement/Move Back.tres" id="8_0us2c"]
-[ext_resource type="Resource" uid="uid://ds1rrltuj0mse" path="res://addons/rokojori_action_library/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Movement/Move Down.tres" id="8_r5hwi"]
[ext_resource type="Resource" uid="uid://bfxeh1y1vgkiu" path="res://addons/rokojori_action_library/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Movement/Strafe Left.tres" id="9_xdx7j"]
[ext_resource type="Resource" uid="uid://bm2d6nhevcjel" path="res://addons/rokojori_action_library/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Movement/Strafe Right.tres" id="10_cwkpy"]
[ext_resource type="Resource" uid="uid://ds1rrltuj0mse" path="res://addons/rokojori_action_library/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Movement/Move Down.tres" id="11_33hna"]
+[ext_resource type="Resource" uid="uid://dtfgwd1wlk344" path="res://addons/rokojori_action_library/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Motion Down.tres" id="12_ity01"]
+[ext_resource type="Resource" uid="uid://bu7t2i36n7m2x" path="res://addons/rokojori_action_library/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Motion Left.tres" id="13_crm7l"]
+[ext_resource type="Resource" uid="uid://cljc42e8pggxc" path="res://addons/rokojori_action_library/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Motion Right.tres" id="14_5q586"]
+[ext_resource type="Resource" uid="uid://u6sevemw8cyi" path="res://addons/rokojori_action_library/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Motion Up.tres" id="15_x2sfr"]
+[ext_resource type="Resource" uid="uid://dqwqjna27pr6m" path="res://addons/rokojori_action_library/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Screen-Relative Down.tres" id="16_67ek2"]
+[ext_resource type="Resource" uid="uid://bc26l0nbfbvmr" path="res://addons/rokojori_action_library/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Screen-Relative Left.tres" id="17_em370"]
+[ext_resource type="Resource" uid="uid://dbsacndnvleas" path="res://addons/rokojori_action_library/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Screen-Relative Right.tres" id="18_t4fkn"]
+[ext_resource type="Resource" uid="uid://cg1jqnpfx4qqr" path="res://addons/rokojori_action_library/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Screen-Relative Up.tres" id="19_tgyys"]
[resource]
script = ExtResource("1_168ay")
-sensors = [ExtResource("2_fxahp"), ExtResource("3_6x0mm"), ExtResource("4_4gj3k"), ExtResource("5_diio6"), ExtResource("6_3kcki"), ExtResource("7_1jado"), ExtResource("8_0us2c"), ExtResource("9_xdx7j"), ExtResource("10_cwkpy"), ExtResource("11_33hna"), ExtResource("8_r5hwi")]
+sensors = [ExtResource("2_fxahp"), ExtResource("3_6x0mm"), ExtResource("4_4gj3k"), ExtResource("5_diio6"), ExtResource("6_3kcki"), ExtResource("7_1jado"), ExtResource("8_0us2c"), ExtResource("9_xdx7j"), ExtResource("10_cwkpy"), ExtResource("11_33hna"), ExtResource("11_33hna"), ExtResource("12_ity01"), ExtResource("13_crm7l"), ExtResource("14_5q586"), ExtResource("15_x2sfr"), ExtResource("16_67ek2"), ExtResource("17_em370"), ExtResource("18_t4fkn"), ExtResource("19_tgyys")]
diff --git a/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Motion Down.tres b/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Motion Down.tres
new file mode 100644
index 0000000..3e87f33
--- /dev/null
+++ b/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Motion Down.tres
@@ -0,0 +1,8 @@
+[gd_resource type="Resource" script_class="MouseMotionDelta" load_steps=2 format=3 uid="uid://dtfgwd1wlk344"]
+
+[ext_resource type="Script" uid="uid://d02e87hinqekt" path="res://addons/rokojori_action_library/Runtime/Sensors/MouseMotionDelta.cs" id="1_g51ig"]
+
+[resource]
+script = ExtResource("1_g51ig")
+motionType = 3
+metadata/_custom_type_script = "uid://d02e87hinqekt"
diff --git a/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Motion Left.tres b/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Motion Left.tres
new file mode 100644
index 0000000..529ee42
--- /dev/null
+++ b/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Motion Left.tres
@@ -0,0 +1,8 @@
+[gd_resource type="Resource" script_class="MouseMotionDelta" load_steps=2 format=3 uid="uid://bu7t2i36n7m2x"]
+
+[ext_resource type="Script" uid="uid://d02e87hinqekt" path="res://addons/rokojori_action_library/Runtime/Sensors/MouseMotionDelta.cs" id="1_o6efp"]
+
+[resource]
+script = ExtResource("1_o6efp")
+motionType = 1
+metadata/_custom_type_script = "uid://d02e87hinqekt"
diff --git a/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Motion Right.tres b/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Motion Right.tres
new file mode 100644
index 0000000..eba812a
--- /dev/null
+++ b/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Motion Right.tres
@@ -0,0 +1,7 @@
+[gd_resource type="Resource" script_class="MouseMotionDelta" load_steps=2 format=3 uid="uid://cljc42e8pggxc"]
+
+[ext_resource type="Script" uid="uid://d02e87hinqekt" path="res://addons/rokojori_action_library/Runtime/Sensors/MouseMotionDelta.cs" id="1_vp3ad"]
+
+[resource]
+script = ExtResource("1_vp3ad")
+metadata/_custom_type_script = "uid://d02e87hinqekt"
diff --git a/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Motion Up.tres b/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Motion Up.tres
new file mode 100644
index 0000000..e6d2b60
--- /dev/null
+++ b/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Motion Up.tres
@@ -0,0 +1,8 @@
+[gd_resource type="Resource" script_class="MouseMotionDelta" load_steps=2 format=3 uid="uid://u6sevemw8cyi"]
+
+[ext_resource type="Script" uid="uid://d02e87hinqekt" path="res://addons/rokojori_action_library/Runtime/Sensors/MouseMotionDelta.cs" id="1_cbi4q"]
+
+[resource]
+script = ExtResource("1_cbi4q")
+motionType = 2
+metadata/_custom_type_script = "uid://d02e87hinqekt"
diff --git a/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Screen-Relative Down.tres b/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Screen-Relative Down.tres
new file mode 100644
index 0000000..9fa4c2c
--- /dev/null
+++ b/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Screen-Relative Down.tres
@@ -0,0 +1,8 @@
+[gd_resource type="Resource" script_class="MouseScreenRelative" load_steps=2 format=3 uid="uid://dqwqjna27pr6m"]
+
+[ext_resource type="Script" uid="uid://b4hxfawlk33t3" path="res://addons/rokojori_action_library/Runtime/Sensors/MouseScreenRelative.cs" id="1_axjcx"]
+
+[resource]
+script = ExtResource("1_axjcx")
+motionType = 3
+metadata/_custom_type_script = "uid://b4hxfawlk33t3"
diff --git a/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Screen-Relative Left.tres b/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Screen-Relative Left.tres
new file mode 100644
index 0000000..dac66d9
--- /dev/null
+++ b/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Screen-Relative Left.tres
@@ -0,0 +1,8 @@
+[gd_resource type="Resource" script_class="MouseScreenRelative" load_steps=2 format=3 uid="uid://bc26l0nbfbvmr"]
+
+[ext_resource type="Script" uid="uid://b4hxfawlk33t3" path="res://addons/rokojori_action_library/Runtime/Sensors/MouseScreenRelative.cs" id="1_dsofh"]
+
+[resource]
+script = ExtResource("1_dsofh")
+motionType = 1
+metadata/_custom_type_script = "uid://b4hxfawlk33t3"
diff --git a/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Screen-Relative Right.tres b/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Screen-Relative Right.tres
new file mode 100644
index 0000000..8f219b1
--- /dev/null
+++ b/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Screen-Relative Right.tres
@@ -0,0 +1,7 @@
+[gd_resource type="Resource" script_class="MouseScreenRelative" load_steps=2 format=3 uid="uid://dbsacndnvleas"]
+
+[ext_resource type="Script" uid="uid://b4hxfawlk33t3" path="res://addons/rokojori_action_library/Runtime/Sensors/MouseScreenRelative.cs" id="1_2bdya"]
+
+[resource]
+script = ExtResource("1_2bdya")
+metadata/_custom_type_script = "uid://b4hxfawlk33t3"
diff --git a/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Screen-Relative Up.tres b/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Screen-Relative Up.tres
new file mode 100644
index 0000000..196b9a5
--- /dev/null
+++ b/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Mouse/Mouse-Screen-Relative Up.tres
@@ -0,0 +1,8 @@
+[gd_resource type="Resource" script_class="MouseScreenRelative" load_steps=2 format=3 uid="uid://cg1jqnpfx4qqr"]
+
+[ext_resource type="Script" uid="uid://b4hxfawlk33t3" path="res://addons/rokojori_action_library/Runtime/Sensors/MouseScreenRelative.cs" id="1_oulvd"]
+
+[resource]
+script = ExtResource("1_oulvd")
+motionType = 2
+metadata/_custom_type_script = "uid://b4hxfawlk33t3"
diff --git a/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Movement/Move Back.tres b/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Movement/Move Back.tres
index d38adf0..2c66899 100644
--- a/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Movement/Move Back.tres
+++ b/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Movement/Move Back.tres
@@ -6,40 +6,13 @@
[sub_resource type="Resource" id="Resource_bf8g7"]
script = ExtResource("2_p2364")
key = 83
-keyLocation = 0
-ctrlHold = 2
-altHold = 2
-shiftHold = 2
-modifiersMode = 0
-continous = false
-_value = 0.0
-_wasActive = false
-_active = false
-_activeTreshold = 0.5
[sub_resource type="Resource" id="Resource_bi0fk"]
script = ExtResource("2_p2364")
key = 4194322
-keyLocation = 0
-ctrlHold = 2
-altHold = 2
-shiftHold = 2
-modifiersMode = 0
-continous = false
-_value = 0.0
-_wasActive = false
-_active = false
-_activeTreshold = 0.5
[resource]
script = ExtResource("1_xxflt")
sensors = [SubResource("Resource_bf8g7"), SubResource("Resource_bi0fk")]
showOnlyVisibleIcons = true
numVisible = 1
-inputIcons = []
-useInputIconsFromSensors = true
-continous = false
-_value = 0.0
-_wasActive = false
-_active = false
-_activeTreshold = 0.5
diff --git a/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Movement/Move Forward.tres b/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Movement/Move Forward.tres
index c3672f4..88bff68 100644
--- a/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Movement/Move Forward.tres
+++ b/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Movement/Move Forward.tres
@@ -6,40 +6,13 @@
[sub_resource type="Resource" id="Resource_uixae"]
script = ExtResource("2_rjp34")
key = 87
-keyLocation = 0
-ctrlHold = 2
-altHold = 2
-shiftHold = 2
-modifiersMode = 0
-continous = false
-_value = 0.0
-_wasActive = false
-_active = false
-_activeTreshold = 0.5
[sub_resource type="Resource" id="Resource_grqa0"]
script = ExtResource("2_rjp34")
key = 4194320
-keyLocation = 0
-ctrlHold = 2
-altHold = 2
-shiftHold = 2
-modifiersMode = 0
-continous = false
-_value = 0.0
-_wasActive = false
-_active = false
-_activeTreshold = 0.5
[resource]
script = ExtResource("1_vohv8")
sensors = [SubResource("Resource_uixae"), SubResource("Resource_grqa0")]
showOnlyVisibleIcons = true
numVisible = 1
-inputIcons = []
-useInputIconsFromSensors = true
-continous = false
-_value = 0.0
-_wasActive = false
-_active = false
-_activeTreshold = 0.5
diff --git a/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Movement/Strafe Left.tres b/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Movement/Strafe Left.tres
index fd345a7..072ad1d 100644
--- a/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Movement/Strafe Left.tres
+++ b/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Movement/Strafe Left.tres
@@ -6,40 +6,13 @@
[sub_resource type="Resource" id="Resource_m3515"]
script = ExtResource("2_m4lpr")
key = 65
-keyLocation = 0
-ctrlHold = 2
-altHold = 2
-shiftHold = 2
-modifiersMode = 0
-continous = false
-_value = 0.0
-_wasActive = false
-_active = false
-_activeTreshold = 0.5
[sub_resource type="Resource" id="Resource_ejgie"]
script = ExtResource("2_m4lpr")
key = 4194319
-keyLocation = 0
-ctrlHold = 2
-altHold = 2
-shiftHold = 2
-modifiersMode = 0
-continous = false
-_value = 0.0
-_wasActive = false
-_active = false
-_activeTreshold = 0.5
[resource]
script = ExtResource("1_xuikh")
sensors = [SubResource("Resource_m3515"), SubResource("Resource_ejgie")]
showOnlyVisibleIcons = true
numVisible = 1
-inputIcons = []
-useInputIconsFromSensors = true
-continous = false
-_value = 0.0
-_wasActive = false
-_active = false
-_activeTreshold = 0.5
diff --git a/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Movement/Strafe Right.tres b/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Movement/Strafe Right.tres
index c349eee..020fe30 100644
--- a/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Movement/Strafe Right.tres
+++ b/Runtime/Sensors/Default-Sensors/Keyboard & Mouse/Movement/Strafe Right.tres
@@ -6,40 +6,13 @@
[sub_resource type="Resource" id="Resource_n5k5a"]
script = ExtResource("2_uy5s5")
key = 68
-keyLocation = 0
-ctrlHold = 2
-altHold = 2
-shiftHold = 2
-modifiersMode = 0
-continous = false
-_value = 0.0
-_wasActive = false
-_active = false
-_activeTreshold = 0.5
[sub_resource type="Resource" id="Resource_8vsbn"]
script = ExtResource("2_uy5s5")
key = 4194321
-keyLocation = 0
-ctrlHold = 2
-altHold = 2
-shiftHold = 2
-modifiersMode = 0
-continous = false
-_value = 0.0
-_wasActive = false
-_active = false
-_activeTreshold = 0.5
[resource]
script = ExtResource("1_t65bw")
sensors = [SubResource("Resource_n5k5a"), SubResource("Resource_8vsbn")]
showOnlyVisibleIcons = true
numVisible = 1
-inputIcons = []
-useInputIconsFromSensors = true
-continous = false
-_value = 0.0
-_wasActive = false
-_active = false
-_activeTreshold = 0.5
diff --git a/Runtime/Sensors/DeviceFilters/DefaultSensorDeviceSelector.cs b/Runtime/Sensors/DeviceFilters/DefaultSensorDeviceSelector.cs
new file mode 100644
index 0000000..535c376
--- /dev/null
+++ b/Runtime/Sensors/DeviceFilters/DefaultSensorDeviceSelector.cs
@@ -0,0 +1,67 @@
+
+using Godot;
+using System.Collections.Generic;
+
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass,Icon("res://addons/rokojori_action_library/Icons/SensorGroup.svg")]
+ public partial class DefaultSensorDeviceSelector: SensorDeviceSelector
+ {
+ public enum DefaultDeviceType
+ {
+ GamePad,
+ Keyboard_and_Mouse,
+ Keyboard,
+ Mouse
+ }
+
+ [Export]
+ public DefaultDeviceType deviceType;
+
+ public static bool IsMouseDevice( SensorDevice device )
+ {
+ if ( device is MouseDevice )
+ {
+ return true;
+ }
+
+ if ( device is MultiSensorDevice m )
+ {
+ return m.devices.HasNonNull( d => IsMouseDevice( d ) ) ;
+ }
+
+ return false;
+ }
+
+ public override bool Selects( SensorDevice sensorDevice )
+ {
+ if ( sensorDevice is MultiSensorDevice m )
+ {
+ return m.devices.HasNonNull( d => Selects( d ) );
+ }
+
+ if ( DefaultDeviceType.GamePad == deviceType )
+ {
+ return sensorDevice is GamePadDevice;
+ }
+
+ if ( DefaultDeviceType.Keyboard == deviceType )
+ {
+ return sensorDevice is KeyboardDevice;
+ }
+
+ if ( DefaultDeviceType.Mouse == deviceType )
+ {
+ return sensorDevice is MouseDevice;
+ }
+
+ if ( DefaultDeviceType.Keyboard_and_Mouse == deviceType )
+ {
+ return sensorDevice is MouseDevice || sensorDevice is KeyboardDevice;
+ }
+
+ return false;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Sensors/DeviceFilters/DefaultSensorDeviceSelector.cs.uid b/Runtime/Sensors/DeviceFilters/DefaultSensorDeviceSelector.cs.uid
new file mode 100644
index 0000000..04d058f
--- /dev/null
+++ b/Runtime/Sensors/DeviceFilters/DefaultSensorDeviceSelector.cs.uid
@@ -0,0 +1 @@
+uid://d3d6yud11325f
diff --git a/Runtime/Sensors/DeviceFilters/SensorDeviceSelector.cs b/Runtime/Sensors/DeviceFilters/SensorDeviceSelector.cs
new file mode 100644
index 0000000..6efddf3
--- /dev/null
+++ b/Runtime/Sensors/DeviceFilters/SensorDeviceSelector.cs
@@ -0,0 +1,13 @@
+
+using Godot;
+using System.Collections.Generic;
+
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass,Icon("res://addons/rokojori_action_library/Icons/SensorGroup.svg")]
+ public abstract partial class SensorDeviceSelector: Resource
+ {
+ public abstract bool Selects( SensorDevice sensorDevice );
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Sensors/DeviceFilters/SensorDeviceSelector.cs.uid b/Runtime/Sensors/DeviceFilters/SensorDeviceSelector.cs.uid
new file mode 100644
index 0000000..f503379
--- /dev/null
+++ b/Runtime/Sensors/DeviceFilters/SensorDeviceSelector.cs.uid
@@ -0,0 +1 @@
+uid://d2ai3jr48qhsd
diff --git a/Runtime/Sensors/Devices/MultiSensorDevice.cs b/Runtime/Sensors/Devices/MultiSensorDevice.cs
index 02a9cab..146018e 100644
--- a/Runtime/Sensors/Devices/MultiSensorDevice.cs
+++ b/Runtime/Sensors/Devices/MultiSensorDevice.cs
@@ -1,6 +1,7 @@
using Godot;
using System.Collections.Generic;
+using System.Linq;
namespace Rokojori
{
@@ -11,6 +12,11 @@ namespace Rokojori
[Export]
public SensorDevice[] devices = new SensorDevice[ 0 ];
+ public override string GetInfo()
+ {
+ return GetType().Name + devices.Map( d => d.GetInfo() ).Join( ", " );
+ }
+
[Export]
public Sensor[] sensors = new Sensor[ 0 ];
diff --git a/Runtime/Sensors/Devices/SensorDevice.cs b/Runtime/Sensors/Devices/SensorDevice.cs
index f11d7a0..d7eac9e 100644
--- a/Runtime/Sensors/Devices/SensorDevice.cs
+++ b/Runtime/Sensors/Devices/SensorDevice.cs
@@ -8,6 +8,12 @@ namespace Rokojori
[GlobalClass,Icon("res://addons/rokojori_action_library/Icons/SensorGroup.svg")]
public partial class SensorDevice: Resource
{
+
+ public virtual string GetInfo()
+ {
+ return GetType().Name;
+ }
+
public virtual LocalizedString GetDeviceName()
{
return LocaleText.Create( "---" );
diff --git a/Runtime/Sensors/OnSensor.cs b/Runtime/Sensors/OnSensor.cs
index b707e83..cf64ed4 100644
--- a/Runtime/Sensors/OnSensor.cs
+++ b/Runtime/Sensors/OnSensor.cs
@@ -42,6 +42,7 @@ namespace Rokojori
if ( onlyWhenNotConsumed && sensor.consumed )
{
+ this.LogInfo( "Sensor Consumed" );
return;
}
@@ -55,6 +56,8 @@ namespace Rokojori
return;
}
+ // this.LogInfo( "On Sensor", sensor.value, sensor.isDown );
+
if ( sensor.isDown )
{
diff --git a/Runtime/Sensors/SensorManager.cs b/Runtime/Sensors/SensorManager.cs
index c33cadf..7fb0d29 100644
--- a/Runtime/Sensors/SensorManager.cs
+++ b/Runtime/Sensors/SensorManager.cs
@@ -48,6 +48,9 @@ namespace Rokojori
[Export]
public Sensor[] registratedSensors = [];
+ [Export]
+ public bool confineMouse = false;
+
@@ -96,6 +99,8 @@ namespace Rokojori
}
+ bool hasDevice = false;
+
void UpdateDevice( SensorDevice d )
{
if ( Engine.IsEditorHint() )
@@ -103,6 +108,12 @@ namespace Rokojori
return;
}
+ // this.LogInfo(
+ // "UpdateDevice:", d.GetType().Name,
+ // "Is Mouse:", DefaultSensorDeviceSelector.IsMouseDevice( d ),
+ // "Last:", lastActiveDevice == null ? "null" : lastActiveDevice.GetType().Name
+ // );
+
var lastActive = lastActiveDevice;
@@ -117,11 +128,21 @@ namespace Rokojori
deviceLastInputTimeStamp[ index ] = (float) ( DateTime.Now - _startTime ).TotalSeconds;
- if ( lastActive == lastActiveDevice )
+ if ( hasDevice && lastActive == lastActiveDevice )
{
return;
}
+ hasDevice = true;
+
+ this.LogInfo( "Device Type Change:", lastActiveDevice.GetInfo() );
+
+ if ( confineMouse && DefaultSensorDeviceSelector.IsMouseDevice( lastActiveDevice ) )
+ {
+ Input.MouseMode = Input.MouseModeEnum.Captured;
+
+ }
+
Action.Trigger( onActiveDeviceChange );
_onActiveDeviceChange.DispatchEvent( null );
@@ -471,7 +492,7 @@ namespace Rokojori
foreach ( var n in autoScanForSensors )
{
- Nodes.ForEach( n, AddSensorsFrom );
+ Nodes.ForEach( n, n => AddSensorsFrom( n ) );
}
// if ( autoScanParent )
diff --git a/Runtime/Sensors/SensorManagerSetup.cs b/Runtime/Sensors/SensorManagerSetup.cs
index a1638e8..55a3fe2 100644
--- a/Runtime/Sensors/SensorManagerSetup.cs
+++ b/Runtime/Sensors/SensorManagerSetup.cs
@@ -35,6 +35,9 @@ namespace Rokojori
[Export]
public bool showRegistratedSensors = true;
+ [Export]
+ public bool confineMouse = false;
+
public override void _Ready()
{
if ( Engine.IsEditorHint() )
@@ -51,6 +54,7 @@ namespace Rokojori
sm.separateMouseAndKeyboardTracking = separateMouseAndKeyboardTracking;
sm.onActiveDeviceChange = onActiveDeviceChange;
sm.showRegistratedSensors = showRegistratedSensors;
+ sm.confineMouse = confineMouse;
if ( autoScanParent )
{
diff --git a/Runtime/Sensors/Sensors.cs b/Runtime/Sensors/Sensors.cs
index 7838d2a..3d562eb 100644
--- a/Runtime/Sensors/Sensors.cs
+++ b/Runtime/Sensors/Sensors.cs
@@ -32,7 +32,12 @@ namespace Rokojori
public static float PolarAxis( Sensor negative, Sensor positive, float scale = 1, float deadZone = 0.3f )
{
- return GetValue( negative, -scale, deadZone ) + GetValue( positive, scale, deadZone );
+ return - GetValue( negative, scale, deadZone ) + GetValue( positive, scale, deadZone );
+ }
+
+ public static float PolarPowerAxis( Sensor negative, Sensor positive, float scale = 1, float deadZone = 0.3f, float power = 1.0f )
+ {
+ return - Mathf.Pow( GetValue( negative, scale, deadZone ), power ) + Mathf.Pow( GetValue( positive, scale, deadZone ), power );
}
public static Vector2 FourDirectional( Sensor left, Sensor right, Sensor up, Sensor down, bool normalize = true, float deadZone = 0.3f )
diff --git a/Runtime/Shading/Generators/Generic/ShaderGenerationModule.cs b/Runtime/Shading/Generators/Generic/ShaderGenerationModule.cs
index 3a397f9..93f69f7 100644
--- a/Runtime/Shading/Generators/Generic/ShaderGenerationModule.cs
+++ b/Runtime/Shading/Generators/Generic/ShaderGenerationModule.cs
@@ -92,6 +92,8 @@ namespace Rokojori
public static List IncludeColorsLibrary(){ return IncludeFromLibrary( "Colors" ); }
+ public static List IncludeBillboardLibrary(){ return IncludeFromLibrary( "Billboard" ); }
+
public static ShaderVariant ToVariant( List code )
{
var variant = new ShaderVariant();
diff --git a/Runtime/Shading/Generators/Shapes/ShaderShapes3D.cs b/Runtime/Shading/Generators/Shapes/ShaderShapes3D.cs
new file mode 100644
index 0000000..145fdeb
--- /dev/null
+++ b/Runtime/Shading/Generators/Shapes/ShaderShapes3D.cs
@@ -0,0 +1,128 @@
+using Godot;
+using System.Reflection;
+using System.Collections.Generic;
+
+namespace Rokojori
+{
+ public enum ShaderShapeType
+ {
+ Point,
+ Sphere,
+ Box,
+ RoundBox,
+ Line,
+ Capsule,
+ RoundCone,
+ Triangle,
+ Quad
+ }
+
+ public class ShaderShape3DDefinition
+ {
+ public ShaderShapeType shaderShapeType;
+ public List shaderProperties = [];
+
+ public ShaderShape3DDefinition( ShaderShapeType type, List properties )
+ {
+ this.shaderShapeType = type;
+ this.shaderProperties = properties;
+ }
+
+ }
+
+
+ public partial class ShaderShapes3D:ShaderGenerationModule
+ {
+ public static ShaderShape3DDefinition Point = new ShaderShape3DDefinition(
+ ShaderShapeType.Point,
+ [
+ Vector3Property.Create( "point", Vector3.Zero )
+ ]
+ );
+
+ public static ShaderShape3DDefinition Sphere = new ShaderShape3DDefinition(
+ ShaderShapeType.Sphere,
+ [
+ Vector3Property.Create( "sphereCenter", Vector3.Zero ),
+ FloatProperty.Create( "sphereRadius", 1f )
+ ]
+ );
+
+ public static ShaderShape3DDefinition Box = new ShaderShape3DDefinition(
+ ShaderShapeType.Box,
+ [
+ Vector3Property.Create( "boxDimensions", Vector3.One )
+ ]
+ );
+
+ public static ShaderShape3DDefinition RoundBox = new ShaderShape3DDefinition(
+ ShaderShapeType.RoundBox,
+ [
+ Vector3Property.Create( "boxDimensions", Vector3.One ),
+ FloatProperty.Create( "boxRadius", 0.1f )
+ ]
+ );
+
+ public static ShaderShape3DDefinition Line = new ShaderShape3DDefinition(
+ ShaderShapeType.Line,
+ [
+ Vector3Property.Create( "lineStart", Vector3.Zero ),
+ Vector3Property.Create( "lineEnd", Vector3.One ),
+ ]
+ );
+
+ public static ShaderShape3DDefinition Capsule = new ShaderShape3DDefinition(
+ ShaderShapeType.Capsule,
+ [
+ Vector3Property.Create( "capsuleStart", Vector3.Zero ),
+ Vector3Property.Create( "capsuleEnd", Vector3.One ),
+ FloatProperty.Create( "capsuleRadius", 0.1f )
+ ]
+ );
+
+ public static ShaderShape3DDefinition RoundCone = new ShaderShape3DDefinition(
+ ShaderShapeType.RoundCone,
+ [
+ Vector3Property.Create( "roundConeStart", Vector3.Zero ),
+ Vector3Property.Create( "roundConeEnd", Vector3.One ),
+ FloatProperty.Create( "roundConeStartRadius", 0.1f ),
+ FloatProperty.Create( "roundConeEndRadius", 0.2f )
+ ]
+ );
+
+ public static ShaderShape3DDefinition Triangle = new ShaderShape3DDefinition(
+ ShaderShapeType.Triangle,
+ [
+ Vector3Property.Create( "triangleA", new Vector3( 0, 0, 0 ) ),
+ Vector3Property.Create( "triangleB", new Vector3( 1, 0, 0 ) ),
+ Vector3Property.Create( "triangleC", new Vector3( 1, 1, 0 ) )
+ ]
+ );
+
+ public static ShaderShape3DDefinition Quad = new ShaderShape3DDefinition(
+ ShaderShapeType.Quad,
+ [
+ Vector3Property.Create( "quadA", new Vector3( 0, 0, 0 ) ),
+ Vector3Property.Create( "quadB", new Vector3( 1, 0, 0 ) ),
+ Vector3Property.Create( "quadC", new Vector3( 1, 1, 0 ) ),
+ Vector3Property.Create( "quadD", new Vector3( 0, 1, 0 ) )
+ ]
+ );
+
+
+ public List GetCode( ShaderGenerationContext context )
+ {
+ if ( context.isIncludesPhase )
+ {
+ return IncludeSDFLibrary();
+ }
+
+ if ( context.isVariablesPhase )
+ {
+ return IncludeSDFLibrary();
+ }
+
+ return IncludeSDFLibrary();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Shading/Generators/Shapes/ShaderShapes3D.cs.uid b/Runtime/Shading/Generators/Shapes/ShaderShapes3D.cs.uid
new file mode 100644
index 0000000..305722d
--- /dev/null
+++ b/Runtime/Shading/Generators/Shapes/ShaderShapes3D.cs.uid
@@ -0,0 +1 @@
+uid://jcamsa1le5bf
diff --git a/Runtime/Shading/Generators/Spatial/Geometry/BillboardBending/GeometryBillboardBending.cs b/Runtime/Shading/Generators/Spatial/Geometry/BillboardBending/GeometryBillboardBending.cs
new file mode 100644
index 0000000..caa8b85
--- /dev/null
+++ b/Runtime/Shading/Generators/Spatial/Geometry/BillboardBending/GeometryBillboardBending.cs
@@ -0,0 +1,70 @@
+using Godot;
+using System.Reflection;
+using System.Collections.Generic;
+
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass]
+ public partial class GeometryBillboardBending:GeometryModifier
+ {
+ public override List GetGeometryCode( ShaderGenerationContext context, int offsetIndex )
+ {
+ if ( offsetIndex != 0 )
+ {
+ throw new System.Exception( "Unique component, can't be used multiple times");
+ }
+
+ if ( ShaderPhase.Includes == context.phase )
+ {
+ return IncludeBillboardLibrary();
+ }
+
+ if ( ShaderPhase.Variables == context.phase )
+ {
+ return AsUniformGroup( "BillboardBending",
+
+ @"
+ uniform float billboardBendingAmount;
+ uniform float billboardBendingMaxAmount;
+ uniform float billboardBendingEdgeScale:hint_range(0,2) = 0.5;
+ uniform float billboardBendingMinY = 0.0;
+ uniform float billboardBendingMaxY = 0.25;
+ "
+
+ );
+
+ }
+
+ if ( ShaderPhase.Vertex == context.phase )
+ {
+
+ return ToInnerBlock( "BillboadBending",
+
+ @"
+ applyBillboardBendingWithDirection(
+ VERTEX,
+ CAMERA_DIRECTION_WORLD,
+ CAMERA_POSITION_WORLD,
+ MODEL_MATRIX,
+ VIEW_MATRIX,
+ PROJECTION_MATRIX,
+ INV_VIEW_MATRIX,
+ billboardBendingAmount,
+ billboardBendingMaxAmount,
+ billboardBendingEdgeScale,
+ billboardBendingMinY,
+ billboardBendingMaxY,
+ vec3( rj_GlobalWindDirection.x, 0.0, rj_GlobalWindDirection.y )
+ );
+
+ "
+
+ );
+ }
+
+ return null;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Shading/Generators/Spatial/Geometry/BillboardBending/GeometryBillboardBending.cs.uid b/Runtime/Shading/Generators/Spatial/Geometry/BillboardBending/GeometryBillboardBending.cs.uid
new file mode 100644
index 0000000..18e11bd
--- /dev/null
+++ b/Runtime/Shading/Generators/Spatial/Geometry/BillboardBending/GeometryBillboardBending.cs.uid
@@ -0,0 +1 @@
+uid://b3ifqt00oho5d
diff --git a/Runtime/Shading/Generators/Spatial/Geometry/ShapeDeformer/GeometryShapeDeformer.cs b/Runtime/Shading/Generators/Spatial/Geometry/ShapeDeformer/GeometryShapeDeformer.cs
new file mode 100644
index 0000000..ae5988a
--- /dev/null
+++ b/Runtime/Shading/Generators/Spatial/Geometry/ShapeDeformer/GeometryShapeDeformer.cs
@@ -0,0 +1,70 @@
+using Godot;
+using System.Reflection;
+using System.Collections.Generic;
+
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass]
+ public partial class GeometryShapeDeformer:GeometryModifier
+ {
+ public enum Shape
+ {
+ Sphere,
+ Capsule,
+ Round_Cone
+ }
+
+ [Export]
+ public Shape shape;
+
+
+ public override List GetGeometryCode( ShaderGenerationContext context, int offsetIndex )
+ {
+
+ if ( ShaderPhase.Includes == context.phase )
+ {
+ return IncludeFromLibrary( "Terrain" );
+ }
+
+ if ( ShaderPhase.Variables == context.phase )
+ {
+ return AsUniformGroup( "Terrain",
+
+ @"
+ uniform sampler2D terrainHeightMap;
+ uniform vec2 terrainCenterXZ = vec2( 0.0, 0.0 );
+ uniform vec2 terrainSizeXZ = vec2( 100.0, 100.0 );
+ uniform float terrainMinHeight = 0.0;
+ uniform float terrainMaxHeight = 100.0;
+ "
+
+ );
+
+ }
+
+ if ( ShaderPhase.Vertex == context.phase )
+ {
+
+ return ToInnerBlock( "Terrain",
+
+ @"
+ addTerrainOffset(
+ MODEL_MATRIX,
+ VERTEX,
+ terrainHeightMap,
+ terrainCenterXZ,
+ terrainSizeXZ,
+ terrainMinHeight,
+ terrainMaxHeight
+ );
+
+ "
+
+ );
+ }
+
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Shading/Generators/Spatial/Geometry/ShapeDeformer/GeometryShapeDeformer.cs.uid b/Runtime/Shading/Generators/Spatial/Geometry/ShapeDeformer/GeometryShapeDeformer.cs.uid
new file mode 100644
index 0000000..9aa3370
--- /dev/null
+++ b/Runtime/Shading/Generators/Spatial/Geometry/ShapeDeformer/GeometryShapeDeformer.cs.uid
@@ -0,0 +1 @@
+uid://p60oe3yxlv30
diff --git a/Runtime/Shading/Generators/Spatial/Geometry/Wind/GeometryGlobalWind.cs b/Runtime/Shading/Generators/Spatial/Geometry/Wind/GeometryGlobalWind.cs
new file mode 100644
index 0000000..2e5486c
--- /dev/null
+++ b/Runtime/Shading/Generators/Spatial/Geometry/Wind/GeometryGlobalWind.cs
@@ -0,0 +1,95 @@
+using Godot;
+using System.Reflection;
+using System.Collections.Generic;
+using System;
+
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass]
+ public partial class GeometryGlobalWind:GeometryModifier
+ {
+
+ public override List GetGeometryCode( ShaderGenerationContext context, int offsetIndex )
+ {
+ if ( offsetIndex != 0 )
+ {
+ throw new Exception( "Unique component, can't be used multiple times");
+ }
+
+ if ( ShaderPhase.Includes == context.phase )
+ {
+ return IncludeFromLibrary( "Wind" );
+ }
+
+ if ( ShaderPhase.Variables == context.phase )
+ {
+ return AsUniformGroup( "Wind",
+
+ @"
+
+ uniform float windMaxStrength = 1;
+ uniform float windMaxRotation = 1;
+ uniform float windStrengthCurve:hint_range(0,1) = 0.5f;
+ uniform float windStart = 0;
+ uniform float windEnd = 1;
+ uniform float windWeightCurve:hint_range(0,1) = 0.5f;
+ uniform float windHeightCompensation :hint_range(0,1) = 0.5f;
+ uniform float windNormalBending :hint_range(0,1) = 0.1f;
+ uniform float windOcclusionAmount = 0;
+ global uniform sampler2D rj_GlobalWindNoiseTexture;
+ global uniform vec2 rj_GlobalWindPosition;
+ global uniform vec2 rj_GlobalWindDirection;
+ global uniform float rj_GlobalWindSpeed;
+ varying float vertexWindAO;
+ "
+
+ );
+
+ }
+
+ if ( ShaderPhase.Vertex == context.phase )
+ {
+
+ return ToInnerBlock( "Wind",
+
+ @"
+
+ float cachedVertexWindAO = 0.0;
+
+ applyGlobalWind(
+ MODEL_MATRIX,
+ VERTEX,
+ NORMAL,
+ cachedVertexWindAO,
+ windOcclusionAmount,
+ rj_GlobalWindNoiseTexture,
+ rj_GlobalWindPosition,
+ rj_GlobalWindDirection,
+ rj_GlobalWindSpeed,
+ windMaxStrength,
+ windMaxRotation,
+ windStrengthCurve,
+ windStart,
+ windEnd,
+ windWeightCurve,
+ windHeightCompensation,
+ windNormalBending
+ );
+
+ vertexWindAO = cachedVertexWindAO;
+
+ "
+
+ ) ;
+ }
+
+ if ( ShaderPhase.Fragment == context.phase )
+ {
+ return ToCode( "AO *= vertexWindAO;".Indent( " " ).LineBreaks() );
+ }
+
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Shading/Generators/Spatial/Geometry/Wind/GeometryGlobalWind.cs.uid b/Runtime/Shading/Generators/Spatial/Geometry/Wind/GeometryGlobalWind.cs.uid
new file mode 100644
index 0000000..3a0694c
--- /dev/null
+++ b/Runtime/Shading/Generators/Spatial/Geometry/Wind/GeometryGlobalWind.cs.uid
@@ -0,0 +1 @@
+uid://bugnk26aefya7
diff --git a/Runtime/Shading/Generators/Spatial/SpatialShaderGenerator.cs b/Runtime/Shading/Generators/Spatial/SpatialShaderGenerator.cs
index 54f8bba..e7f9550 100644
--- a/Runtime/Shading/Generators/Spatial/SpatialShaderGenerator.cs
+++ b/Runtime/Shading/Generators/Spatial/SpatialShaderGenerator.cs
@@ -61,6 +61,7 @@ namespace Rokojori
data.varying,
data.masks,
data.albedo,
+ data.transparency,
data.alpha,
data.fading,
data.normalMap,
@@ -118,7 +119,7 @@ namespace Rokojori
data.shading ]
;
- return preModules.Concat( mainModules );
+ return preModules.Concat( mainModules.CloneWithout( [ data.transparency ] ) );
}
if ( ShaderPhase.Vertex == phase )
diff --git a/Runtime/Shading/Generators/Spatial/TextureModule.cs b/Runtime/Shading/Generators/Spatial/TextureModule.cs
index 5689a44..414ff48 100644
--- a/Runtime/Shading/Generators/Spatial/TextureModule.cs
+++ b/Runtime/Shading/Generators/Spatial/TextureModule.cs
@@ -37,6 +37,16 @@ namespace Rokojori
public string _target;
public string _scaleTarget;
+ public enum IncludeMode
+ {
+ Inline,
+ Optional_via_Bool,
+ Condtional_Define,
+ Variant
+ }
+
+ public IncludeMode _includeMode = IncludeMode.Inline;
+
public string _uvChannel;
public bool _srgb = false;
diff --git a/Runtime/Shading/Generators/Spatial/Transparency/TransparencyModule.cs b/Runtime/Shading/Generators/Spatial/Transparency/TransparencyModule.cs
index fb2269a..88083c2 100644
--- a/Runtime/Shading/Generators/Spatial/Transparency/TransparencyModule.cs
+++ b/Runtime/Shading/Generators/Spatial/Transparency/TransparencyModule.cs
@@ -13,7 +13,7 @@ namespace Rokojori
[ExportGroup( "Alpha Scissor")]
[Export]
- public float alphaScissorTreshold = 0.5f;
+ public float alphaScissorTreshold = 0.01f;
[ExportGroup( "")]
[Export]
@@ -34,9 +34,8 @@ namespace Rokojori
{
if ( BaseMaterial3D.TransparencyEnum.AlphaScissor == transparency )
{
- return ToVariants( Lists.From( (ShaderCode) new StringShaderCode(
- "ALPHA_SCISSOR_THRESHOLD = " + RegexUtility.NumberToString( alphaScissorTreshold )
- ) ) );
+ var code = $"ALPHA_SCISSOR_THRESHOLD = {alphaScissorTreshold._G()};\n";
+ return ToVariants( ToCode( code.Indent( " " ) ) );
}
return null;
diff --git a/Runtime/Shading/Library/Billboard.gdshaderinc b/Runtime/Shading/Library/Billboard.gdshaderinc
new file mode 100644
index 0000000..790426a
--- /dev/null
+++ b/Runtime/Shading/Library/Billboard.gdshaderinc
@@ -0,0 +1,81 @@
+// #include "res://addons/rokojori_action_library/Runtime/Shading/Library/Billboard.gdshaderinc"
+
+#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Transform.gdshaderinc"
+#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Math.gdshaderinc"
+
+void applyBillboardBending(
+ inout vec3 _VERTEX,
+ vec3 _CAMERA_DIRECTION_WORLD,
+ vec3 _CAMERA_POSITION_WORLD,
+ mat4 _MODEL_MATRIX,
+ mat4 _VIEW_MATRIX,
+ mat4 _PROJECTION_MATRIX,
+ mat4 _INV_VIEW_MATRIX,
+ float _bendingAmount,
+ float _maxBendingAmount,
+ float _edgeScale,
+ float _minY,
+ float _maxY
+)
+{
+ float camDot = max( 0, dot( vec3( 0, 1, 0 ), _CAMERA_DIRECTION_WORLD ) );
+
+ camDot = camDot * camDot * camDot;
+
+ vec3 worldPosition = localToView( _VERTEX, _MODEL_MATRIX );
+ vec3 directionToCam = worldPosition - _CAMERA_POSITION_WORLD;
+ float d = length( directionToCam );
+ directionToCam.y = 0.0;
+ float dScale = min( _bendingAmount / d, _maxBendingAmount );
+ vec3 view = worldToView( worldPosition, _VIEW_MATRIX );
+ vec2 clip = viewToClip( view, _PROJECTION_MATRIX ).xy;
+ float sd = 1.0 / ( 1.0 + length( clip ) );
+ sd = mix( 1, sd, _edgeScale );
+ //directionToCam = normalize( directionToCam );
+
+ directionToCam = applyMatrixWithoutTranslation( vec3(0,-1,0), _INV_VIEW_MATRIX );
+
+ float am = camDot * mapClamped( _VERTEX.y, _minY, _maxY, 1, -1 );
+ am = am * am * am;
+ _VERTEX += am * worldToLocalDirection( directionToCam, _MODEL_MATRIX ) * dScale * sd;
+}
+
+void applyBillboardBendingWithDirection(
+ inout vec3 _VERTEX,
+ vec3 _CAMERA_DIRECTION_WORLD,
+ vec3 _CAMERA_POSITION_WORLD,
+ mat4 _MODEL_MATRIX,
+ mat4 _VIEW_MATRIX,
+ mat4 _PROJECTION_MATRIX,
+ mat4 _INV_VIEW_MATRIX,
+ float _bendingAmount,
+ float _maxBendingAmount,
+ float _edgeScale,
+ float _minY,
+ float _maxY,
+ vec3 _bendingDirection
+)
+{
+ float camDot = max( 0, dot( vec3( 0, 1, 0 ), _CAMERA_DIRECTION_WORLD ) );
+
+ camDot = camDot * camDot * camDot;
+
+ vec3 worldPosition = localToView( _VERTEX, _MODEL_MATRIX );
+ vec3 directionToCam = worldPosition - _CAMERA_POSITION_WORLD;
+ float d = length( directionToCam );
+ directionToCam.y = 0.0;
+ float dScale = min( _bendingAmount / d, _maxBendingAmount );
+ vec3 view = worldToView( worldPosition, _VIEW_MATRIX );
+ vec2 clip = viewToClip( view, _PROJECTION_MATRIX ).xy;
+ float sd = 1.0 / ( 1.0 + length( clip ) );
+ sd = mix( 1, sd, _edgeScale );
+ //directionToCam = normalize( directionToCam );
+
+ directionToCam = worldToViewDirection( _bendingDirection, _VIEW_MATRIX );
+ directionToCam.y = 0.0;
+ directionToCam = viewToWorldDirection( _bendingDirection, _INV_VIEW_MATRIX );
+
+ float am = camDot * mapClamped( _VERTEX.y, _minY, _maxY, 1, -1 );
+ am = am * am * am;
+ _VERTEX += am * worldToLocalDirection( directionToCam, _MODEL_MATRIX ) * dScale * sd;
+}
\ No newline at end of file
diff --git a/Runtime/Shading/Library/Billboard.gdshaderinc.uid b/Runtime/Shading/Library/Billboard.gdshaderinc.uid
new file mode 100644
index 0000000..2c2ceb3
--- /dev/null
+++ b/Runtime/Shading/Library/Billboard.gdshaderinc.uid
@@ -0,0 +1 @@
+uid://k2vu05skvvj
diff --git a/Runtime/Shading/Library/Light.gdshaderinc b/Runtime/Shading/Library/Light.gdshaderinc
index 6b98d4a..c0d3ef3 100644
--- a/Runtime/Shading/Library/Light.gdshaderinc
+++ b/Runtime/Shading/Library/Light.gdshaderinc
@@ -15,6 +15,11 @@ float fresnelNormalizedFromView( vec3 viewNormal, float powerAmount )
return pow( 1.0 - max( viewNormal.z, 0.0 ), powerAmount );
}
+float fresnelNormalizedFromView( vec3 viewNormal )
+{
+ return 1.0 - max( viewNormal.z, 0.0 );
+}
+
float fresnelNormalizedFromViewAdvanced( vec3 viewNormal, float zOffset, float powerAmount, float postScale, float postOffset )
{
return pow( 1.0 - clamp( viewNormal.z + zOffset, 0.0, 1.0 ), powerAmount ) * postScale + postOffset;
diff --git a/Runtime/Shading/Library/SDF.gdshaderinc b/Runtime/Shading/Library/SDF.gdshaderinc
index 02be197..e855662 100644
--- a/Runtime/Shading/Library/SDF.gdshaderinc
+++ b/Runtime/Shading/Library/SDF.gdshaderinc
@@ -95,11 +95,16 @@ float sdChamferBox( in vec2 p, in vec2 b, in float chamfer )
p.y += chamfer;
const float k = 1.0-sqrt(2.0);
- if( p.y<0.0 && p.y+p.x*k<0.0 )
- return p.x;
+
+ if ( p.y<0.0 && p.y+p.x*k<0.0 )
+ {
+ return p.x;
+ }
if( p.x k )
+ if ( sign( z ) * a2 * z2 > k )
{
return sqrt( x2 + z2 ) * il2 - r2;
}
- if( sign( y ) * a2 * y2 < k )
+ if ( sign( y ) * a2 * y2 < k )
{
return sqrt( x2 + y2 ) * il2 - r1;
}
diff --git a/Runtime/Shading/Library/Transform.gdshaderinc b/Runtime/Shading/Library/Transform.gdshaderinc
index 74a1dbe..f56231e 100644
--- a/Runtime/Shading/Library/Transform.gdshaderinc
+++ b/Runtime/Shading/Library/Transform.gdshaderinc
@@ -270,6 +270,8 @@ vec3 billboardWorldOffsetWithSize( vec2 size, vec2 _UV, mat4 _INV_VIEW_MATRIX, m
return worldOffset;
}
+
+
vec2 rotate_v2( vec2 uv, float angle )
{
float s = sin( angle );
diff --git a/Runtime/Shading/Library/Wind.gdshaderinc b/Runtime/Shading/Library/Wind.gdshaderinc
index 7baacab..77ae6e1 100644
--- a/Runtime/Shading/Library/Wind.gdshaderinc
+++ b/Runtime/Shading/Library/Wind.gdshaderinc
@@ -76,4 +76,50 @@ void applyWind(
_VERTEX.y = mix( _VERTEX.y, max( minY, _VERTEX.y - strength * _windAmount), _windHeightCompensation * 4.0f );
_NORMAL = normalize( mix( _NORMAL, vec3( circle.x, -1, circle.y ), generalStrength * _windNormalBending ) );
_vertexWindAO = mix( 1, 0, generalStrength * _windOcclusionAmount);
+}
+
+
+void applyGlobalWind(
+ mat4 _MODEL_MATRIX,
+ inout vec3 _VERTEX,
+ inout vec3 _NORMAL,
+ inout float _vertexWindAO,
+ float _windOcclusionAmount,
+ sampler2D _globalWindNoiseTexture,
+ vec2 _globalWindPosition,
+ vec2 _globalWindDirection,
+ float _globalWindSpeed,
+ float _windMaxStrength,
+ float _windMaxRotation,
+ float _windStrengthCurve,
+ float _windStart,
+ float _windEnd,
+ float _windWeightCurve,
+ float _windHeightCompensation,
+ float _windNormalBending
+ )
+{
+ float _windForceState = ( _globalWindSpeed / 100.0 );
+ _windForceState = mix( _windForceState, _windForceState / _windForceState, _windStrengthCurve *_windForceState );
+
+ float _windStrength = _windMaxStrength * _windForceState;
+ float _windAmount = normalizeToRange01( _VERTEX.y, _windStart, _windEnd );
+ float rawWindAmount = _windAmount;
+ float originalHeight = _VERTEX.y;
+ _windAmount = mix( _windAmount, _windAmount * _windAmount, _windWeightCurve );
+ vec3 worldVertex = localToWorld( _VERTEX, _MODEL_MATRIX );
+
+ vec4 windRGB = texture( _globalWindNoiseTexture, fract(_globalWindPosition + worldVertex.xz) );
+ float generalStrength = windRGB.r;
+ float strength = generalStrength * _windStrength;
+ float angle = ( windRGB.g * 2.0 - 1.0 ) * PI * _windMaxRotation * _windForceState;
+ vec2 direction = normalize( _globalWindDirection );
+ direction = normalize( rotate_v2( direction, angle ) );
+ direction *= strength;
+
+ _VERTEX = worldToLocal( worldVertex + vec3( direction.x, 0, direction.y ) * _windAmount, _MODEL_MATRIX );
+ float minY = min( _VERTEX.y, 0 );
+ _VERTEX.y = mix( _VERTEX.y, max( minY, _VERTEX.y - strength * _windAmount), _windHeightCompensation * 4.0f );
+ _NORMAL = normalize( mix( _NORMAL, vec3( direction.x, -1, direction.y ), generalStrength * _windNormalBending ) );
+ _vertexWindAO = mix( 1, 0, generalStrength * _windOcclusionAmount);
}
\ No newline at end of file
diff --git a/Runtime/Shading/Materials/CustomMaterialProperty.cs b/Runtime/Shading/Materials/CustomMaterialProperty.cs
index f9b31b6..39429b2 100644
--- a/Runtime/Shading/Materials/CustomMaterialProperty.cs
+++ b/Runtime/Shading/Materials/CustomMaterialProperty.cs
@@ -32,6 +32,19 @@ namespace Rokojori
_name._Set( _material, value );
}
+ T _cachedValue = default( T );
+
+ public void SetCached( T value )
+ {
+ Set( value );
+ _cachedValue = value;
+ }
+
+ public T GetCached()
+ {
+ return _cachedValue;
+ }
+
public void AssignFor( CustomMaterial material, T value )
{
_name._Set( material, value );
diff --git a/Runtime/Shading/Materials/Transfers/Texture2DPropertyTransfer.cs b/Runtime/Shading/Materials/Transfers/Texture2DPropertyTransfer.cs
index f280312..e5b7ced 100644
--- a/Runtime/Shading/Materials/Transfers/Texture2DPropertyTransfer.cs
+++ b/Runtime/Shading/Materials/Transfers/Texture2DPropertyTransfer.cs
@@ -9,10 +9,10 @@ namespace Rokojori
public partial class Texture2DPropertyTransfer:Resource
{
[Export]
- public Texture2DPropertyName from;
+ public Sampler2DPropertyName from;
[Export]
- public Texture2DPropertyName to;
+ public Sampler2DPropertyName to;
public void Transfer( Material a, Material b )
{
diff --git a/Runtime/Shading/Properties/BoolPropertyName.cs b/Runtime/Shading/Properties/BoolPropertyName.cs
index 55016ac..3fc0ef3 100644
--- a/Runtime/Shading/Properties/BoolPropertyName.cs
+++ b/Runtime/Shading/Properties/BoolPropertyName.cs
@@ -8,6 +8,11 @@ namespace Rokojori
[GlobalClass]
public partial class BoolPropertyName : ShaderPropertyName
{
+ public override RenderingServer.GlobalShaderParameterType GetParameterType()
+ {
+ return RenderingServer.GlobalShaderParameterType.Bool;
+ }
+
public void Set( Material material, bool value )
{
_Set( material, value );
diff --git a/Runtime/Shading/Properties/ColorPropertyName.cs b/Runtime/Shading/Properties/ColorPropertyName.cs
index dea289f..a4a9221 100644
--- a/Runtime/Shading/Properties/ColorPropertyName.cs
+++ b/Runtime/Shading/Properties/ColorPropertyName.cs
@@ -8,6 +8,11 @@ namespace Rokojori
[GlobalClass]
public partial class ColorPropertyName : ShaderPropertyName
{
+ public override RenderingServer.GlobalShaderParameterType GetParameterType()
+ {
+ return RenderingServer.GlobalShaderParameterType.Color;
+ }
+
public static readonly ColorPropertyName albedo = Create( "albedo" );
public void Set( Material material, Color value )
diff --git a/Runtime/Shading/Properties/Enums/TextureChannelPropertyName.cs b/Runtime/Shading/Properties/Enums/TextureChannelPropertyName.cs
index e5e2820..85af7fe 100644
--- a/Runtime/Shading/Properties/Enums/TextureChannelPropertyName.cs
+++ b/Runtime/Shading/Properties/Enums/TextureChannelPropertyName.cs
@@ -7,7 +7,7 @@ namespace Rokojori
[Tool]
[GlobalClass]
public partial class TextureChannelPropertyName : ShaderPropertyName
- {
+ {
public void Set( Material material, BaseMaterial3D.TextureChannel value )
{
_Set( material, value );
@@ -17,5 +17,10 @@ namespace Rokojori
{
return (BaseMaterial3D.TextureChannel)_Get( material, 0 );
}
+
+ public override RenderingServer.GlobalShaderParameterType GetParameterType()
+ {
+ return RenderingServer.GlobalShaderParameterType.Int;
+ }
}
}
\ No newline at end of file
diff --git a/Runtime/Shading/Properties/FloatPropertyName.cs b/Runtime/Shading/Properties/FloatPropertyName.cs
index 5a29873..8048013 100644
--- a/Runtime/Shading/Properties/FloatPropertyName.cs
+++ b/Runtime/Shading/Properties/FloatPropertyName.cs
@@ -8,6 +8,11 @@ namespace Rokojori
[GlobalClass]
public partial class FloatPropertyName : ShaderPropertyName
{
+ public override RenderingServer.GlobalShaderParameterType GetParameterType()
+ {
+ return RenderingServer.GlobalShaderParameterType.Float;
+ }
+
public bool isComponent
{
get
diff --git a/Runtime/Shading/Properties/IntPropertyName.cs b/Runtime/Shading/Properties/IntPropertyName.cs
index f61f68d..3deee96 100644
--- a/Runtime/Shading/Properties/IntPropertyName.cs
+++ b/Runtime/Shading/Properties/IntPropertyName.cs
@@ -8,6 +8,11 @@ namespace Rokojori
[GlobalClass]
public partial class IntPropertyName : ShaderPropertyName
{
+ public override RenderingServer.GlobalShaderParameterType GetParameterType()
+ {
+ return RenderingServer.GlobalShaderParameterType.Int;
+ }
+
public void Set( Material material, int value )
{
_Set( material, value );
diff --git a/Runtime/Shading/Properties/Properties/ColorProperty.cs b/Runtime/Shading/Properties/Properties/ColorProperty.cs
index 0b5e1d0..e006e73 100644
--- a/Runtime/Shading/Properties/Properties/ColorProperty.cs
+++ b/Runtime/Shading/Properties/Properties/ColorProperty.cs
@@ -14,6 +14,13 @@ namespace Rokojori
[Export]
public Color color;
+ public override ShaderPropertyName GetPropertyName(){ return propertyName; }
+ public override Variant GetValue(){ return color; }
+ public override RenderingServer.GlobalShaderParameterType GetParameterType()
+ {
+ return RenderingServer.GlobalShaderParameterType.Color;
+ }
+
public override void Apply( Material material )
{
propertyName.Set( material, color );
diff --git a/Runtime/Shading/Properties/Properties/FloatProperty.cs b/Runtime/Shading/Properties/Properties/FloatProperty.cs
index 8ecbfb3..175b520 100644
--- a/Runtime/Shading/Properties/Properties/FloatProperty.cs
+++ b/Runtime/Shading/Properties/Properties/FloatProperty.cs
@@ -11,11 +11,17 @@ namespace Rokojori
[Export]
public FloatPropertyName propertyName;
- public string name => propertyName.propertyName;
-
[Export]
public float value;
+ public override ShaderPropertyName GetPropertyName(){ return propertyName; }
+ public override Variant GetValue(){ return value; }
+
+ public override RenderingServer.GlobalShaderParameterType GetParameterType()
+ {
+ return RenderingServer.GlobalShaderParameterType.Float;
+ }
+
public override void Apply( Material material )
{
propertyName.Set( material, value );
diff --git a/Runtime/Shading/Properties/Properties/Sampler2DProperty.cs b/Runtime/Shading/Properties/Properties/Sampler2DProperty.cs
index ee01ae3..59f5220 100644
--- a/Runtime/Shading/Properties/Properties/Sampler2DProperty.cs
+++ b/Runtime/Shading/Properties/Properties/Sampler2DProperty.cs
@@ -14,6 +14,13 @@ namespace Rokojori
[Export]
public Texture2D value;
+ public override ShaderPropertyName GetPropertyName(){ return propertyName; }
+ public override Variant GetValue(){ return value; }
+ public override RenderingServer.GlobalShaderParameterType GetParameterType()
+ {
+ return RenderingServer.GlobalShaderParameterType.Sampler2D;
+ }
+
public override void Apply( Material material )
{
propertyName.Set( material, value );
diff --git a/Runtime/Shading/Properties/Properties/ShaderProperty.cs b/Runtime/Shading/Properties/Properties/ShaderProperty.cs
index ac8efd5..1273121 100644
--- a/Runtime/Shading/Properties/Properties/ShaderProperty.cs
+++ b/Runtime/Shading/Properties/Properties/ShaderProperty.cs
@@ -9,7 +9,25 @@ namespace Rokojori
public abstract partial class ShaderProperty : Resource
{
public virtual void Apply( Material material )
+ {}
+
+ public void ApplyGlobal()
{
+ RenderingServer.GlobalShaderParameterSet( name, GetValue() );
}
+
+ public abstract RenderingServer.GlobalShaderParameterType GetParameterType();
+
+ public void AddAsGlobalUniform()
+ {
+ RenderingServer.GlobalShaderParameterAdd( name, GetParameterType(), GetValue() );
+ }
+
+ public string name => GetPropertyName()?.propertyName;
+
+ public abstract ShaderPropertyName GetPropertyName();
+
+ public abstract Variant GetValue();
+
}
}
\ No newline at end of file
diff --git a/Runtime/Shading/Properties/Properties/ShaderPropertyBlock.cs b/Runtime/Shading/Properties/Properties/ShaderPropertyBlock.cs
new file mode 100644
index 0000000..6ca3dc7
--- /dev/null
+++ b/Runtime/Shading/Properties/Properties/ShaderPropertyBlock.cs
@@ -0,0 +1,14 @@
+using Godot;
+using System.Reflection;
+using System.Collections.Generic;
+
+namespace Rokojori
+{
+ [Tool]
+ [GlobalClass]
+ public partial class ShaderPropertyBlock : Resource
+ {
+ [Export]
+ public ShaderProperty[] shaderProperties = [];
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Shading/Properties/Properties/ShaderPropertyBlock.cs.uid b/Runtime/Shading/Properties/Properties/ShaderPropertyBlock.cs.uid
new file mode 100644
index 0000000..f7cb8f1
--- /dev/null
+++ b/Runtime/Shading/Properties/Properties/ShaderPropertyBlock.cs.uid
@@ -0,0 +1 @@
+uid://by2xsdh6vbaja
diff --git a/Runtime/Shading/Properties/Properties/Vector2Property.cs b/Runtime/Shading/Properties/Properties/Vector2Property.cs
index 4cc4821..07239db 100644
--- a/Runtime/Shading/Properties/Properties/Vector2Property.cs
+++ b/Runtime/Shading/Properties/Properties/Vector2Property.cs
@@ -10,12 +10,16 @@ namespace Rokojori
{
[Export]
public Vector2PropertyName propertyName;
-
- public string name => propertyName.propertyName;
-
[Export]
public Vector2 value;
+ public override ShaderPropertyName GetPropertyName(){ return propertyName; }
+ public override Variant GetValue(){ return value; }
+ public override RenderingServer.GlobalShaderParameterType GetParameterType()
+ {
+ return RenderingServer.GlobalShaderParameterType.Vec2;
+ }
+
public override void Apply( Material material )
{
propertyName.Set( material, value );
diff --git a/Runtime/Shading/Properties/Properties/Vector3Property.cs b/Runtime/Shading/Properties/Properties/Vector3Property.cs
index f600861..a9f27e7 100644
--- a/Runtime/Shading/Properties/Properties/Vector3Property.cs
+++ b/Runtime/Shading/Properties/Properties/Vector3Property.cs
@@ -8,10 +8,16 @@ namespace Rokojori
[GlobalClass]
public partial class Vector3Property : ShaderProperty
{
+ public override RenderingServer.GlobalShaderParameterType GetParameterType()
+ {
+ return RenderingServer.GlobalShaderParameterType.Vec3;
+ }
+
[Export]
public Vector3PropertyName propertyName;
- public string name => propertyName.propertyName;
+ public override ShaderPropertyName GetPropertyName(){ return propertyName; }
+ public override Variant GetValue(){ return value; }
[Export]
public Vector3 value;
diff --git a/Runtime/Shading/Properties/Properties/Vector4Property.cs b/Runtime/Shading/Properties/Properties/Vector4Property.cs
index 6f6075d..5e5a7d4 100644
--- a/Runtime/Shading/Properties/Properties/Vector4Property.cs
+++ b/Runtime/Shading/Properties/Properties/Vector4Property.cs
@@ -11,7 +11,14 @@ namespace Rokojori
[Export]
public Vector4PropertyName propertyName;
- public string name => propertyName.propertyName;
+ public override ShaderPropertyName GetPropertyName(){ return propertyName; }
+ public override Variant GetValue(){ return value; }
+
+ public override RenderingServer.GlobalShaderParameterType GetParameterType()
+ {
+ return RenderingServer.GlobalShaderParameterType.Vec4;
+ }
+
[Export]
public Vector4 value;
diff --git a/Runtime/Shading/Properties/Sampler2DPropertyName.cs b/Runtime/Shading/Properties/Sampler2DPropertyName.cs
index f7faea0..4690d18 100644
--- a/Runtime/Shading/Properties/Sampler2DPropertyName.cs
+++ b/Runtime/Shading/Properties/Sampler2DPropertyName.cs
@@ -8,6 +8,12 @@ namespace Rokojori
[GlobalClass]
public partial class Sampler2DPropertyName : ShaderPropertyName
{
+ public override RenderingServer.GlobalShaderParameterType GetParameterType()
+ {
+ return RenderingServer.GlobalShaderParameterType.Sampler2D;
+ }
+
+ public static Sampler2DPropertyName albedoTexture = Create( "albedo_texture" );
public void Set( Material material, Texture2D value )
{
@@ -21,9 +27,9 @@ namespace Rokojori
public static Sampler2DPropertyName Create( string name )
{
- var p = new Sampler2DPropertyName();
- p.propertyName = name;
- return p;
+ var t = new Sampler2DPropertyName();
+ t.propertyName = name;
+ return t;
}
}
}
\ No newline at end of file
diff --git a/Runtime/Shading/Properties/Sampler2DPropertyName.cs.uid b/Runtime/Shading/Properties/Sampler2DPropertyName.cs.uid
index 20af034..0e82be7 100644
--- a/Runtime/Shading/Properties/Sampler2DPropertyName.cs.uid
+++ b/Runtime/Shading/Properties/Sampler2DPropertyName.cs.uid
@@ -1 +1 @@
-uid://dksspv30lkrq7
+uid://bsreukpi8eiyy
diff --git a/Runtime/Shading/Properties/ShaderPropertyName.cs b/Runtime/Shading/Properties/ShaderPropertyName.cs
index db71f32..07b6fca 100644
--- a/Runtime/Shading/Properties/ShaderPropertyName.cs
+++ b/Runtime/Shading/Properties/ShaderPropertyName.cs
@@ -5,7 +5,7 @@ using System.Collections.Generic;
namespace Rokojori
{
- public partial class ShaderPropertyName:Resource
+ public abstract partial class ShaderPropertyName:Resource
{
[Export]
public string propertyName;
@@ -13,6 +13,9 @@ namespace Rokojori
string _cSharpName;
MultiMap _propertyInfoCache = new MultiMap();
+
+ public abstract RenderingServer.GlobalShaderParameterType GetParameterType();
+
public void _Set<[MustBeVariant] T>( Material m, T value )
{
@@ -102,4 +105,13 @@ namespace Rokojori
}
}
+
+ public partial class GetSetShaderPropertyName:ShaderPropertyName
+ {
+ public override RenderingServer.GlobalShaderParameterType GetParameterType()
+ {
+ return RenderingServer.GlobalShaderParameterType.Bool;
+ }
+ }
+
}
\ No newline at end of file
diff --git a/Runtime/Shading/Properties/Texture2DPropertyName.cs b/Runtime/Shading/Properties/Texture2DPropertyName.cs
deleted file mode 100644
index e1677e9..0000000
--- a/Runtime/Shading/Properties/Texture2DPropertyName.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using Godot;
-using System.Reflection;
-using System.Collections.Generic;
-
-namespace Rokojori
-{
- [Tool]
- [GlobalClass]
- public partial class Texture2DPropertyName : ShaderPropertyName
- {
- public static Texture2DPropertyName albedoTexture = Create( "albedo_texture" );
-
- public void Set( Material material, Texture2D value )
- {
- _Set( material, value );
- }
-
- public Texture2D Get( Material material )
- {
- return _Get( material, null );
- }
-
- public static Texture2DPropertyName Create( string name )
- {
- var t = new Texture2DPropertyName();
- t.propertyName = name;
- return t;
- }
- }
-}
\ No newline at end of file
diff --git a/Runtime/Shading/Properties/Texture2DPropertyName.cs.uid b/Runtime/Shading/Properties/Texture2DPropertyName.cs.uid
deleted file mode 100644
index 0e82be7..0000000
--- a/Runtime/Shading/Properties/Texture2DPropertyName.cs.uid
+++ /dev/null
@@ -1 +0,0 @@
-uid://bsreukpi8eiyy
diff --git a/Runtime/Shading/Properties/Vector2IPropertyName.cs b/Runtime/Shading/Properties/Vector2IPropertyName.cs
index 9dab257..f2c42d8 100644
--- a/Runtime/Shading/Properties/Vector2IPropertyName.cs
+++ b/Runtime/Shading/Properties/Vector2IPropertyName.cs
@@ -8,6 +8,11 @@ namespace Rokojori
[GlobalClass]
public partial class Vector2IPropertyName : ShaderPropertyName
{
+ public override RenderingServer.GlobalShaderParameterType GetParameterType()
+ {
+ return RenderingServer.GlobalShaderParameterType.Ivec2;
+ }
+
public void Set( Material material, Vector2I value )
{
_Set( material, value );
diff --git a/Runtime/Shading/Properties/Vector2PropertyName.cs b/Runtime/Shading/Properties/Vector2PropertyName.cs
index f31a9ec..6b5a24b 100644
--- a/Runtime/Shading/Properties/Vector2PropertyName.cs
+++ b/Runtime/Shading/Properties/Vector2PropertyName.cs
@@ -8,6 +8,11 @@ namespace Rokojori
[GlobalClass]
public partial class Vector2PropertyName : ShaderPropertyName
{
+ public override RenderingServer.GlobalShaderParameterType GetParameterType()
+ {
+ return RenderingServer.GlobalShaderParameterType.Vec2;
+ }
+
public string propertyNameX => propertyName + ".x";
public string propertyNameY => propertyName + ".y";
diff --git a/Runtime/Shading/Properties/Vector3PropertyName.cs b/Runtime/Shading/Properties/Vector3PropertyName.cs
index 5db2e6e..db45b16 100644
--- a/Runtime/Shading/Properties/Vector3PropertyName.cs
+++ b/Runtime/Shading/Properties/Vector3PropertyName.cs
@@ -8,6 +8,11 @@ namespace Rokojori
[GlobalClass]
public partial class Vector3PropertyName : ShaderPropertyName
{
+ public override RenderingServer.GlobalShaderParameterType GetParameterType()
+ {
+ return RenderingServer.GlobalShaderParameterType.Vec3;
+ }
+
public string propertyNameX => propertyName + ".x";
public string propertyNameY => propertyName + ".y";
public string propertyNameZ => propertyName + ".z";
diff --git a/Runtime/Shading/Properties/Vector4PropertyName.cs b/Runtime/Shading/Properties/Vector4PropertyName.cs
index 6646e43..6afd1fd 100644
--- a/Runtime/Shading/Properties/Vector4PropertyName.cs
+++ b/Runtime/Shading/Properties/Vector4PropertyName.cs
@@ -8,6 +8,11 @@ namespace Rokojori
[GlobalClass]
public partial class Vector4PropertyName : ShaderPropertyName
{
+ public override RenderingServer.GlobalShaderParameterType GetParameterType()
+ {
+ return RenderingServer.GlobalShaderParameterType.Vec4;
+ }
+
public string propertyNameX => propertyName + ".x";
public string propertyNameY => propertyName + ".y";
public string propertyNameZ => propertyName + ".z";
diff --git a/Runtime/Shading/Shaders/Baking/DilationDrawerMaterial.cs b/Runtime/Shading/Shaders/Baking/DilationDrawerMaterial.cs
index b315695..75331a8 100644
--- a/Runtime/Shading/Shaders/Baking/DilationDrawerMaterial.cs
+++ b/Runtime/Shading/Shaders/Baking/DilationDrawerMaterial.cs
@@ -10,7 +10,7 @@ namespace Rokojori
"res://addons/rokojori_action_library/Runtime/Shading/Shaders/Baking/DilationDrawer.gdshader"
);
- public static readonly Texture2DPropertyName textureAlbedo = Texture2DPropertyName.Create( "texture_albedo" );
+ public static readonly Sampler2DPropertyName textureAlbedo = Sampler2DPropertyName.Create( "texture_albedo" );
public static readonly Vector2PropertyName resolution = Vector2PropertyName.Create( "resolution" );
public static readonly IntPropertyName maxRadius = IntPropertyName.Create( "maxRadius" );
public static readonly IntPropertyName alphaTreshold = IntPropertyName.Create( "alphaTreshold" );
diff --git a/Runtime/Shading/Shaders/Billboards/QuadBillboard/QuadBillboardMaterial.cs b/Runtime/Shading/Shaders/Billboards/QuadBillboard/QuadBillboardMaterial.cs
index da7d0c7..8cba0d1 100644
--- a/Runtime/Shading/Shaders/Billboards/QuadBillboard/QuadBillboardMaterial.cs
+++ b/Runtime/Shading/Shaders/Billboards/QuadBillboard/QuadBillboardMaterial.cs
@@ -41,10 +41,10 @@ namespace Rokojori
public static readonly FloatPropertyName windNoiseScale = FloatPropertyName.Create( "windNoiseScale" );
public static readonly FloatPropertyName windStart = FloatPropertyName.Create( "windStart" );
public static readonly FloatPropertyName windEnd = FloatPropertyName.Create( "windEnd" );
- public static readonly Texture2DPropertyName textureAlbedo = Texture2DPropertyName.Create( "texture_albedo" );
- public static readonly Texture2DPropertyName textureNormals = Texture2DPropertyName.Create( "texture_normals" );
- public static readonly Texture2DPropertyName textureAmbientOcclusion = Texture2DPropertyName.Create( "texture_ambient_occlusion" );
- public static readonly Texture2DPropertyName textureYMapGradient = Texture2DPropertyName.Create( "texture_yMapGradient" );
+ public static readonly Sampler2DPropertyName textureAlbedo = Sampler2DPropertyName.Create( "texture_albedo" );
+ public static readonly Sampler2DPropertyName textureNormals = Sampler2DPropertyName.Create( "texture_normals" );
+ public static readonly Sampler2DPropertyName textureAmbientOcclusion = Sampler2DPropertyName.Create( "texture_ambient_occlusion" );
+ public static readonly Sampler2DPropertyName textureYMapGradient = Sampler2DPropertyName.Create( "texture_yMapGradient" );
}
diff --git a/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayMaterial.cs b/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayMaterial.cs
index 2ecd445..dd2d392 100644
--- a/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayMaterial.cs
+++ b/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayMaterial.cs
@@ -15,7 +15,7 @@ namespace Rokojori
public static readonly FloatPropertyName fresnelSharpness = FloatPropertyName.Create( "fresnelSharpness" );
public static readonly FloatPropertyName fresnelMultiply = FloatPropertyName.Create( "fresnelMultiply" );
public static readonly FloatPropertyName fresnelOffset = FloatPropertyName.Create( "fresnelOffset" );
- public static readonly Texture2DPropertyName textureAlbedo = Texture2DPropertyName.Create( "texture_albedo" );
+ public static readonly Sampler2DPropertyName textureAlbedo = Sampler2DPropertyName.Create( "texture_albedo" );
}
diff --git a/Runtime/Shading/Shaders/Effects/ScanGradient/ScanGradientMaterial.cs b/Runtime/Shading/Shaders/Effects/ScanGradient/ScanGradientMaterial.cs
index 8e66401..78636d7 100644
--- a/Runtime/Shading/Shaders/Effects/ScanGradient/ScanGradientMaterial.cs
+++ b/Runtime/Shading/Shaders/Effects/ScanGradient/ScanGradientMaterial.cs
@@ -23,8 +23,8 @@ namespace Rokojori
public static readonly FloatPropertyName noiseAmount = FloatPropertyName.Create( "noiseAmount" );
public static readonly FloatPropertyName rgbScale = FloatPropertyName.Create( "rgbScale" );
public static readonly FloatPropertyName alphaScale = FloatPropertyName.Create( "alphaScale" );
- public static readonly Texture2DPropertyName textureAlbedo = Texture2DPropertyName.Create( "texture_albedo" );
- public static readonly Texture2DPropertyName scanTexture = Texture2DPropertyName.Create( "scanTexture" );
+ public static readonly Sampler2DPropertyName textureAlbedo = Sampler2DPropertyName.Create( "texture_albedo" );
+ public static readonly Sampler2DPropertyName scanTexture = Sampler2DPropertyName.Create( "scanTexture" );
}
diff --git a/Runtime/Shading/Shaders/Effects/TriPlanarOverlay/TriPlanarOverlayMaterial.cs b/Runtime/Shading/Shaders/Effects/TriPlanarOverlay/TriPlanarOverlayMaterial.cs
index f354761..a32b8bf 100644
--- a/Runtime/Shading/Shaders/Effects/TriPlanarOverlay/TriPlanarOverlayMaterial.cs
+++ b/Runtime/Shading/Shaders/Effects/TriPlanarOverlay/TriPlanarOverlayMaterial.cs
@@ -15,7 +15,7 @@ namespace Rokojori
public static readonly Vector3PropertyName uvScale = Vector3PropertyName.Create( "uv_scale" );
public static readonly Vector3PropertyName uvOffset = Vector3PropertyName.Create( "uv_offset" );
public static readonly Vector3PropertyName uvMovement = Vector3PropertyName.Create( "uvMovement" );
- public static readonly Texture2DPropertyName textureAlbedo = Texture2DPropertyName.Create( "texture_albedo" );
+ public static readonly Sampler2DPropertyName textureAlbedo = Sampler2DPropertyName.Create( "texture_albedo" );
}
diff --git a/Runtime/Shading/Shaders/UniformMember.cs b/Runtime/Shading/Shaders/UniformMember.cs
index 4997e04..f0f5c50 100644
--- a/Runtime/Shading/Shaders/UniformMember.cs
+++ b/Runtime/Shading/Shaders/UniformMember.cs
@@ -21,7 +21,7 @@ namespace Rokojori
public static UniformMember Create( string name, Variant.Type type )
{
- var um = new UniformMember ();
+ var um = new UniformMember();
um.name = name;
um.type = type;
return um;
@@ -51,7 +51,7 @@ namespace Rokojori
public T Get<[MustBeVariant] T>( StandardMaterial3D standardMaterial )
{
- var property = new ShaderPropertyName();
+ var property = new GetSetShaderPropertyName();
property.propertyName = name;
return property._Get( standardMaterial, default( T ) );
}
@@ -63,7 +63,7 @@ namespace Rokojori
public void Set( StandardMaterial3D standardMaterial, Variant value )
{
- var property = new ShaderPropertyName();
+ var property = new GetSetShaderPropertyName();
property.propertyName = name;
property._Set( standardMaterial, value );
}
diff --git a/Runtime/Shading/Shaders/Wipes/FadeWipe/FadeWipeMaterial.cs b/Runtime/Shading/Shaders/Wipes/FadeWipe/FadeWipeMaterial.cs
index b02ee65..9a13851 100644
--- a/Runtime/Shading/Shaders/Wipes/FadeWipe/FadeWipeMaterial.cs
+++ b/Runtime/Shading/Shaders/Wipes/FadeWipe/FadeWipeMaterial.cs
@@ -19,7 +19,7 @@ namespace Rokojori
public static readonly FloatPropertyName uvScale = FloatPropertyName.Create( "uvScale" );
public static readonly Vector2PropertyName uvScaleCenter = Vector2PropertyName.Create( "uvScaleCenter" );
public static readonly Vector2PropertyName uvTranslation = Vector2PropertyName.Create( "uvTranslation" );
- public static readonly Texture2DPropertyName wipeTexture = Texture2DPropertyName.Create( "wipeTexture" );
+ public static readonly Sampler2DPropertyName wipeTexture = Sampler2DPropertyName.Create( "wipeTexture" );
}
diff --git a/Runtime/Shading/Tools/CSShaderClassGenerator/CSShaderClassGenerator.cs b/Runtime/Shading/Tools/CSShaderClassGenerator/CSShaderClassGenerator.cs
index 416b656..859587a 100644
--- a/Runtime/Shading/Tools/CSShaderClassGenerator/CSShaderClassGenerator.cs
+++ b/Runtime/Shading/Tools/CSShaderClassGenerator/CSShaderClassGenerator.cs
@@ -63,6 +63,15 @@ namespace Rokojori
( m )=>
{
var type = m.GetPropertyNameType();
+
+ var csType = type;
+
+ if ( type == "Texture2D" )
+ {
+ type = "Sampler2D";
+ }
+
+
var name = m.name;
var csName = name.ToCamelCase();
@@ -70,8 +79,6 @@ namespace Rokojori
var instance = "public readonly CustomMaterialProperty<${csType}> ${csName};";
var init = "${csName} = new CustomMaterialProperty<${csType}>( this, ${ShaderName}Shader.${csName} );";
- var csType = type;
-
if ( type == "Float" )
{
csType = "float";
@@ -84,6 +91,7 @@ namespace Rokojori
{
csType = "bool";
}
+
var map = new StringMap();
map[ "${type}" ] = type;
@@ -91,6 +99,7 @@ namespace Rokojori
map[ "${name}" ] = name;
map[ "${csName}" ] = csName;
map[ "${ShaderName}"] = shaderName;
+
staticProps.Add( map.ReplaceAll( declaration ) );
instanceProps.Add( map.ReplaceAll( instance ) );
diff --git a/Runtime/Structures/MultiMap.cs b/Runtime/Structures/MultiMap.cs
index f6bf94a..fdaabd4 100644
--- a/Runtime/Structures/MultiMap.cs
+++ b/Runtime/Structures/MultiMap.cs
@@ -22,6 +22,11 @@ namespace Rokojori
public V Get( K1 key1, K2 key2 )
{
+ if ( key1 == null || key2 == null )
+ {
+ return default(V);
+ }
+
if ( ! ContainsKey( key1 ) )
{
return default(V);
diff --git a/Runtime/Structures/Spatial/QuadTree/QuadTree.cs b/Runtime/Structures/Spatial/QuadTree/QuadTree.cs
index 1012a36..46166d4 100644
--- a/Runtime/Structures/Spatial/QuadTree/QuadTree.cs
+++ b/Runtime/Structures/Spatial/QuadTree/QuadTree.cs
@@ -8,7 +8,7 @@ using System.Linq;
namespace Rokojori
{
- public class QuadTree:QuadTreeNode
+ public class QuadTree:QuadTreeNode
{
protected Func _getPosition;
protected Func,List> _combinePoints;
@@ -68,8 +68,8 @@ namespace Rokojori
- List> _rootCells = new List>();
- public List> rootCells => _rootCells;
+ List> _rootCells = new List>();
+ public List> rootCells => _rootCells;
public bool Insert( List data )
{
@@ -219,22 +219,22 @@ namespace Rokojori
}
}
- public MapList> GetLevelMap()
+ public MapList> GetLevelMap()
{
- var walker = new QuadTreeWalker();
+ var walker = new QuadTreeWalker();
- var levelMap = new MapList>();
+ var levelMap = new MapList>();
walker.Iterate(
this,
( n )=>
{
- if ( n is QuadTree tree )
+ if ( n is QuadTree tree )
{
return;
}
- var c = n as QuadTreeCell;
+ var c = n as QuadTreeCell;
levelMap.Add( c.depth, c );
}
@@ -260,13 +260,13 @@ namespace Rokojori
return _getPosition( data );
}
- public QuadTreeCell GetRootCell( Vector2 position )
+ public QuadTreeCell GetRootCell( Vector2 position )
{
var rootIndex = PositionToRootIndex( position );
return GetRootCellByRootIndex( rootIndex );
}
- public QuadTreeCell GetRootCellByRootIndex( Vector2I rootCellIndex )
+ public QuadTreeCell GetRootCellByRootIndex( Vector2I rootCellIndex )
{
var rootCellFlatIndex = MathX.MultiIndexToFlatIndex( rootCellIndex, _rootCellDimensions );
@@ -298,7 +298,7 @@ namespace Rokojori
var min = rootIndex * rootCellSize3 + start;
var max = min + rootCellSize3;
- var cell = QuadTreeCell.Create( this, min, max, _rootCells.Count );
+ var cell = QuadTreeCell.Create( this, min, max, _rootCells.Count );
_rootCells.Add( cell );
diff --git a/Runtime/Structures/Spatial/Voronoi/Voronoi2D.cs b/Runtime/Structures/Spatial/Voronoi/Voronoi2D.cs
new file mode 100644
index 0000000..4fc7575
--- /dev/null
+++ b/Runtime/Structures/Spatial/Voronoi/Voronoi2D.cs
@@ -0,0 +1,155 @@
+using System.Collections;
+using System.Collections.Generic;
+using Godot;
+using System;
+using System.Linq;
+
+
+using TriangleNet.Geometry;
+using TriangleNet.Meshing;
+using TriangleNet.Voronoi;
+using TriangleNet.Topology.DCEL;
+
+namespace Rokojori
+{
+ public class Voronoi2D
+ {
+ public class Edge
+ {
+ public int start;
+ public int end;
+ }
+
+ public List cellPoints;
+ public List boundaryPoints = new List();
+ public List cells = new List| ();
+ public List edges = new List();
+
+ public class Cell
+ {
+ public int index;
+ public List neighbors = new List();
+ public List boundaries = new List();
+
+ protected Voronoi2D _voronoi2D;
+
+ public Cell( Voronoi2D v, int index )
+ {
+ _voronoi2D = v;
+ this.index = index;
+ }
+
+ public List GetBoundaryPositions()
+ {
+ return boundaries.Map( b => _voronoi2D.boundaryPoints[ b ] );
+ }
+ }
+
+
+ public static Voronoi2D CreateFromCellPoints( List cellPoints )
+ {
+ var polygon = new Polygon();
+ cellPoints.ForEach( c => polygon.Add( new TriangleNet.Geometry.Vertex( c.X, c.Y ) ) );
+
+ var v = new Voronoi2D();
+ v.cellPoints = cellPoints;
+
+ var mesh = (TriangleNet.Mesh) polygon.Triangulate();
+
+ var voronoi = new StandardVoronoi( mesh );
+
+ var boundaryMap = new Dictionary();
+ var edgesMap = new Dictionary();
+
+ foreach ( var face in voronoi.Faces )
+ {
+ var site = face.generator;
+ var cell = new Cell( v, site.ID );
+
+ var edge = face.edge;
+
+ if ( edge == null )
+ {
+ continue;
+ }
+
+ var start = edge;
+
+
+ AddEdge( cell, start, boundaryMap, edgesMap );
+
+
+ var it = start.next;
+
+ while ( it != start && it != null )
+ {
+ AddEdge( cell, it, boundaryMap, edgesMap );
+ it = it.next;
+ }
+
+ v.cells.Add( cell );
+ }
+
+ for ( int i = 0; i < boundaryMap.Count; i++ )
+ {
+ if ( ! boundaryMap.ContainsKey( i ) )
+ {
+ RJLog.Log( "Invalid index for boundary", i );
+ continue;
+ }
+
+ v.boundaryPoints.Add( boundaryMap[ i ] );
+
+ }
+
+ foreach ( var edge in edgesMap )
+ {
+ v.edges.Add( edge.Value );
+ }
+
+ return v;
+ }
+
+ static void AddEdge( Cell cell, HalfEdge halfEdge, Dictionary boundaryMap, Dictionary edgeMap )
+ {
+ if ( halfEdge == null )
+ {
+ return;
+ }
+
+ if ( ! boundaryMap.ContainsKey( halfEdge.origin.id ) )
+ {
+ boundaryMap[ halfEdge.origin.id ] = new Vector2( (float) halfEdge.origin.x, (float) halfEdge.origin.y );
+ }
+
+ var end = halfEdge.next;
+
+ if ( end != null )
+ {
+ int[] ids = [ halfEdge.origin.id, halfEdge.next.origin.id ];
+
+ if ( ids[ 0 ] > ids[ 1 ] )
+ {
+ var b = ids[ 0 ];
+ ids[ 0 ] = ids[ 1 ];
+ ids[ 1 ] = b;
+ }
+
+ var edgeID = ids[ 0 ] + " " + ids[ 1 ];
+
+ if ( ! edgeMap.ContainsKey( edgeID ) )
+ {
+ var edge = new Edge();
+ edge.start = halfEdge.origin.id;
+ edge.end = halfEdge.next.origin.id;
+ edgeMap[ edgeID ] = edge;
+ }
+
+ }
+
+ cell.neighbors.Add( halfEdge.Twin.id );
+
+ cell.boundaries.Add( halfEdge.origin.id );
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Structures/Spatial/Voronoi/Voronoi2D.cs.uid b/Runtime/Structures/Spatial/Voronoi/Voronoi2D.cs.uid
new file mode 100644
index 0000000..e852033
--- /dev/null
+++ b/Runtime/Structures/Spatial/Voronoi/Voronoi2D.cs.uid
@@ -0,0 +1 @@
+uid://bo5iy33uv7a4r
diff --git a/Runtime/Time/TImeLineManager_Scheduling.cs b/Runtime/Time/TImeLineManager_Scheduling.cs
index f37c5e5..8d4a997 100644
--- a/Runtime/Time/TImeLineManager_Scheduling.cs
+++ b/Runtime/Time/TImeLineManager_Scheduling.cs
@@ -4,6 +4,7 @@ using System.Collections;
using System.Collections.Generic;
using System;
using Godot;
+using System.Threading.Tasks;
namespace Rokojori
@@ -31,28 +32,46 @@ namespace Rokojori
}
- public static TimeLineEvent ScheduleEvent( TimeLine timeline, float position, Action callback )
+ static async Task RunLater( float delay, TimeLineEvent te, Action callback, Node context = null )
+ {
+
+ await context.RequestNextFrame();
+ await context.WaitForAsyncTimer( delay );
+
+ callback( te );
+
+ }
+
+ public static TimeLineEvent ScheduleEvent( TimeLine timeline, float position, Action callback, Node context = null )
{
timeline = TimeLineManager.Ensure( timeline );
+
+
+ if ( Engine.IsEditorHint() )
+ {
+ var te = new TimeLineEvent();
+ var time = timeline.position;
+ RunLater( position - time, te, callback, context );
+ return te;
+ }
+
+
var runner = timeline.runner;
var eventID = TimeLineManager.CreateID();
return runner._ScheduleEvent( position, eventID, false, callback );
}
- public static TimeLineEvent ScheduleEventIn( TimeLine timeline, float offset, Action callback )
+ public static TimeLineEvent ScheduleEventIn( TimeLine timeline, float offset, Action callback, Node context = null)
{
timeline = TimeLineManager.Ensure( timeline );
- var runner = timeline.runner;
var position = timeline.position + offset;
- var eventID = TimeLineManager.CreateID();
-
- return runner._ScheduleEvent( position, eventID, false, callback );
+ return ScheduleEvent( timeline, position, callback, context );
}
- public static TimeLineEvent ScheduleEventWith( Duration duration, Action callback )
+ public static TimeLineEvent ScheduleEventWith( Duration duration, Action callback, Node context = null )
{
- return ScheduleEventIn( duration.timeLine, duration.GetDurationInSeconds(), callback );
+ return ScheduleEventIn( duration.timeLine, duration.GetDurationInSeconds(), callback, context );
}
public static TimeLineEvent ScheduleLoopEvent( TimeLine timeline, float duration, float offset, Action callback )
@@ -65,14 +84,32 @@ namespace Rokojori
}
- public static TimeLineSpan ScheduleSpan( TimeLine timeline, float start, float end, Action callback )
+ public static TimeLineSpan ScheduleSpan( TimeLine timeline, float start, float end, Action callback, Node context = null )
{
+ timeline = TimeLineManager.Ensure( timeline );
+
+ var delay = start - timeline.position;
+ var duration = end - start;
+ return ScheduleSpanIn( timeline, delay, duration, callback, context );
+
+ /*if ( Engine.IsEditorHint() )
+ {
+ var span = new TimeLineSpan();
+ span.id = GodotRandom.Get().IntegerInclusive( 0, 1000000 );
+ // var root = Root.Window();
+ // RJLog.Log( root, RokojoriPlugin.Get() );
+
+ RunInEditor( span, end - start, callback, context );
+
+ return span;
+ }
+
timeline = TimeLineManager.Ensure( timeline );
var runner = timeline.runner;
var spanID = TimeLineManager.CreateID();
var duration = end - start;
- return runner._ScheduleSpan( start, end, spanID, false, callback );
+ return runner._ScheduleSpan( start, end, spanID, false, callback );*/
}
public static TimeLineSpan ScheduleSpanWith( Duration duration, Action callback )
@@ -80,9 +117,57 @@ namespace Rokojori
return ScheduleSpanIn( duration.timeLine, 0, duration.GetDurationInSeconds(), callback );
}
- public static TimeLineSpan ScheduleSpanIn( TimeLine timeline, float delay, float duration, Action callback )
+ static async Task RunSpanInEditor( TimeLineSpan span, float duration, Action callback, Node context = null )
+ {
+ if ( context == null )
+ {
+ return;
+ }
+
+ for ( int i = 0; i < 3; i++ )
+ {
+ await context.RequestNextFrame();
+ }
+
+ var elapsed = 0f;
+ var isFirst = true;
+
+ var startTime = Time.GetTicksMsec() / 1000.0f;
+ span.start = startTime;
+ span.end = startTime + duration;
+ span.wasInside = true;
+ span.timeLine = new TimeLine();
+
+ while ( elapsed < duration )
+ {
+ var type = isFirst ? TimeLineSpanUpdateType.Start : TimeLineSpanUpdateType.InSpan;
+ isFirst = false;
+ callback( span, type );
+ await context.RequestNextFrame();
+
+ elapsed = ( Time.GetTicksMsec() / 1000.0f - startTime );
+ }
+
+ callback( span, TimeLineSpanUpdateType.End );
+ }
+
+ public static TimeLineSpan ScheduleSpanIn( TimeLine timeline, float delay, float duration, Action callback, Node context = null )
{
timeline = TimeLineManager.Ensure( timeline );
+
+ if ( Engine.IsEditorHint() )
+ {
+ var span = new TimeLineSpan();
+ span.id = GodotRandom.Get().IntegerInclusive( 0, 1000000 );
+ // var root = Root.Window();
+ // RJLog.Log( root, RokojoriPlugin.Get() );
+
+ RunSpanInEditor( span, duration, callback, context );
+
+ return span;
+ }
+
+
var runner = timeline.runner;
if ( runner == null )
diff --git a/Runtime/Time/TimeLineManager.cs b/Runtime/Time/TimeLineManager.cs
index a8ddd39..952bd0d 100644
--- a/Runtime/Time/TimeLineManager.cs
+++ b/Runtime/Time/TimeLineManager.cs
@@ -52,8 +52,14 @@ namespace Rokojori
QueueList _processCallbacks = new QueueList();
+ bool _inProcess = false;
+
+ public bool inProcess => _inProcess;
+
public override void _Process( double delta )
{
+ _inProcess = true;
+
UpdateRealTime( delta );
if ( ! Engine.IsEditorHint() && gametimeTimeline != null )
@@ -65,6 +71,8 @@ namespace Rokojori
_runners.ForEach( r => r.UpdateTimeLine( unscaledTimeDelta ) );
_processCallbacks.IterateAndResolve( t => t() );
+
+ _inProcess = false;
}
public void AddProcessCallback( System.Action a )
@@ -117,6 +125,8 @@ namespace Rokojori
public double realtime => _realtimePosition;
+
+
void Initialize()
{
if ( _initialized )
@@ -139,6 +149,11 @@ namespace Rokojori
var tm = Get();
+ if ( tm == null )
+ {
+ return new TimeLine();
+ }
+
return tm.gametimeTimeline;
}
diff --git a/Runtime/Tools/Arrays.cs b/Runtime/Tools/Arrays.cs
index 1243641..713414b 100644
--- a/Runtime/Tools/Arrays.cs
+++ b/Runtime/Tools/Arrays.cs
@@ -60,6 +60,11 @@ namespace Rokojori
return entryIndex == -1 ? default(T) : values[ entryIndex ];
}
+ public static bool Has( this T[] values, Func predicate )
+ {
+ return Find( values, predicate ) != null;
+ }
+
public static T FindNonNull( this T[] values, Func predicate )
{
if ( values == null )
@@ -72,7 +77,12 @@ namespace Rokojori
return entryIndex == -1 ? default(T) : values[ entryIndex ];
}
- public static bool Contains ( T[] values, T other )
+ public static bool HasNonNull( this T[] values, Func predicate )
+ {
+ return FindNonNull( values, predicate ) != null;
+ }
+
+ public static bool Contains( T[] values, T other )
{
return Array.IndexOf( values, other ) != -1;
}
diff --git a/Runtime/Tools/Lists.cs b/Runtime/Tools/Lists.cs
index b865b5e..e8d163d 100644
--- a/Runtime/Tools/Lists.cs
+++ b/Runtime/Tools/Lists.cs
@@ -1086,6 +1086,30 @@ namespace Rokojori
return [.. values];
}
+ public static void Remove( this List list, HashSet removals )
+ {
+ list.RemoveAll( m => removals.Contains( m ) );
+ }
+
+ public static void Remove( this List list, List removals )
+ {
+ if ( list.Count * removals.Count > 100 )
+ {
+ var removalSet = new HashSet( removals );
+ list.Remove( removalSet );
+ return;
+ }
+
+ list.RemoveAll( m => removals.Contains( m ) );
+ }
+
+ public static List CloneWithout( this List list, List removals )
+ {
+ var cloned = list.Clone();
+ cloned.Remove( removals );
+ return cloned;
+ }
+
public static List Map<[Godot.MustBeVariant]T,U>( Godot.Collections.Array inputList, Func mapper, List list = null )
{
if ( list == null )
diff --git a/Runtime/UI/Shaders/RoundedRectangle/RoundedRectangleMaterial.cs b/Runtime/UI/Shaders/RoundedRectangle/RoundedRectangleMaterial.cs
index 9cfba3a..e46c031 100644
--- a/Runtime/UI/Shaders/RoundedRectangle/RoundedRectangleMaterial.cs
+++ b/Runtime/UI/Shaders/RoundedRectangle/RoundedRectangleMaterial.cs
@@ -24,10 +24,10 @@ namespace Rokojori
public static readonly Vector4PropertyName screenStrokeMultiplyUvTransform = Vector4PropertyName.Create( "screenStrokeMultiplyUVTransform" );
public static readonly Vector2PropertyName screenStrokeMultiplyUvMovment = Vector2PropertyName.Create( "screenStrokeMultiplyUVMovment" );
public static readonly FloatPropertyName opacity = FloatPropertyName.Create( "opacity" );
- public static readonly Texture2DPropertyName fill = Texture2DPropertyName.Create( "fill" );
- public static readonly Texture2DPropertyName screenFillMultiply = Texture2DPropertyName.Create( "screenFillMultiply" );
- public static readonly Texture2DPropertyName stroke = Texture2DPropertyName.Create( "stroke" );
- public static readonly Texture2DPropertyName screenStrokeMultiply = Texture2DPropertyName.Create( "screenStrokeMultiply" );
+ public static readonly Sampler2DPropertyName fill = Sampler2DPropertyName.Create( "fill" );
+ public static readonly Sampler2DPropertyName screenFillMultiply = Sampler2DPropertyName.Create( "screenFillMultiply" );
+ public static readonly Sampler2DPropertyName stroke = Sampler2DPropertyName.Create( "stroke" );
+ public static readonly Sampler2DPropertyName screenStrokeMultiply = Sampler2DPropertyName.Create( "screenStrokeMultiply" );
}
diff --git a/Runtime/UI/Shaders/Slider/SliderMaterial.cs b/Runtime/UI/Shaders/Slider/SliderMaterial.cs
index 66cc63e..5b75755 100644
--- a/Runtime/UI/Shaders/Slider/SliderMaterial.cs
+++ b/Runtime/UI/Shaders/Slider/SliderMaterial.cs
@@ -17,16 +17,16 @@ namespace Rokojori
public static readonly FloatPropertyName borderRadius = FloatPropertyName.Create( "borderRadius" );
public static readonly FloatPropertyName offset = FloatPropertyName.Create( "offset" );
public static readonly ColorPropertyName fillColor = ColorPropertyName.Create( "fillColor" );
- public static readonly Texture2DPropertyName fill = Texture2DPropertyName.Create( "fill" );
+ public static readonly Sampler2DPropertyName fill = Sampler2DPropertyName.Create( "fill" );
public static readonly Vector4PropertyName fillUvTransform = Vector4PropertyName.Create( "fillUVTransform" );
- public static readonly Texture2DPropertyName screenFillMultiply = Texture2DPropertyName.Create( "screenFillMultiply" );
+ public static readonly Sampler2DPropertyName screenFillMultiply = Sampler2DPropertyName.Create( "screenFillMultiply" );
public static readonly Vector4PropertyName screenfillMultiplyUvTransform = Vector4PropertyName.Create( "screenfillMultiplyUVTransform" );
public static readonly Vector2PropertyName screenfillMultiplyUvMovement = Vector2PropertyName.Create( "screenfillMultiplyUVMovement" );
public static readonly FloatPropertyName strokeSize = FloatPropertyName.Create( "strokeSize" );
public static readonly ColorPropertyName strokeColor = ColorPropertyName.Create( "strokeColor" );
- public static readonly Texture2DPropertyName stroke = Texture2DPropertyName.Create( "stroke" );
+ public static readonly Sampler2DPropertyName stroke = Sampler2DPropertyName.Create( "stroke" );
public static readonly Vector4PropertyName strokeUvTransform = Vector4PropertyName.Create( "strokeUVTransform" );
- public static readonly Texture2DPropertyName screenStrokeMultiply = Texture2DPropertyName.Create( "screenStrokeMultiply" );
+ public static readonly Sampler2DPropertyName screenStrokeMultiply = Sampler2DPropertyName.Create( "screenStrokeMultiply" );
public static readonly Vector4PropertyName screenStrokeMultiplyUvTransform = Vector4PropertyName.Create( "screenStrokeMultiplyUVTransform" );
public static readonly Vector2PropertyName screenStrokeMultiplyUvMovment = Vector2PropertyName.Create( "screenStrokeMultiplyUVMovment" );
public static readonly Vector2PropertyName sliderSize = Vector2PropertyName.Create( "sliderSize" );
diff --git a/Tools/Messages/Message Background.tres b/Tools/Messages/Message Background.tres
index 7133f32..b87e9de 100644
--- a/Tools/Messages/Message Background.tres
+++ b/Tools/Messages/Message Background.tres
@@ -8,45 +8,27 @@
script = ExtResource("1_4fcac")
value = 0.35
unit = "em"
-isAnimated = false
-animationDuration = 0.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://cnkyynboxg1qg"
[sub_resource type="Resource" id="Resource_tqqfk"]
script = ExtResource("2_m58tc")
color = Color(0.109394, 0.185443, 0.377804, 0.278431)
-isAnimated = false
-blendMode = 2
-animationDuration = 1.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://drqb0pm5ub64g"
[sub_resource type="Resource" id="Resource_bbety"]
script = ExtResource("1_4fcac")
value = 0.304
unit = "em"
-isAnimated = false
-animationDuration = 0.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://cnkyynboxg1qg"
[sub_resource type="Resource" id="Resource_aywh2"]
script = ExtResource("2_m58tc")
color = Color(1, 0, 0, 0)
-isAnimated = false
-blendMode = 2
-animationDuration = 1.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://drqb0pm5ub64g"
[sub_resource type="Resource" id="Resource_deji5"]
script = ExtResource("1_4fcac")
-value = 0.0
unit = "em"
-isAnimated = false
-animationDuration = 0.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://cnkyynboxg1qg"
[resource]
diff --git a/Tools/Messages/Message Content.tres b/Tools/Messages/Message Content.tres
index d1ad1b2..edbdeb6 100644
--- a/Tools/Messages/Message Content.tres
+++ b/Tools/Messages/Message Content.tres
@@ -7,31 +7,17 @@
[sub_resource type="Resource" id="Resource_b7ax2"]
script = ExtResource("1_mxep8")
color = Color(1, 1, 1, 0.843137)
-isAnimated = false
-blendMode = 2
-animationDuration = 1.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://drqb0pm5ub64g"
[sub_resource type="Resource" id="Resource_ceyak"]
script = ExtResource("3_yyf6n")
value = 1.0
unit = "100*pw - 3*em"
-isAnimated = false
-animationDuration = 0.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://cnkyynboxg1qg"
[resource]
script = ExtResource("1_h0nak")
-selectorStyles = []
-layout = 0
width = SubResource("Resource_ceyak")
fontColor = SubResource("Resource_b7ax2")
-position = 0
lineWrap = 2
-colorProperties = []
-numberProperties = []
-numberTransitions = []
-colorTransitions = []
metadata/_custom_type_script = "uid://chmcc71dvu4vj"
diff --git a/Tools/Messages/Message Icon.tres b/Tools/Messages/Message Icon.tres
index e06f88b..0f9a838 100644
--- a/Tools/Messages/Message Icon.tres
+++ b/Tools/Messages/Message Icon.tres
@@ -7,40 +7,23 @@
script = ExtResource("1_pa65f")
value = 0.7
unit = "em"
-isAnimated = false
-animationDuration = 0.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://cnkyynboxg1qg"
[sub_resource type="Resource" id="Resource_lp6ep"]
script = ExtResource("1_pa65f")
value = 0.3
unit = "em"
-isAnimated = false
-animationDuration = 0.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://cnkyynboxg1qg"
[sub_resource type="Resource" id="Resource_075oq"]
script = ExtResource("1_pa65f")
value = 0.7
unit = "em"
-isAnimated = false
-animationDuration = 0.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://cnkyynboxg1qg"
[resource]
script = ExtResource("1_54agi")
-selectorStyles = []
-layout = 0
width = SubResource("Resource_075oq")
height = SubResource("Resource_ck6db")
marginRight = SubResource("Resource_lp6ep")
-position = 0
-lineWrap = 0
-colorProperties = []
-numberProperties = []
-numberTransitions = []
-colorTransitions = []
metadata/_custom_type_script = "uid://chmcc71dvu4vj"
diff --git a/Tools/Messages/Message Link.tres b/Tools/Messages/Message Link.tres
index 30d7460..b1caf6f 100644
--- a/Tools/Messages/Message Link.tres
+++ b/Tools/Messages/Message Link.tres
@@ -17,8 +17,6 @@ metadata/_custom_type_script = "uid://5w3jvlqxrvaf"
[sub_resource type="Resource" id="Resource_elisx"]
script = ExtResource("1_7jmns")
-property = 0
-shaderPropertyName = ""
settings = SubResource("Resource_u0n27")
metadata/_custom_type_script = "uid://c5k6edrmdr3qc"
@@ -26,30 +24,18 @@ metadata/_custom_type_script = "uid://c5k6edrmdr3qc"
script = ExtResource("1_gjlxr")
value = 0.8
unit = "em"
-isAnimated = false
-animationDuration = 0.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://cnkyynboxg1qg"
[sub_resource type="Resource" id="Resource_7jmns"]
script = ExtResource("1_gjlxr")
value = 1.0
unit = "100*pw - 3.5*em"
-isAnimated = false
-animationDuration = 0.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://cnkyynboxg1qg"
[resource]
script = ExtResource("1_4hxpd")
-selectorStyles = []
-layout = 0
width = SubResource("Resource_7jmns")
fontSize = SubResource("Resource_qf1n2")
-position = 0
lineWrap = 2
-colorProperties = []
-numberProperties = []
-numberTransitions = []
colorTransitions = [SubResource("Resource_elisx")]
metadata/_custom_type_script = "uid://chmcc71dvu4vj"
diff --git a/Tools/Messages/Message Node Link.tres b/Tools/Messages/Message Node Link.tres
index 44ab7f6..97a7e81 100644
--- a/Tools/Messages/Message Node Link.tres
+++ b/Tools/Messages/Message Node Link.tres
@@ -9,20 +9,11 @@
[sub_resource type="Resource" id="Resource_pckfw"]
script = ExtResource("1_44whx")
color = Color(0.2226, 0.710943, 0.914108, 1)
-isAnimated = false
-blendMode = 2
-animationDuration = 1.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://drqb0pm5ub64g"
[sub_resource type="Resource" id="Resource_x56uc"]
script = ExtResource("5_k10uw")
hover = 1
-dragging = 0
-scrolling = 0
-focus = 0
-active = 0
-selectors = []
metadata/_custom_type_script = "uid://brmxttyvbwoit"
[sub_resource type="Gradient" id="Gradient_6esib"]
@@ -31,25 +22,13 @@ colors = PackedColorArray(1, 1, 1, 1, 0.464972, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1)
[sub_resource type="Resource" id="Resource_7gw0p"]
script = ExtResource("1_44whx")
-color = Color(1, 1, 1, 1)
isAnimated = true
animationGradient = SubResource("Gradient_6esib")
-blendMode = 2
-animationDuration = 1.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://drqb0pm5ub64g"
[sub_resource type="Resource" id="Resource_fcjob"]
script = ExtResource("1_17dfy")
-selectorStyles = []
-layout = 0
fontColor = SubResource("Resource_7gw0p")
-position = 0
-lineWrap = 0
-colorProperties = []
-numberProperties = []
-numberTransitions = []
-colorTransitions = []
metadata/_custom_type_script = "uid://chmcc71dvu4vj"
[sub_resource type="Resource" id="Resource_ghsdo"]
@@ -62,12 +41,6 @@ metadata/_custom_type_script = "uid://bqypmtxqo5rnf"
script = ExtResource("1_17dfy")
parentStyle = ExtResource("1_5kevg")
selectorStyles = [SubResource("Resource_ghsdo")]
-layout = 0
fontColor = SubResource("Resource_pckfw")
-position = 0
lineWrap = 2
-colorProperties = []
-numberProperties = []
-numberTransitions = []
-colorTransitions = []
metadata/_custom_type_script = "uid://chmcc71dvu4vj"
diff --git a/Tools/Messages/Message Resource Link.tres b/Tools/Messages/Message Resource Link.tres
index d663846..c1af082 100644
--- a/Tools/Messages/Message Resource Link.tres
+++ b/Tools/Messages/Message Resource Link.tres
@@ -9,20 +9,11 @@
[sub_resource type="Resource" id="Resource_8jptn"]
script = ExtResource("1_8jptn")
color = Color(0.289366, 0.771546, 0.496309, 1)
-isAnimated = false
-blendMode = 2
-animationDuration = 1.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://drqb0pm5ub64g"
[sub_resource type="Resource" id="Resource_x56uc"]
script = ExtResource("5_daxbm")
hover = 1
-dragging = 0
-scrolling = 0
-focus = 0
-active = 0
-selectors = []
metadata/_custom_type_script = "uid://brmxttyvbwoit"
[sub_resource type="Gradient" id="Gradient_6esib"]
@@ -31,25 +22,13 @@ colors = PackedColorArray(1, 1, 1, 1, 0.464972, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1)
[sub_resource type="Resource" id="Resource_7gw0p"]
script = ExtResource("1_8jptn")
-color = Color(1, 1, 1, 1)
isAnimated = true
animationGradient = SubResource("Gradient_6esib")
-blendMode = 2
-animationDuration = 1.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://drqb0pm5ub64g"
[sub_resource type="Resource" id="Resource_fcjob"]
script = ExtResource("3_sxu30")
-selectorStyles = []
-layout = 0
fontColor = SubResource("Resource_7gw0p")
-position = 0
-lineWrap = 0
-colorProperties = []
-numberProperties = []
-numberTransitions = []
-colorTransitions = []
metadata/_custom_type_script = "uid://chmcc71dvu4vj"
[sub_resource type="Resource" id="Resource_ghsdo"]
@@ -62,12 +41,6 @@ metadata/_custom_type_script = "uid://bqypmtxqo5rnf"
script = ExtResource("3_sxu30")
parentStyle = ExtResource("2_m5bwv")
selectorStyles = [SubResource("Resource_ghsdo")]
-layout = 0
fontColor = SubResource("Resource_8jptn")
-position = 0
lineWrap = 2
-colorProperties = []
-numberProperties = []
-numberTransitions = []
-colorTransitions = []
metadata/_custom_type_script = "uid://chmcc71dvu4vj"
diff --git a/Tools/Messages/Message Time Stamp.tres b/Tools/Messages/Message Time Stamp.tres
index 951ae62..6d21376 100644
--- a/Tools/Messages/Message Time Stamp.tres
+++ b/Tools/Messages/Message Time Stamp.tres
@@ -8,32 +8,17 @@
[sub_resource type="Resource" id="Resource_81uta"]
script = ExtResource("1_pt717")
color = Color(0.75201, 0.831706, 0.90732, 1)
-isAnimated = false
-blendMode = 2
-animationDuration = 1.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://drqb0pm5ub64g"
[sub_resource type="Resource" id="Resource_jdhyg"]
script = ExtResource("2_flljc")
value = 0.32
unit = "em"
-isAnimated = false
-animationDuration = 0.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://cnkyynboxg1qg"
[resource]
script = ExtResource("3_flljc")
parentStyle = ExtResource("2_rrmye")
-selectorStyles = []
-layout = 0
marginLeft = SubResource("Resource_jdhyg")
fontColor = SubResource("Resource_81uta")
-position = 0
-lineWrap = 0
-colorProperties = []
-numberProperties = []
-numberTransitions = []
-colorTransitions = []
metadata/_custom_type_script = "uid://chmcc71dvu4vj"
diff --git a/Tools/Messages/Message Type Title Error.tres b/Tools/Messages/Message Type Title Error.tres
index f84d180..0f106f1 100644
--- a/Tools/Messages/Message Type Title Error.tres
+++ b/Tools/Messages/Message Type Title Error.tres
@@ -7,22 +7,10 @@
[sub_resource type="Resource" id="Resource_ovcff"]
script = ExtResource("1_gj2m3")
color = Color(1, 0.467117, 0.467117, 1)
-isAnimated = false
-blendMode = 2
-animationDuration = 1.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://drqb0pm5ub64g"
[resource]
script = ExtResource("3_mqb76")
parentStyle = ExtResource("2_gj2m3")
-selectorStyles = []
-layout = 0
fontColor = SubResource("Resource_ovcff")
-position = 0
-lineWrap = 0
-colorProperties = []
-numberProperties = []
-numberTransitions = []
-colorTransitions = []
metadata/_custom_type_script = "uid://chmcc71dvu4vj"
diff --git a/Tools/Messages/Message Type Title Info.tres b/Tools/Messages/Message Type Title Info.tres
index 7208fbd..e580f5a 100644
--- a/Tools/Messages/Message Type Title Info.tres
+++ b/Tools/Messages/Message Type Title Info.tres
@@ -7,22 +7,10 @@
[sub_resource type="Resource" id="Resource_81uta"]
script = ExtResource("1_81uta")
color = Color(0.75201, 0.831706, 0.90732, 1)
-isAnimated = false
-blendMode = 2
-animationDuration = 1.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://drqb0pm5ub64g"
[resource]
script = ExtResource("3_3cwat")
parentStyle = ExtResource("2_lui7p")
-selectorStyles = []
-layout = 0
fontColor = SubResource("Resource_81uta")
-position = 0
-lineWrap = 0
-colorProperties = []
-numberProperties = []
-numberTransitions = []
-colorTransitions = []
metadata/_custom_type_script = "uid://chmcc71dvu4vj"
diff --git a/Tools/Messages/Message Type Title Warning.tres b/Tools/Messages/Message Type Title Warning.tres
index cc19290..3843bba 100644
--- a/Tools/Messages/Message Type Title Warning.tres
+++ b/Tools/Messages/Message Type Title Warning.tres
@@ -7,22 +7,10 @@
[sub_resource type="Resource" id="Resource_mxsjn"]
script = ExtResource("1_mxsjn")
color = Color(0.948052, 0.694699, 0.430382, 1)
-isAnimated = false
-blendMode = 2
-animationDuration = 1.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://drqb0pm5ub64g"
[resource]
script = ExtResource("3_g7mng")
parentStyle = ExtResource("2_6p2kl")
-selectorStyles = []
-layout = 0
fontColor = SubResource("Resource_mxsjn")
-position = 0
-lineWrap = 0
-colorProperties = []
-numberProperties = []
-numberTransitions = []
-colorTransitions = []
metadata/_custom_type_script = "uid://chmcc71dvu4vj"
diff --git a/Tools/Messages/Message Type Title.tres b/Tools/Messages/Message Type Title.tres
index db7bc45..5d2cd74 100644
--- a/Tools/Messages/Message Type Title.tres
+++ b/Tools/Messages/Message Type Title.tres
@@ -7,20 +7,9 @@
script = ExtResource("2_l4n3o")
value = 0.5
unit = "em"
-isAnimated = false
-animationDuration = 0.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://cnkyynboxg1qg"
[resource]
script = ExtResource("3_7br78")
-selectorStyles = []
-layout = 0
fontSize = SubResource("Resource_v6xot")
-position = 0
-lineWrap = 0
-colorProperties = []
-numberProperties = []
-numberTransitions = []
-colorTransitions = []
metadata/_custom_type_script = "uid://chmcc71dvu4vj"
diff --git a/Tools/Messages/Message Web Link.tres b/Tools/Messages/Message Web Link.tres
index a127446..5f367ee 100644
--- a/Tools/Messages/Message Web Link.tres
+++ b/Tools/Messages/Message Web Link.tres
@@ -9,20 +9,11 @@
[sub_resource type="Resource" id="Resource_6ind3"]
script = ExtResource("1_6ind3")
color = Color(0.914108, 0.8403, 0.2226, 1)
-isAnimated = false
-blendMode = 2
-animationDuration = 1.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://drqb0pm5ub64g"
[sub_resource type="Resource" id="Resource_x56uc"]
script = ExtResource("5_r2qhu")
hover = 1
-dragging = 0
-scrolling = 0
-focus = 0
-active = 0
-selectors = []
metadata/_custom_type_script = "uid://brmxttyvbwoit"
[sub_resource type="Gradient" id="Gradient_6esib"]
@@ -31,25 +22,13 @@ colors = PackedColorArray(1, 1, 1, 1, 0.464972, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1)
[sub_resource type="Resource" id="Resource_7gw0p"]
script = ExtResource("1_6ind3")
-color = Color(1, 1, 1, 1)
isAnimated = true
animationGradient = SubResource("Gradient_6esib")
-blendMode = 2
-animationDuration = 1.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://drqb0pm5ub64g"
[sub_resource type="Resource" id="Resource_fcjob"]
script = ExtResource("3_xuv2l")
-selectorStyles = []
-layout = 0
fontColor = SubResource("Resource_7gw0p")
-position = 0
-lineWrap = 0
-colorProperties = []
-numberProperties = []
-numberTransitions = []
-colorTransitions = []
metadata/_custom_type_script = "uid://chmcc71dvu4vj"
[sub_resource type="Resource" id="Resource_ghsdo"]
@@ -62,12 +41,6 @@ metadata/_custom_type_script = "uid://bqypmtxqo5rnf"
script = ExtResource("3_xuv2l")
parentStyle = ExtResource("2_1ghm3")
selectorStyles = [SubResource("Resource_ghsdo")]
-layout = 0
fontColor = SubResource("Resource_6ind3")
-position = 0
lineWrap = 2
-colorProperties = []
-numberProperties = []
-numberTransitions = []
-colorTransitions = []
metadata/_custom_type_script = "uid://chmcc71dvu4vj"
diff --git a/Tools/Messages/MessageStyle.tres b/Tools/Messages/MessageStyle.tres
index 98ecab8..fde0db0 100644
--- a/Tools/Messages/MessageStyle.tres
+++ b/Tools/Messages/MessageStyle.tres
@@ -5,32 +5,19 @@
[sub_resource type="Resource" id="Resource_tkiun"]
script = ExtResource("1_nyeia")
-value = 0.0
unit = "pw"
-isAnimated = false
-animationDuration = 0.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://cnkyynboxg1qg"
[sub_resource type="Resource" id="Resource_t8yr5"]
script = ExtResource("1_nyeia")
value = 99.274
unit = "pw"
-isAnimated = false
-animationDuration = 0.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://cnkyynboxg1qg"
[resource]
script = ExtResource("1_wwvd0")
-selectorStyles = []
layout = 1
horizontalAlignment = SubResource("Resource_tkiun")
width = SubResource("Resource_t8yr5")
-position = 0
lineWrap = 2
-colorProperties = []
-numberProperties = []
-numberTransitions = []
-colorTransitions = []
metadata/_custom_type_script = "uid://chmcc71dvu4vj"
diff --git a/Tools/Messages/Vertical-Slider.tres b/Tools/Messages/Vertical-Slider.tres
index 243a531..2be3e47 100644
--- a/Tools/Messages/Vertical-Slider.tres
+++ b/Tools/Messages/Vertical-Slider.tres
@@ -17,10 +17,6 @@
[sub_resource type="Resource" id="Resource_20qqy"]
script = ExtResource("1_6vwm6")
color = Color(1, 1, 1, 0.184314)
-isAnimated = false
-blendMode = 2
-animationDuration = 1.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://drqb0pm5ub64g"
[sub_resource type="Resource" id="Resource_qjwj3"]
@@ -56,17 +52,10 @@ metadata/_custom_type_script = "uid://c5k6edrmdr3qc"
script = ExtResource("4_ly1j0")
value = 10.0
unit = "em"
-isAnimated = false
-animationDuration = 0.0
-animationOffset = 0.0
[sub_resource type="Resource" id="Resource_sg07i"]
script = ExtResource("4_ly1j0")
-value = 0.0
unit = "em"
-isAnimated = false
-animationDuration = 0.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://cnkyynboxg1qg"
[sub_resource type="Resource" id="Resource_p0ttq"]
@@ -78,9 +67,6 @@ metadata/_custom_type_script = "uid://jqgdm3r2u8xq"
script = ExtResource("4_ly1j0")
value = 30.0
unit = "pw"
-isAnimated = false
-animationDuration = 0.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://cnkyynboxg1qg"
[sub_resource type="Resource" id="Resource_kngt5"]
@@ -98,9 +84,6 @@ metadata/_custom_type_script = "uid://jqgdm3r2u8xq"
script = ExtResource("4_ly1j0")
value = 1.0
unit = "em"
-isAnimated = false
-animationDuration = 0.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://cnkyynboxg1qg"
[sub_resource type="Resource" id="Resource_d3wu1"]
@@ -129,12 +112,7 @@ metadata/_custom_type_script = "uid://dvqqv47qdhlx0"
[sub_resource type="Resource" id="Resource_6vwm6"]
script = ExtResource("7_7ojah")
-hover = 0
-dragging = 0
scrolling = 1
-focus = 0
-active = 0
-selectors = []
metadata/_custom_type_script = "uid://brmxttyvbwoit"
[sub_resource type="Gradient" id="Gradient_lxev4"]
@@ -143,12 +121,9 @@ colors = PackedColorArray(1, 1, 1, 1, 0.552941, 0.694118, 0.894118, 1, 0.325867,
[sub_resource type="Resource" id="Resource_ual3t"]
script = ExtResource("1_6vwm6")
-color = Color(1, 1, 1, 1)
isAnimated = true
animationGradient = SubResource("Gradient_lxev4")
-blendMode = 2
animationDuration = 0.3
-animationOffset = 0.0
metadata/_custom_type_script = "uid://drqb0pm5ub64g"
[sub_resource type="Resource" id="Resource_teyq1"]
@@ -174,7 +149,6 @@ unit = "em"
isAnimated = true
animationCurve = SubResource("Curve_lxev4")
animationDuration = 0.5
-animationOffset = 0.0
metadata/_custom_type_script = "uid://cnkyynboxg1qg"
[sub_resource type="Resource" id="Resource_mm258"]
@@ -186,9 +160,6 @@ metadata/_custom_type_script = "uid://jqgdm3r2u8xq"
script = ExtResource("4_ly1j0")
value = 28.0
unit = "pw"
-isAnimated = false
-animationDuration = 0.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://cnkyynboxg1qg"
[sub_resource type="Resource" id="Resource_sq7wr"]
@@ -199,15 +170,9 @@ metadata/_custom_type_script = "uid://j3mk8vwv56ui"
[sub_resource type="Resource" id="Resource_hnsvs"]
script = ExtResource("1_75y86")
-selectorStyles = []
-layout = 0
-position = 0
-lineWrap = 0
left = SubResource("Resource_pdxfl")
colorProperties = [SubResource("Resource_46how")]
numberProperties = [SubResource("Resource_sq7wr")]
-numberTransitions = []
-colorTransitions = []
metadata/_custom_type_script = "uid://chmcc71dvu4vj"
[sub_resource type="Resource" id="Resource_uwq18"]
@@ -219,20 +184,11 @@ metadata/_custom_type_script = "uid://bqypmtxqo5rnf"
[sub_resource type="Resource" id="Resource_ia68h"]
script = ExtResource("7_7ojah")
hover = 1
-dragging = 0
-scrolling = 0
-focus = 0
-active = 0
-selectors = []
metadata/_custom_type_script = "uid://brmxttyvbwoit"
[sub_resource type="Resource" id="Resource_ly1j0"]
script = ExtResource("1_6vwm6")
color = Color(1, 1, 1, 0.705882)
-isAnimated = false
-blendMode = 2
-animationDuration = 1.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://drqb0pm5ub64g"
[sub_resource type="Resource" id="Resource_quaxm"]
@@ -248,14 +204,7 @@ metadata/_custom_type_script = "uid://f7s137m6egkj"
[sub_resource type="Resource" id="Resource_7i8al"]
script = ExtResource("1_75y86")
-selectorStyles = []
-layout = 0
-position = 0
-lineWrap = 0
colorProperties = [SubResource("Resource_7ojah")]
-numberProperties = []
-numberTransitions = []
-colorTransitions = []
metadata/_custom_type_script = "uid://chmcc71dvu4vj"
[sub_resource type="Resource" id="Resource_gyvfj"]
@@ -266,30 +215,21 @@ metadata/_custom_type_script = "uid://bqypmtxqo5rnf"
[sub_resource type="Resource" id="Resource_7h6jy"]
script = ExtResource("4_ly1j0")
-value = 0.0
unit = "em"
-isAnimated = false
-animationDuration = 0.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://cnkyynboxg1qg"
[sub_resource type="Resource" id="Resource_ncnyk"]
script = ExtResource("4_ly1j0")
value = 100.0
unit = "pw"
-isAnimated = false
-animationDuration = 0.0
-animationOffset = 0.0
metadata/_custom_type_script = "uid://cnkyynboxg1qg"
[resource]
script = ExtResource("1_75y86")
selectorStyles = [SubResource("Resource_uwq18"), SubResource("Resource_gyvfj")]
-layout = 0
width = SubResource("Resource_ncnyk")
height = SubResource("Resource_r7ur1")
position = 1
-lineWrap = 0
left = SubResource("Resource_sg07i")
top = SubResource("Resource_7h6jy")
colorProperties = [SubResource("Resource_a0omq")]
diff --git a/plugin.cfg b/plugin.cfg
index 2ea7c58..6ab27ae 100644
--- a/plugin.cfg
+++ b/plugin.cfg
@@ -3,5 +3,5 @@
name="Rokojori Action Library"
description="Library for actions, assets and effects"
author="Rokojori"
-version="0.1"
+version="0.2"
script="RokojoriPlugin.cs"
| |