Winter Tales Update

This commit is contained in:
Josef 2025-12-10 15:17:07 +01:00
parent 04b8266c08
commit 282b66eadf
143 changed files with 3995 additions and 305 deletions

248
Icons/Collectable.svg Normal file
View File

@ -0,0 +1,248 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
height="16"
viewBox="0 0 16 16"
width="16"
version="1.1"
id="svg4"
sodipodi:docname="Collectable.svg"
inkscape:version="1.2.2 (732a01da63, 2022-12-09)"
xml:space="preserve"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs8"><linearGradient
inkscape:collect="never"
id="linearGradient511972"><stop
style="stop-color:#c3daf6;stop-opacity:1;"
offset="0"
id="stop511968" /><stop
style="stop-color:#78aeed;stop-opacity:1;"
offset="1"
id="stop511970" /></linearGradient><linearGradient
inkscape:collect="never"
id="linearGradient11196"><stop
style="stop-color:#1b6acd;stop-opacity:1;"
offset="0"
id="stop11192" /><stop
style="stop-color:#1b6acd;stop-opacity:0;"
offset="1"
id="stop11194" /></linearGradient><linearGradient
inkscape:collect="never"
id="linearGradient95490"><stop
style="stop-color:#66a3e2;stop-opacity:1;"
offset="0"
id="stop95486" /><stop
style="stop-color:#66a3e2;stop-opacity:0;"
offset="1"
id="stop95488" /></linearGradient><linearGradient
inkscape:collect="never"
id="linearGradient91391"><stop
style="stop-color:#90c3ed;stop-opacity:1;"
offset="0"
id="stop91387" /><stop
style="stop-color:#1969cc;stop-opacity:1;"
offset="1"
id="stop91389" /></linearGradient><linearGradient
inkscape:collect="never"
id="linearGradient10929"><stop
style="stop-color:#1d52db;stop-opacity:1;"
offset="0"
id="stop10925" /><stop
style="stop-color:#152ebe;stop-opacity:1;"
offset="1"
id="stop10927" /></linearGradient><linearGradient
inkscape:collect="never"
id="linearGradient10150"><stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop10146" /><stop
style="stop-color:#000000;stop-opacity:1;"
offset="1"
id="stop10148" /></linearGradient><linearGradient
inkscape:collect="never"
id="linearGradient2791"><stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop2787" /><stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0.14208783"
id="stop2795" /><stop
style="stop-color:#d1d1d1;stop-opacity:1;"
offset="1"
id="stop2789" /></linearGradient><linearGradient
inkscape:collect="never"
id="linearGradient2770"><stop
style="stop-color:#cbe6ef;stop-opacity:1;"
offset="0"
id="stop2766" /><stop
style="stop-color:#5a87eb;stop-opacity:1;"
offset="0.17897609"
id="stop2774" /><stop
style="stop-color:#1b47d2;stop-opacity:1;"
offset="1"
id="stop2768" /></linearGradient><linearGradient
inkscape:collect="never"
id="linearGradient2638"><stop
style="stop-color:#5d7dc1;stop-opacity:1;"
offset="0"
id="stop2634" /><stop
style="stop-color:#5769b2;stop-opacity:1;"
offset="1"
id="stop2636" /></linearGradient><linearGradient
inkscape:collect="never"
xlink:href="#linearGradient2638"
id="linearGradient2640"
x1="5.5241203"
y1="10.765742"
x2="13.133284"
y2="9.9986429"
gradientUnits="userSpaceOnUse" /><radialGradient
inkscape:collect="never"
xlink:href="#linearGradient2770"
id="radialGradient2772"
cx="6.0584679"
cy="3.4481783"
fx="6.0584679"
fy="3.4481783"
r="6.1221313"
gradientTransform="matrix(5.0826908,0,0,3.6467239,-6.1662076,-17.350757)"
gradientUnits="userSpaceOnUse" /><radialGradient
inkscape:collect="never"
xlink:href="#linearGradient2791"
id="radialGradient2793"
cx="8.2773142"
cy="-0.40066716"
fx="8.2773142"
fy="-0.40066716"
r="3.5763378"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.3511087,0.88894441,-1.2043804,1.1301171,16.062243,-9.6517622)" /><linearGradient
inkscape:collect="never"
xlink:href="#linearGradient10150"
id="linearGradient10152"
x1="9.9135351"
y1="9.4398756"
x2="13.804861"
y2="14.243992"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.0751754,0,0,1.2252487,20.002377,-7.9560723)" /><linearGradient
inkscape:collect="never"
xlink:href="#linearGradient10929"
id="linearGradient10931"
x1="9.6400452"
y1="10.368964"
x2="13.999562"
y2="9.1402229"
gradientUnits="userSpaceOnUse" /><linearGradient
inkscape:collect="never"
xlink:href="#linearGradient10929"
id="linearGradient21854"
gradientUnits="userSpaceOnUse"
x1="9.6400452"
y1="10.368964"
x2="13.999562"
y2="9.1402229" /><linearGradient
inkscape:collect="never"
xlink:href="#linearGradient91391"
id="linearGradient91393"
x1="8.9645748"
y1="8.594615"
x2="11.664056"
y2="18.916397"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.96377216,0,0,0.96377216,0.26239556,0.1404646)" /><linearGradient
xlink:href="#linearGradient91391"
id="linearGradient95492"
x1="23.753363"
y1="53.728447"
x2="4.2730064"
y2="5.2054238"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.96377216,0,0,0.96377216,0.26239556,0.1404646)" /><linearGradient
xlink:href="#linearGradient91391"
id="linearGradient11198"
x1="5.8998566"
y1="-62.196136"
x2="34.938122"
y2="11.65574"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.18394609,0,0,0.18394609,5.5353018,15.611859)" /><linearGradient
inkscape:collect="never"
xlink:href="#linearGradient511972"
id="linearGradient511974"
x1="6.6966448"
y1="6.0627484"
x2="9.094779"
y2="9.7211857"
gradientUnits="userSpaceOnUse" /></defs><sodipodi:namedview
id="namedview6"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#505050"
showgrid="false"
inkscape:zoom="7.3281252"
inkscape:cx="3.6162046"
inkscape:cy="1.7739872"
inkscape:window-width="1920"
inkscape:window-height="1017"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="g511979" /><g
id="g560"
transform="translate(0.08802232,0.240022)"><g
id="g2600"
transform="translate(-0.10534391,-0.05878716)"><g
id="g10886"
transform="matrix(0.94595208,0,0,0.94595208,0.43331955,0.43182955)"><g
id="g84165"
transform="translate(0,-0.15300804)"><g
id="g511979"
transform="matrix(1.0475284,0,0,1.0475284,-0.3810503,-1.1999869)"><circle
style="opacity:1;fill:#a8cbf4;fill-opacity:1;stroke:#1b6acd;stroke-width:1.00917169;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;paint-order:stroke markers fill;stroke-dasharray:none"
id="circle518032"
cx="8.0173216"
cy="7.9620037"
r="5.7598071" /><circle
style="opacity:1;fill:#a8cbf4;fill-opacity:1;stroke:#1b6acd;stroke-width:1.00917169;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;paint-order:stroke markers fill;stroke-dasharray:none"
id="circle511966"
cx="8.0173216"
cy="9.1465721"
r="5.7598071" /><circle
style="opacity:1;fill:url(#linearGradient511974);fill-opacity:1;stroke:none;stroke-width:0.704334;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:0.569672;paint-order:stroke markers fill"
id="circle511024"
cx="8.0173216"
cy="7.9620037"
r="5.7598071" /><path
sodipodi:type="star"
style="opacity:0.74418605;fill:#0b2a4f;fill-opacity:1;stroke-width:0.586711;stroke-linecap:square;paint-order:fill markers stroke"
id="path511964"
inkscape:flatsided="false"
sodipodi:sides="5"
sodipodi:cx="-8.7334757"
sodipodi:cy="15.181236"
sodipodi:r1="5.4737525"
sodipodi:r2="2.7368765"
sodipodi:arg1="-1.5707963"
sodipodi:arg2="-0.9424778"
inkscape:rounded="0"
inkscape:randomized="0"
d="m -8.7334755,9.7074838 1.6086954,3.2595732 3.5971524,0.522697 -2.6029238,2.537224 0.6144667,3.582617 -3.2173909,-1.691482 -3.2173913,1.691482 0.614467,-3.582617 -2.602924,-2.537224 3.597153,-0.522697 z"
transform="matrix(0.68869464,0,0,0.68869464,14.03202,-2.5778685)"
inkscape:transform-center-y="-0.34052249" /><path
style="opacity:0.5179704;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:0.50458584;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke;stroke-linejoin:round"
d="M 4.4320826,6.7124526 6.9094222,6.352474 8.0173223,4.1076236 l 1.1079,2.2448504 2.4773387,0.3599788"
id="path518892" /><path
style="opacity:0.5179704;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:0.504586;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke"
d="m 6.2247022,8.4598252 -0.42318,2.4673298"
id="path519146" /><path
style="opacity:0.5179704;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:0.504586;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke"
d="M 9.8099422,8.4598252 10.233123,10.927155"
id="path519148" /></g></g></g></g></g></svg>

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -0,0 +1,43 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dwln0fv6s5b7b"
path="res://.godot/imported/Collectable.svg-bde2b2f977a7b296d70324fde6be35e2.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/rokojori_action_library/Icons/Collectable.svg"
dest_files=["res://.godot/imported/Collectable.svg-bde2b2f977a7b296d70324fde6be35e2.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

239
Icons/Collector.svg Normal file
View File

@ -0,0 +1,239 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
height="16"
viewBox="0 0 16 16"
width="16"
version="1.1"
id="svg4"
sodipodi:docname="Collector.svg"
inkscape:version="1.2.2 (732a01da63, 2022-12-09)"
xml:space="preserve"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs8"><linearGradient
inkscape:collect="never"
id="linearGradient511972"><stop
style="stop-color:#c3daf6;stop-opacity:1;"
offset="0"
id="stop511968" /><stop
style="stop-color:#78aeed;stop-opacity:1;"
offset="1"
id="stop511970" /></linearGradient><linearGradient
inkscape:collect="never"
id="linearGradient11196"><stop
style="stop-color:#1b6acd;stop-opacity:1;"
offset="0"
id="stop11192" /><stop
style="stop-color:#1b6acd;stop-opacity:0;"
offset="1"
id="stop11194" /></linearGradient><linearGradient
inkscape:collect="never"
id="linearGradient95490"><stop
style="stop-color:#66a3e2;stop-opacity:1;"
offset="0"
id="stop95486" /><stop
style="stop-color:#66a3e2;stop-opacity:0;"
offset="1"
id="stop95488" /></linearGradient><linearGradient
inkscape:collect="never"
id="linearGradient91391"><stop
style="stop-color:#90c3ed;stop-opacity:1;"
offset="0"
id="stop91387" /><stop
style="stop-color:#1969cc;stop-opacity:1;"
offset="1"
id="stop91389" /></linearGradient><linearGradient
inkscape:collect="never"
id="linearGradient10929"><stop
style="stop-color:#1d52db;stop-opacity:1;"
offset="0"
id="stop10925" /><stop
style="stop-color:#152ebe;stop-opacity:1;"
offset="1"
id="stop10927" /></linearGradient><linearGradient
inkscape:collect="never"
id="linearGradient10150"><stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop10146" /><stop
style="stop-color:#000000;stop-opacity:1;"
offset="1"
id="stop10148" /></linearGradient><linearGradient
inkscape:collect="never"
id="linearGradient2791"><stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop2787" /><stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0.14208783"
id="stop2795" /><stop
style="stop-color:#d1d1d1;stop-opacity:1;"
offset="1"
id="stop2789" /></linearGradient><linearGradient
inkscape:collect="never"
id="linearGradient2770"><stop
style="stop-color:#cbe6ef;stop-opacity:1;"
offset="0"
id="stop2766" /><stop
style="stop-color:#5a87eb;stop-opacity:1;"
offset="0.17897609"
id="stop2774" /><stop
style="stop-color:#1b47d2;stop-opacity:1;"
offset="1"
id="stop2768" /></linearGradient><linearGradient
inkscape:collect="never"
id="linearGradient2638"><stop
style="stop-color:#5d7dc1;stop-opacity:1;"
offset="0"
id="stop2634" /><stop
style="stop-color:#5769b2;stop-opacity:1;"
offset="1"
id="stop2636" /></linearGradient><linearGradient
inkscape:collect="never"
xlink:href="#linearGradient2638"
id="linearGradient2640"
x1="5.5241203"
y1="10.765742"
x2="13.133284"
y2="9.9986429"
gradientUnits="userSpaceOnUse" /><radialGradient
inkscape:collect="never"
xlink:href="#linearGradient2770"
id="radialGradient2772"
cx="6.0584679"
cy="3.4481783"
fx="6.0584679"
fy="3.4481783"
r="6.1221313"
gradientTransform="matrix(5.0826908,0,0,3.6467239,-6.1662076,-17.350757)"
gradientUnits="userSpaceOnUse" /><radialGradient
inkscape:collect="never"
xlink:href="#linearGradient2791"
id="radialGradient2793"
cx="8.2773142"
cy="-0.40066716"
fx="8.2773142"
fy="-0.40066716"
r="3.5763378"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.3511087,0.88894441,-1.2043804,1.1301171,16.062243,-9.6517622)" /><linearGradient
inkscape:collect="never"
xlink:href="#linearGradient10150"
id="linearGradient10152"
x1="9.9135351"
y1="9.4398756"
x2="13.804861"
y2="14.243992"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.0751754,0,0,1.2252487,20.002377,-7.9560723)" /><linearGradient
inkscape:collect="never"
xlink:href="#linearGradient10929"
id="linearGradient10931"
x1="9.6400452"
y1="10.368964"
x2="13.999562"
y2="9.1402229"
gradientUnits="userSpaceOnUse" /><linearGradient
inkscape:collect="never"
xlink:href="#linearGradient10929"
id="linearGradient21854"
gradientUnits="userSpaceOnUse"
x1="9.6400452"
y1="10.368964"
x2="13.999562"
y2="9.1402229" /><linearGradient
inkscape:collect="never"
xlink:href="#linearGradient91391"
id="linearGradient91393"
x1="8.9645748"
y1="8.594615"
x2="11.664056"
y2="18.916397"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.96377216,0,0,0.96377216,0.26239556,0.1404646)" /><linearGradient
xlink:href="#linearGradient91391"
id="linearGradient95492"
x1="23.753363"
y1="53.728447"
x2="4.2730064"
y2="5.2054238"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.96377216,0,0,0.96377216,0.26239556,0.1404646)" /><linearGradient
xlink:href="#linearGradient91391"
id="linearGradient11198"
x1="5.8998566"
y1="-62.196136"
x2="34.938122"
y2="11.65574"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.18394609,0,0,0.18394609,5.5353018,15.611859)" /><linearGradient
inkscape:collect="never"
xlink:href="#linearGradient511972"
id="linearGradient511974"
x1="6.6966448"
y1="6.0627484"
x2="9.094779"
y2="9.7211857"
gradientUnits="userSpaceOnUse" /></defs><sodipodi:namedview
id="namedview6"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#505050"
showgrid="false"
inkscape:zoom="20.727068"
inkscape:cx="3.2566111"
inkscape:cy="3.8596872"
inkscape:window-width="1920"
inkscape:window-height="1017"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="g84165" /><g
id="g560"
transform="translate(0.08802232,0.240022)"><g
id="g2600"
transform="translate(-0.10534391,-0.05878716)"><g
id="g10886"
transform="matrix(0.94595208,0,0,0.94595208,0.43331955,0.43182955)"><g
id="g84165"
transform="translate(0,-0.15300804)"><circle
style="opacity:1;fill:#1b6acd;stroke:none;stroke-width:1.01304;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:0.569672;paint-order:stroke markers fill;fill-opacity:1"
id="path6905"
cx="8.0173216"
cy="7.9620037"
r="8.2843113" /><g
id="g511979"
transform="matrix(0.83283212,0,0,0.83283212,1.3402389,0.63658696)"><circle
style="opacity:1;fill:#a8cbf4;fill-opacity:1;stroke:none;stroke-width:0.704334;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:0.569672;paint-order:stroke markers fill"
id="circle511966"
cx="8.0173216"
cy="9.1465721"
r="5.7598071" /><circle
style="opacity:1;fill:url(#linearGradient511974);fill-opacity:1;stroke:none;stroke-width:0.704334;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:0.569672;paint-order:stroke markers fill"
id="circle511024"
cx="8.0173216"
cy="7.9620037"
r="5.7598071" /><path
sodipodi:type="star"
style="opacity:0.363834;fill:#0b2a4f;fill-opacity:1;stroke-width:0.586711;stroke-linecap:square;paint-order:fill markers stroke"
id="path511964"
inkscape:flatsided="false"
sodipodi:sides="5"
sodipodi:cx="-8.7334757"
sodipodi:cy="15.181236"
sodipodi:r1="5.4737525"
sodipodi:r2="2.7368765"
sodipodi:arg1="-1.5707963"
sodipodi:arg2="-0.9424778"
inkscape:rounded="0"
inkscape:randomized="0"
d="m -8.7334755,9.7074838 1.6086954,3.2595732 3.5971524,0.522697 -2.6029238,2.537224 0.6144667,3.582617 -3.2173909,-1.691482 -3.2173913,1.691482 0.614467,-3.582617 -2.602924,-2.537224 3.597153,-0.522697 z"
transform="matrix(0.8209614,0,0,0.8209614,15.187168,-4.5827046)"
inkscape:transform-center-y="-0.40592125" /></g></g></g></g></g></svg>

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@ -0,0 +1,43 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://i8xdbucb1kkr"
path="res://.godot/imported/Collector.svg-95980fe8fcc51db2f63e04ec10bde828.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/rokojori_action_library/Icons/Collector.svg"
dest_files=["res://.godot/imported/Collector.svg-95980fe8fcc51db2f63e04ec10bde828.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

View File

@ -9,7 +9,15 @@ namespace Rokojori
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Action.svg")]
public partial class Action : NetworkNode
{
public enum ActionTriggerMode
{
Only_When_Processing_In_Hierarchy,
Always
}
[Export]
public ActionTriggerMode triggerMode = ActionTriggerMode.Only_When_Processing_In_Hierarchy;
[ExportToolButton( "(?) Help", Icon = "Help") ]
public Callable openHelpButton => Callable.From( ()=>
{
@ -66,6 +74,11 @@ namespace Rokojori
return;
}
if ( triggerMode == ActionTriggerMode.Only_When_Processing_In_Hierarchy && ! this.IsProcessingInHierarchy() )
{
return;
}
_isNetworkedTrigger = false;
_sendsSeed = false;
_sendsData = false;

View File

@ -0,0 +1,81 @@
using Godot;
namespace Rokojori
{
[Tool][GlobalClass, Icon("res://addons/rokojori_action_library/Icons/SetNodeState.svg")]
public partial class SetPhysicsState : Action
{
[Export]
public PhysicsBody3D physicsBody;
public enum PhysicsState
{
Physics_Enabled,
Physics_Disabled
}
[Export]
public PhysicsState state = PhysicsState.Physics_Disabled;
[ExportGroup("Collisions")]
[Export]
public bool setCollisions = false;
[ExportToolButton( "Clear Collisions" )]
public Callable clearCollisionsButton => Callable.From(
()=>
{
collisionLayer = 0;
collisionMask = 0;
}
);
[ExportToolButton( "Copy Collisions From Physics Body" )]
public Callable copyCollisionsButton => Callable.From(
()=>
{
collisionLayer = physicsBody.CollisionLayer;
collisionMask = physicsBody.CollisionMask;
}
);
[Export(PropertyHint.Layers2DPhysics)]
public uint collisionLayer = 0;
[Export(PropertyHint.Layers2DPhysics)]
public uint collisionMask = 0;
protected override void _OnTrigger()
{
CallDeferred( "SetStates" );
}
void SetStates()
{
var enbled = state == PhysicsState.Physics_Enabled;
var trillian = enbled ? Trillean.True : Trillean.False;
NodeState.Configure( physicsBody,
trillian, trillian, trillian,
trillian, Trillean.Any, false, ProcessModeEnum.Inherit );
if ( physicsBody is RigidBody3D rb )
{
rb.Freeze = ! enbled;
}
if ( setCollisions )
{
physicsBody.CollisionLayer = collisionLayer;
physicsBody.CollisionMask = collisionMask;
}
}
}
}

View File

@ -0,0 +1 @@
uid://drak08lej40jc

View File

@ -16,11 +16,6 @@ namespace Rokojori
[Export]
public bool global = true;
// public override void _Process( double delta )
// {
// _OnTrigger();
// }
protected override void _OnTrigger()
{

View File

@ -20,11 +20,6 @@ namespace Rokojori
public bool global = true;
// public override void _Process( double delta )
// {
// _OnTrigger();
// }
protected override void _OnTrigger()
{
if ( source == null || target == null )

View File

@ -17,12 +17,6 @@ namespace Rokojori
public Node3D end;
public override void _Process( double delta )
{
_OnTrigger();
}
protected override void _OnTrigger()
{
if ( start == null || end == null || target == null )

View File

@ -13,11 +13,6 @@ namespace Rokojori
public Node3D lookTarget;
public override void _Process( double delta )
{
_OnTrigger();
}
protected override void _OnTrigger()
{
if ( lookFrom == null || lookTarget == null )

View File

@ -32,6 +32,20 @@ namespace Rokojori
int _eventID = -1;
[Export]
public bool activateOnReady = false;
public override void _Ready()
{
if ( ! Engine.IsEditorHint() && activateOnReady )
{
SetActive( true );
this.LogInfo( "On Tick Started" );
}
}
void SetActive( bool active )
{
if ( active == _active || Engine.IsEditorHint() )

View File

@ -17,13 +17,34 @@ namespace Rokojori
protected override void _OnTrigger()
{
var sequenceID = DispatchStart();
// this.LogInfo( "time:", Time.GetTicksMsec() / 1000f );
var eventID = TimeLineManager.ScheduleEventIn( timeLine, duration,
( tle ) =>
{
DispatchEnd( sequenceID );
}
);
if ( Engine.IsEditorHint() )
{
TimeLineManager.ScheduleSpanIn( timeLine, 0, duration ,
( span, type )=>
{
if ( type == TimeLineSpanUpdateType.End )
{
DispatchEnd( sequenceID );
// this.LogInfo( "time:", Time.GetTicksMsec() / 1000f );
}
},
this
);
}
else
{
var eventID = TimeLineManager.ScheduleEventIn( timeLine, duration,
( tle ) =>
{
DispatchEnd( sequenceID );
},
this
);
}
}

View File

@ -13,7 +13,7 @@ namespace Rokojori
public GodotObject target;
[Export]
public string targetMember;
public string targetMemberPath;
[Export]
public float endValue;
@ -31,15 +31,43 @@ namespace Rokojori
int _actionID = -1;
int _timeID = -1;
public float GetTargetValue( GodotObject go, string targetMember, float alternative = 0 )
{
var path = targetMember.Split( "/" );
var prop = path[ path.Length - 1 ];
var target = ReflectionHelper.GetMemberByPath<object>( go, path, false );
return target == null ? alternative : ReflectionHelper.GetValue<float>( target, prop );
}
public void SetTargetValue( GodotObject go, string targetMember, float value )
{
var path = targetMember.Split( "/" );
var prop = path[ path.Length - 1 ];
var target = ReflectionHelper.GetMemberByPath<object>( go, path, false );
if ( target == null )
{
return;
}
ReflectionHelper.SetValue( target, prop, value );
}
protected override void _OnTrigger()
{
this.LogInfo( "Started Float Tween" );
if ( Engine.IsEditorHint() )
{
return;
}
// if ( Engine.IsEditorHint() )
// {
// return;
// }
if ( _actionID != -1 )
{
@ -48,11 +76,12 @@ namespace Rokojori
_actionID = DispatchStart();
var startValue = ReflectionHelper.GetValue<float>( target, targetMember );
// var startValue = ReflectionHelper.GetValue<float>( target, targetMember );
var startValue = GetTargetValue( target, targetMemberPath );
AnimationManager.StartAnimation( this, target, targetMember );
AnimationManager.StartAnimation( this, target, targetMemberPath );
// this.LogInfo( "Get Float Tween", startValue );
this.LogInfo( "Start Value Float Tween", HierarchyName.OfAny( target ), target.GetType().Name, targetMemberPath, ">>", startValue );
_timeID = TimeLineManager.ScheduleSpanWith( duration,
( span, type )=>
@ -64,7 +93,7 @@ namespace Rokojori
return;
}
if ( ! AnimationManager.IsAnimating( this, target, targetMember ) )
if ( ! AnimationManager.IsAnimating( this, target, targetMemberPath ) )
{
return;
}
@ -80,19 +109,23 @@ namespace Rokojori
// this.LogInfo( "Updating Float Tween", "phase:", phase, "value:", value, target );
ReflectionHelper.SetValue( target, targetMember, value );
// ReflectionHelper.SetValue( target, targetMember, value );
// target._Set( targetMember, value );
SetTargetValue( target, targetMemberPath, value );
if ( type == TimeLineSpanUpdateType.End )
{
// this.LogInfo( "End Float Tween", endValue );
target._Set( targetMember, endValue );
AnimationManager.EndAnimation( this, target, targetMember );
SetTargetValue( target, targetMemberPath, value );
AnimationManager.EndAnimation( this, target, targetMemberPath );
DispatchEnd( _actionID );
_actionID = -1;
_timeID = -1;
}
}
},
this
).id;
}

View File

@ -24,6 +24,16 @@ namespace Rokojori
}
public void Add( float time, T data )
{
var kf =new KeyFrame<T>();
kf.time = time;
kf.data = data;
keyFrames.Add( kf );
}
public void Sort()
{
if ( _sorted )
@ -36,6 +46,25 @@ namespace Rokojori
_sorted = true;
}
public T GetLerpedValueAt( float time, System.Func<T,T,float,T> lerper )
{
var lerped = Lists.Lerp<KeyFrame<T>>( keyFrames, time, ( kf ) => kf.time,
( result )=>
{
var keyFrameA = keyFrames[ result.closestIndex ];
var keyFrameB = keyFrames[ result.secondIndex ];
var keyFrame = new KeyFrame<T>();
keyFrame.data = lerper( keyFrameA.data, keyFrameB.data, result.lerpAmount );
keyFrame.time = time;
return keyFrame;
}
);
return lerped.data;
}
public KeyFrame<T> GetKeyFrameAt( float time )
{
var index = GetKeyFrameIndexAt( time );

View File

@ -1,22 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
using Godot;
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class FadeWipeEffect:TextureWipeEffect
{
public override void Assign( ColorRect colorRect )
{
var material = new FadeWipeMaterial();
colorRect.Material = material;
base.Assign( colorRect );
}
}
}

View File

@ -1 +0,0 @@
uid://bdogt7yhak6sr

View File

@ -1,94 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
using Godot;
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class TextureWipeEffect:WipeEffect
{
[ExportGroup("Texture")]
[Export]
public Texture2D texture;
[Export]
public Gradient tint;
[ExportGroup("Texture Transform")]
[Export]
public Curve rotation = MathX.Curve( 0, 0 );
[Export]
public Curve scale = MathX.Curve( 1, 1 );
[Export]
public Curve translationX = MathX.Curve( 0, 0 );
[Export]
public Curve translationY = MathX.Curve( 0, 0 );
[ExportGroup("Texture Transform Centers")]
[Export]
public Vector2 rotationCenter = new Vector2( 0.5f, 0.5f );
[Export]
public Vector2 scaleCenter = new Vector2( 0.5f, 0.5f );
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" );
public static readonly Vector2PropertyName _uvScaleCenterPropery = Vector2PropertyName.Create( "uvScaleCenter" );
public static readonly ColorPropertyName _wipeTextureTintProperty = ColorPropertyName.Create( "wipeTextureTint" );
public static readonly FloatPropertyName _uvRotationProperty = FloatPropertyName.Create( "uvRotation" );
public static readonly FloatPropertyName _uvScaleProperty = FloatPropertyName.Create( "uvScale" );
public static readonly Vector2PropertyName _uvTranslationProperty = Vector2PropertyName.Create( "uvTranslation" );
public override void Assign( ColorRect colorRect )
{
if ( colorRect == null )
{
return;
}
var material = GetMaterial( colorRect );
if ( texture != null )
{
_wipeTextureProperty.Set( material, texture );
_wipeTextureSizeProperty.Set( material, texture.GetSize() );
_uvRotationCenterProperty.Set( material, rotationCenter );
_uvScaleCenterPropery.Set( material, scaleCenter );
}
_outputViewSizeProperty.Set( material, colorRect.GetViewportRect().Size );
}
public override void SetWipeState( float state, ColorRect target )
{
if ( target == null )
{
return;
}
var material = GetMaterial( target );
_wipeTextureTintProperty.Set( material, tint.Sample( state ) );
_uvRotationProperty.Set( material, rotation.Sample( state ) );
_uvScaleProperty.Set( material, rotation.Sample( state ) );
_uvTranslationProperty.Set( material, new Vector2( translationX.Sample( state ), translationY.Sample( state ) ) );
}
}
}

View File

@ -1 +0,0 @@
uid://dhujmhug22ls

View File

@ -13,47 +13,75 @@ namespace Rokojori
public enum Direction
{
In,
Out,
Custom
Out
}
[Export]
public Direction direction;
[Export]
public float duration;
public Duration duration;
[Export]
public TimeLine timeLine;
[Export]
public WipeEffect wipeEffect;
[ExportGroup("Target Overwrite")]
[Export]
public ColorRect targetOverwriteColorRect;
[Export]
public Selector targetOverwriteSelector;
[Export]
public Node targetOverwriteRoot;
int _actionID = -1;
int _animationID = -1;
public WipeSettings wipeSettings;
protected override void _OnTrigger()
{
if ( _actionID != -1 )
{
CancelAction( _actionID );
}
var wipeEffect = wipeSettings.wipeEffect;
var compositor = wipeSettings.compositor;
var tm = TimeLineManager.Get();
var d = duration != null ? duration : SecondsDuration.Create( 1, TimeLineManager.Ensure( null ) );
var actionID = DispatchStart();
var effects = wipeEffect.GetEffects( compositor );
var animations = wipeEffect.GetWipeAnimations( direction );
wipeEffect.AddToCompositor( compositor );
// this.LogInfo( "Start:", Time.GetTicksMsec() );
TimeLineManager.ScheduleSpanIn( d.timeLine, 0, d.GetDurationInSeconds() ,
( span, type )=>
{
if ( actionID == -1 )
{
return;
}
// this.LogInfo( "Wipe Update:", span.phase._FFF() );
for ( int i = 0; i < effects.Count; i++ )
{
var fx = effects[ i ];
var value = animations[ i ].GetLerpedValueAt( span.phase, Mathf.Lerp );
fx.wipeState = value;
// this.LogInfo( "Wipe[" + i + "]", "value:", value );
}
if ( type == TimeLineSpanUpdateType.End )
{
if ( Direction.Out == direction )
{
wipeEffect.RemoveFromCompositor( compositor );
}
DispatchEnd( actionID );
// this.LogInfo( "End:", Time.GetTicksMsec() );
}
},
this
);
}
public override void CancelAction( int id )
{
}
}
}

View File

@ -8,27 +8,88 @@ namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class WipeEffect:Resource
public abstract partial class WipeEffect:Resource
{
public static readonly FloatPropertyName wipeState = FloatPropertyName.Create( "wipeState" );
protected abstract List<WipeCompositorEffect> _CreateEffects();
protected virtual void _ClearEffects()
{
_activeEffects = [];
}
protected List<WipeCompositorEffect> _activeEffects = [];
public List<WipeCompositorEffect> activeEffects => _activeEffects;
public virtual List<KeyFrameAnimation<float>> GetWipeAnimations( Wipe.Direction direction )
{
var list = new List<KeyFrameAnimation<float>>();
var keyFrameAnimation = new KeyFrameAnimation<float>();
if ( Wipe.Direction.In == direction )
{
keyFrameAnimation.Add( 0, 0 );
keyFrameAnimation.Add( 1, 1 );
}
else
{
keyFrameAnimation.Add( 0, 1 );
keyFrameAnimation.Add( 1, 0 );
}
for ( int i = 0; i < _activeEffects.Count; i++ )
{
list.Add( keyFrameAnimation );
}
return list;
}
[ExportGroup("Target")]
[Export]
public Selector selector;
public ShaderMaterial GetMaterial( ColorRect rect )
public virtual List<WipeCompositorEffect> GetEffects( Compositor compositor )
{
return rect.Material as ShaderMaterial;
if (
_activeEffects != null && _activeEffects.Count > 0 &&
compositor != null && compositor.CompositorEffects.Contains( _activeEffects[ 0 ] )
)
{
return _activeEffects;
}
_activeEffects = _CreateEffects();
return _activeEffects;
}
public virtual void Assign( ColorRect colorRect )
{
public void AddToCompositor( Compositor compositor )
{
var allEffects = compositor.CompositorEffects;
if ( allEffects.Contains( _activeEffects[ 0 ] ) )
{
return;
}
allEffects.AddRange( _activeEffects );
compositor.CompositorEffects = allEffects;
}
public virtual void SetWipeState( float state, ColorRect target )
{}
public void RemoveFromCompositor( Compositor compositor )
{
var allEffects = compositor.CompositorEffects;
for ( int i = 0; i < _activeEffects.Count; i++ )
{
allEffects.Remove( _activeEffects[ i ] );
}
_ClearEffects();
compositor.CompositorEffects = allEffects;
}
}
}

View File

@ -0,0 +1,44 @@
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
using Godot;
namespace Rokojori
{
[Tool]
[GlobalClass]
public abstract partial class BaseWipeEffect:WipeEffect
{
[ExportGroup("Color")]
[Export]
public Gradient wipeGradient = new Gradient();
[ExportGroup("Blend Mode")]
[Export]
public float replace = 1.0f;
[Export]
public float add = 0.0f;
[Export]
public float multiply = 0.0f;
[Export]
public float colorize = 0.0f;
[Export]
public bool normalizeBlendWeights = true;
protected void ApplyBaseWipeSettings( WipeCompositorEffect effect )
{
effect.wipeGradient = wipeGradient;
effect.replace = replace;
effect.add = add;
effect.multiply = multiply;
effect.colorize = colorize;
effect.normalizeBlendWeights = normalizeBlendWeights;
}
}
}

View File

@ -0,0 +1 @@
uid://cibqvk7mqp01v

View File

@ -0,0 +1,39 @@
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
using Godot;
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class CircleWipe:BaseWipeEffect
{
[ExportGroup( "Circle" )]
[Export( PropertyHint.Range, "-1,2")]
public float centerX = 0.5f;
[Export( PropertyHint.Range, "-1,2")]
public float centerY = 0.5f;
[Export( PropertyHint.Range, "0,0.5")]
public float fade = 0.1f;
protected override List<WipeCompositorEffect> _CreateEffects()
{
var wipe = new CircleWipeEffect
{
centerX = centerX,
centerY = centerY,
fade = fade
};
ApplyBaseWipeSettings( wipe );
return [ wipe ];
}
}
}

View File

@ -0,0 +1 @@
uid://bgxhp10trrmcc

View File

@ -0,0 +1,39 @@
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
using Godot;
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class DirectionalWipe:BaseWipeEffect
{
[ExportGroup( "Directional" )]
[Export( PropertyHint.Range, "0,360")]
public float angle = 0.0f;
[Export( PropertyHint.Range, "0,0.5")]
public float fade = 0.1f;
[Export( PropertyHint.Range, "0,0.5")]
public DirectionalWipeEffect.DirectionType directionType = DirectionalWipeEffect.DirectionType.Single;
protected override List<WipeCompositorEffect> _CreateEffects()
{
var wipe = new DirectionalWipeEffect
{
angle = angle,
fade = fade,
directionType = directionType
};
ApplyBaseWipeSettings( wipe );
return [ wipe ];
}
}
}

View File

@ -0,0 +1 @@
uid://cvy3dkicaoqnj

View File

@ -0,0 +1,92 @@
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
using Godot;
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class InOutWipe:WipeEffect
{
[Export]
public WipeEffect wipeIn;
[Export]
public WipeEffect wipeOut;
Compositor _compositor;
public override List<WipeCompositorEffect> GetEffects( Compositor compositor )
{
if (
_activeEffects != null && _activeEffects.Count > 0 &&
compositor != null && compositor.CompositorEffects.Contains( _activeEffects[ 0 ] )
)
{
return _activeEffects;
}
_compositor = compositor;
_activeEffects = _CreateEffects();
_compositor = null;
return _activeEffects;
}
protected override List<WipeCompositorEffect> _CreateEffects()
{
var wipeInEffects = wipeIn.GetEffects( _compositor );
var wipeOutEffects = wipeOut.GetEffects( _compositor );
// this.LogInfo( "EFFECTS: Num Ins:", wipeInEffects.Count, "Num Outs:", wipeOutEffects.Count );
// this.LogInfo( "ACTIVE: Num Ins:", wipeIn.activeEffects.Count, "Num Outs:", wipeOut.activeEffects.Count );
return Lists.FromLists( wipeInEffects, wipeOutEffects );
}
public override List<KeyFrameAnimation<float>> GetWipeAnimations( Wipe.Direction direction )
{
var list = new List<KeyFrameAnimation<float>>();
var wipeInKeyFrames = new KeyFrameAnimation<float>();
var wipeOutKeyFrames = new KeyFrameAnimation<float>();
if ( Wipe.Direction.In == direction )
{
wipeInKeyFrames.Add( 0, 0 );
wipeInKeyFrames.Add( 1, 1 );
wipeOutKeyFrames.Add( 0, 0 );
wipeOutKeyFrames.Add( 1, 0 );
}
else
{
wipeOutKeyFrames.Add( 0, 1 );
wipeOutKeyFrames.Add( 1, 0 );
wipeInKeyFrames.Add( 0, 0 );
wipeInKeyFrames.Add( 1, 0 );
}
var numIns = wipeIn.activeEffects.Count;
var numOuts = wipeOut.activeEffects.Count;
for ( int i = 0; i < numIns; i++ )
{
list.Add( wipeInKeyFrames );
}
for ( int i = 0; i < numOuts; i++ )
{
list.Add( wipeOutKeyFrames );
}
this.LogInfo( "Num ins:", numIns, "Num outs:", numOuts );
return list;
}
}
}

View File

@ -0,0 +1 @@
uid://ccehwb78kb6oo

View File

@ -0,0 +1,43 @@
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
using Godot;
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class NoiseWipe:BaseWipeEffect
{
[ExportGroup( "Noise" )]
[Export( PropertyHint.Range, "0,1")]
public float noiseAmount = 1.0f;
[Export( PropertyHint.Range, "0.1,100")]
public float noiseFrequency = 10f;
[Export]
public Vector2 noisePosition = Vector2.Zero;
[Export]
public Vector2 noiseWipeOffset = Vector2.Zero;
protected override List<WipeCompositorEffect> _CreateEffects()
{
var wipe = new NoiseWipeEffect
{
noiseAmount = noiseAmount,
noiseFrequency = noiseFrequency,
noisePosition = noisePosition,
noiseWipeOffset = noiseWipeOffset
};
ApplyBaseWipeSettings( wipe );
return [ wipe ];
}
}
}

View File

@ -0,0 +1 @@
uid://dcwqfprd63q28

View File

@ -0,0 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
using Godot;
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class WipeSettings:Resource
{
[Export]
public Compositor compositor;
[Export]
public WipeEffect wipeEffect;
}
}

View File

@ -0,0 +1 @@
uid://cn05bqaq15tty

View File

@ -24,7 +24,7 @@ namespace Rokojori
public static bool Evaluate( Condition condition )
{
return condition == null ? true : condition.Evaluate();
return condition == null ? false : condition.Evaluate();
}
}
}

View File

@ -19,7 +19,7 @@ namespace Rokojori
public static bool Evaluate( SceneCondition condition )
{
return condition == null ? true : condition.Evaluate();
return condition == null ? false : condition.Evaluate();
}
}
}

View File

@ -13,6 +13,12 @@ namespace Rokojori
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/GameObject3D.svg") ]
public partial class GameObject3D:Node3D, INetworkNode
{
[ExportToolButton("Center On Children")]
public Callable centerOnChildrenButton => Callable.From( ()=> { this.CenterOnChildren(); } );
[ExportToolButton("Floor Pivot")]
public Callable floorPivotButton => Callable.From( ()=> { this.FloorPivot(); } );
[ExportGroup("Physics")]
[Export]
public PhysicsBody3D body;

View File

@ -0,0 +1,33 @@
using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
using System;
using Godot;
using System.Linq;
namespace Rokojori
{
[Tool]
[GlobalClass ]
public partial class ChangeIntVariable:Action
{
[Export]
public IntVariable variable;
[Export]
public int num;
protected override void _OnTrigger()
{
if ( variable == null )
{
return;
}
variable.value += num;
}
}
}

View File

@ -0,0 +1 @@
uid://dmdwxkjqxe03m

View File

@ -0,0 +1,82 @@
using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
using System;
using Godot;
using System.Linq;
namespace Rokojori
{
[Tool]
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/GameObject.svg") ]
public partial class IntVariable:Node
{
[Export]
public IntVariableClass variableClass;
int _value = 0;
[Export]
public int value
{
get => _value;
set
{
if ( variableClass == null )
{
_value = value;
return;
}
var valueBefore = _value;
var valueNew = variableClass.SetValue( this, valueBefore, value );
if ( valueBefore == valueNew )
{
return;
}
onChange?.Trigger();
if ( valueNew > valueBefore )
{
onIncrease?.Trigger();
}
else if ( valueNew < valueBefore )
{
onDecrease?.Trigger();
}
if ( valueNew == variableClass.min )
{
onMin?.Trigger();
}
if ( valueNew == variableClass.max )
{
onMax?.Trigger();
}
}
}
[Export]
public Action onChange;
[Export]
public Action onIncrease;
[Export]
public Action onDecrease;
[Export]
public Action onMax;
[Export]
public Action onMin;
}
}

View File

@ -0,0 +1 @@
uid://c01nqtwmfostx

View File

@ -0,0 +1,36 @@
using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
using System;
using Godot;
using System.Linq;
namespace Rokojori
{
[Tool]
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/GameObject.svg") ]
public partial class IntVariableClass:Resource
{
[Export]
public int min = -1000000;
[Export]
public int max = 1000000;
[Export]
public int resetValue = 0;
public int ResetValue( IntVariable variable, int currentValue )
{
return resetValue;
}
public int SetValue( IntVariable variable, int valueBefore, int valueNew )
{
return Mathf.Clamp( valueNew, min, max );
}
}
}

View File

@ -0,0 +1 @@
uid://djyqj3dds85d6

View File

@ -7,6 +7,102 @@ namespace Rokojori
{
public static class Node3DExtensions
{
public static Vector3? GetBoundsCenter( this Node3D self, bool onlyVisisble = true )
{
var optionalBounds = self.GetWorldBounds();
if ( optionalBounds == null )
{
return null;
}
var box = (Box3)(Aabb) optionalBounds;
return box.center;
}
public static Vector3 GetGlobalCenterOfChildren( this Node3D self, bool bounds = false, bool onlyVisible = true )
{
var center = Vector3.Zero;
var numChildren = 0;
self.ForEachDirectChild<Node3D>(
( c )=>
{
if ( onlyVisible && ! c.IsVisibleInTree() )
{
return;
}
if ( ! bounds )
{
center += c.GlobalPosition;
numChildren ++;
return;
}
var childCenter = c.GetBoundsCenter( onlyVisible );
if ( childCenter == null )
{
return;
}
center += (Vector3) childCenter;
numChildren ++;
}
);
if ( numChildren == 0 )
{
return self.GlobalPosition;
}
return center / numChildren;
}
public static void CenterOnChildren( this Node3D self, bool bounds = false, bool onlyVisible = true )
{
var childCenter = self.GetGlobalCenterOfChildren( bounds, onlyVisible );
var node3Ds = self.GetDirectChildren<Node3D>();
var positions = node3Ds.Map( n => n.GlobalPosition );
self.GlobalPosition = childCenter;
for ( int i = 0; i < node3Ds.Count; i++ )
{
node3Ds[ i ].GlobalPosition = positions[ i ];
}
}
public static void FloorPivot( this Node3D self, bool onlyVisible = true )
{
var worldBounds = self.GetWorldBounds( onlyVisible );
if ( worldBounds == null )
{
return;
}
var worldBox = (Box3) worldBounds;
var flooredPivot = self.GlobalPosition;
flooredPivot.Y = worldBox.min.Y;
var node3Ds = self.GetDirectChildren<Node3D>();
var positions = node3Ds.Map( n => n.GlobalPosition );
self.GlobalPosition = flooredPivot;
for ( int i = 0; i < node3Ds.Count; i++ )
{
node3Ds[ i ].GlobalPosition = positions[ i ];
}
}
public static Vector3 ToLocalFromLocal( this Node3D self, Node3D from, Vector3 fromLocalPosition )
{
var world = from.ToGlobal( fromLocalPosition );
@ -285,6 +381,8 @@ namespace Rokojori
nBounds.Position += vi.GlobalPosition;
nBounds.End += vi.GlobalPosition;
worldBounds = worldBounds == null ? nBounds : ( ((Aabb)worldBounds).Merge( nBounds ) );
}
);

View File

@ -13,6 +13,7 @@ namespace Rokojori
public static class NodeState
{
public static bool IsVisible( this Node n )
{
if ( n is Node3D )
@ -33,6 +34,41 @@ namespace Rokojori
return false;
}
public static bool IsProcessingInHierarchy( this Node n )
{
if ( n.ProcessMode == Node.ProcessModeEnum.Disabled )
{
return false;
}
if ( n.ProcessMode == Node.ProcessModeEnum.Always )
{
return true;
}
var paused = n.GetTree().Paused;
if ( n.ProcessMode == Node.ProcessModeEnum.Pausable )
{
return ! paused;
}
if ( n.ProcessMode == Node.ProcessModeEnum.WhenPaused )
{
return paused;
}
var p = n.GetParent();
if ( p == null )
{
return ! paused;
}
return p.IsProcessingInHierarchy();
}
public static void Configure( Node target, NodeStateConfiguration configuration )
{
Configure( target,
@ -133,25 +169,30 @@ namespace Rokojori
n.ProcessMode = processMode;
if ( n is Node3D )
if ( n is Node3D n3 )
{
( n as Node3D ).Visible = visible;
n3.Visible = visible;
}
if ( n is Node2D )
if ( n is Node2D n2 )
{
( n as Node2D ).Visible = visible;
n2.Visible = visible;
}
if ( n is CanvasItem )
if ( n is CanvasItem ci )
{
( n as CanvasItem ).Visible = visible;
ci.Visible = visible;
}
if ( n is iNodeState ins )
{
ins.OnNodeStateChanged();
}
if ( n is CollisionShape3D cs )
{
cs.Disabled = ! physicsEnabled;
}
}
public static void Set( Node n, bool enabled )

View File

@ -42,10 +42,10 @@ namespace Rokojori
public float delta = 0;
public override void _Process( double delta )
{
if ( Engine.IsEditorHint() || graphics == null || body == null )
if ( Engine.IsEditorHint() && graphics == null || body == null )
{
return;
}
@ -54,9 +54,6 @@ namespace Rokojori
{
ProcessActions( (float) delta );
}
if ( body.IsOnFloor() )
{
@ -64,8 +61,7 @@ namespace Rokojori
}
AssignGroundedTransform();
AssignGroundedTransform();
// Pose.CopyTo( body, graphics );
@ -94,14 +90,21 @@ namespace Rokojori
groundedTransform.SetGlobalQuaternion( graphics.GlobalQuaternion() );
}
// #if !TOOLS
public override void _PhysicsProcess( double delta )
{
if ( Engine.IsEditorHint() || graphics == null || body == null )
{
return;
}
if ( CharacterUpdateMode.Physics_Process == characterUpdateMode )
{
ProcessActions( (float) delta );
}
}
// #endif
void ProcessActions( float delta )
{
this.delta = (float) delta;

View File

@ -62,6 +62,9 @@ namespace Rokojori
[Export]
public float movingSpeedTreshold = 0.01f;
[Export]
public float currentSpeed = 0f;
[Export]
public Action onStartedMoving;
@ -95,6 +98,8 @@ namespace Rokojori
Vector3 _smoothedMovement;
public Vector3 smoothedMovement => _smoothedMovement;
int _frameID = 0;
protected override void _OnTrigger()
{
@ -167,17 +172,27 @@ namespace Rokojori
// var smoothedMovement = Vector3.Zero;
var movement = characterMovementData.movement;
var delta = controller.delta;
if ( onFloor )
{
_smoothedMovement = onFloorMovementSmoothing.Smooth( characterMovementData.movement, controller.delta );
_smoothedMovement = onFloorMovementSmoothing.Smooth( movement, delta );
}
else
{
_smoothedMovement = inAirMovementSmoothing.Smooth( characterMovementData.movement, controller.delta );
_smoothedMovement = inAirMovementSmoothing.Smooth( movement, delta );
}
var wasMoving = _moving;
_moving = _smoothedMovement.Length() > movingSpeedTreshold;
currentSpeed = _smoothedMovement.Length();
// this.LogInfo( _frameID, currentMovementType.ResourceName, " >> speed:", currentSpeed._FF(), "movement:", movement, "delta:", delta._FFF() );
_frameID ++;
_moving = currentSpeed > movingSpeedTreshold;
if ( wasMoving != _moving )
{

View File

@ -44,6 +44,10 @@ namespace Rokojori
[Export]
public float strafeSidewardsSpeedMultiply = 1.0f;
[ExportGroup( "Tweaking" )]
[Export]
public float yDeltaOffset = 0.01f;
public override void ProcessMovement( CharacterMovementData characterMovementData )
{
var characterMovement = characterMovementData.characterMovement;
@ -67,13 +71,18 @@ namespace Rokojori
forwardDirection = bodyPlane.ConstrainToPlane( forwardDirection + body.GlobalPosition ) - body.GlobalPosition;
rightDirection = bodyPlane.ConstrainToPlane( rightDirection + body.GlobalPosition ) - body.GlobalPosition;
}
forwardDirection.Y += yDeltaOffset;
rightDirection.Y += yDeltaOffset;
forwardDirection = forwardDirection.Normalized();
rightDirection = rightDirection.Normalized();
var direction = Sensors.FourDirectional( left, right, up, down );
// this.LogInfo( "moving:", "fw", forwardDirection, "r", rightDirection, "dir:", direction );
var movement = forwardDirection * - direction.Y * characterMovement.moveSpeed;
movement += rightDirection * direction.X * characterMovement.moveSpeed;

View File

@ -9,10 +9,72 @@ namespace Rokojori
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/CCMoveAndSlide.svg")]
public partial class MoveAndSlide:CharacterControllerAction
{
[Export]
public bool useStepping = false;
[Export]
public float stepMaxHeight = 0.2f;
protected override void _OnTrigger()
{
// RJLog.Log( controller.body.Velocity );
var body = controller.body;
var motion = controller.body.Velocity * controller.delta;
var collision = body.MoveAndCollide( motion, testOnly: true );
if ( collision != null && StepUp( motion ) )
{
return;
}
controller.body.MoveAndSlide();
}
protected bool StepUp( Vector3 motion )
{
var up = Vector3.Up * stepMaxHeight;
var hitAbove = controller.body.TestMove( controller.body.GlobalTransform, up );
if ( hitAbove )
{
return false;
}
bool hitForward = controller.body.TestMove( controller.body.GlobalTransform.Translated( up ), motion );
if ( ! hitForward )
{
var space = controller.body.GetWorld3D().DirectSpaceState;
var origin = controller.body.GlobalPosition;
var stepUpOrigin = controller.body.GlobalPosition + up;
var downHit = space.IntersectRay(
new PhysicsRayQueryParameters3D
{
From = stepUpOrigin,
To = stepUpOrigin + Vector3.Down * ( stepMaxHeight + 0.1f ),
CollisionMask = 1,
CollideWithAreas = false,
CollideWithBodies = true
}
);
if ( downHit.Count == 0 )
{
return false;
}
var exactStepAmount = downHit[ "position" ].AsVector3().Y - origin.Y;
if ( exactStepAmount > 0 && exactStepAmount <= stepMaxHeight )
{
controller.body.GlobalTranslate( new Vector3( 0, exactStepAmount, 0 ) );
return true;
}
}
return false;
}
}
}

View File

@ -0,0 +1,85 @@
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/Collectable.svg")]
public partial class Collectable:Action
{
[Export]
public CollectorTypeFlag[] collectorTypeFlags = [];
[Export]
public Collidable collidable;
[Export]
public CollectableData collectableData;
[Export]
public bool isAutoCollectable = true;
[ExportGroup( "On Collected")]
[Export]
public Collector collector;
[Export]
public bool disableOnCollection = true;
protected override void _OnTrigger()
{
if ( collidable == null || collectableData == null )
{
RJLog.Log( "No collidable or data" );
return;
}
var collider = collidable.collider;
if ( collider == null )
{
RJLog.Log( "No collider" );
return;
}
var collector = collider.FindSibling<Collector>();
if ( collector == null )
{
RJLog.Log( "No collector" );
return;
}
if ( collectorTypeFlags != null && collectorTypeFlags.Length > 0 )
{
if ( collectorTypeFlags.IndexOf( collector.collectorTypeFlag ) == -1 )
{
RJLog.Log( "No matching collectorTypeFlags" );
return;
}
}
var wasCollected = collector.Collect( this );
if ( ! wasCollected )
{
RJLog.Log( "! wasCollected" );
return;
}
this.collector = collector;
if ( disableOnCollection )
{
ProcessMode = ProcessModeEnum.Disabled;
}
}
}
}

View File

@ -0,0 +1 @@
uid://qwprrym288gb

View File

@ -0,0 +1,23 @@
using Godot;
using System.Collections;
using System.Collections.Generic;
using Godot.Collections;
using System.Drawing;
using System;
namespace Rokojori
{
[Tool]
[GlobalClass,Icon("res://addons/rokojori_action_library/Icons/Collectable.svg")]
public partial class CollectableCollection:Resource
{
[Export]
public CollectableType collectableType;
[Export]
public CollectableData[] collection = [];
[Export]
public ISOTimeStamp[] timeStamps = [];
}
}

View File

@ -0,0 +1 @@
uid://b2cvaagf81moo

View File

@ -0,0 +1,16 @@
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/Collectable.svg")]
public partial class CollectableData:SelectorFlag
{
[Export]
public CollectableType collectableType;
}
}

View File

@ -0,0 +1 @@
uid://dutnxjwc8dhx7

View File

@ -0,0 +1,19 @@
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/Collectable.svg")]
public partial class CollectableType:SelectorFlag
{
[Export]
public LocaleText collectableName;
[Export]
public Texture2D collectableIcon;
}
}

View File

@ -0,0 +1 @@
uid://doocg3kjxesop

View File

@ -0,0 +1,16 @@
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/Collectable.svg")]
public partial class CollectableTypeGroup:Resource
{
[Export]
public CollectableType[] types;
}
}

View File

@ -0,0 +1 @@
uid://b3ipr2fudbgyu

View File

@ -0,0 +1,71 @@
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/Collector.svg")]
public partial class Collector:Node
{
[Export]
public CollectorTypeFlag collectorTypeFlag;
[Export]
public CollectableCollection[] collectables = [];
[Export]
public bool canAutoCollect = true;
[Export]
public CollectableData lastItemData;
[Export]
public ISOTimeStamp lastItemTime;
[Export]
public Action onCollected;
public bool CanCollect( Collectable collectable )
{
if ( canAutoCollect && collectable.isAutoCollectable )
{
return true;
}
return collectables.Has( c => c.collectableType == collectable.collectableData.collectableType );
}
public virtual bool Collect( Collectable collectable )
{
var canCollect = CanCollect( collectable );
if ( ! canCollect )
{
return false;
}
var collection = collectables.Find( c => c.collectableType == collectable.collectableData.collectableType );
if ( collection == null )
{
collection = new CollectableCollection();
collection.collectableType = collectable.collectableData.collectableType;
collectables = collectables.Add( collection );
}
lastItemData = collectable.collectableData;
lastItemTime = ISOTimeStamp.Now();
collection.collection = collection.collection.Add( lastItemData );
collection.timeStamps = collection.timeStamps.Add( lastItemTime );
onCollected?.Trigger();
return true;
}
}
}

View File

@ -0,0 +1 @@
uid://ccfk70dpt7r7r

View File

@ -0,0 +1,15 @@
using Godot;
using System.Collections;
using System.Collections.Generic;
using Godot.Collections;
using System.Drawing;
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class CollectorTypeFlag:SelectorFlag
{
}
}

View File

@ -0,0 +1 @@
uid://dkd063lgqobog

View File

@ -0,0 +1,67 @@
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/Collectable.svg")]
public partial class OnCollected:Action
{
[Export]
public Collector collector;
[Export]
public CollectableTypeGroup[] includingTypes = [];
[Export]
public CollectableTypeGroup[] excludingTypes = [];
[Export]
public Action onCollectedAction;
protected override void _OnTrigger()
{
var collector = this.collector != null ? this.collector : this.FindParentThatIs<Collector>();
if ( collector == null )
{
return;
}
var collectableData = collector.lastItemData;
if ( collectableData == null )
{
return;
}
if ( includingTypes != null )
{
var included = includingTypes.Has( g => g.types.Has( t => t == collectableData.collectableType ) );
if ( ! included )
{
return;
}
}
if ( excludingTypes != null )
{
var excluded = excludingTypes.Has( g => g.types.Has( t => t == collectableData.collectableType ) );
if ( excluded )
{
return;
}
}
onCollectedAction?.Trigger();
}
}
}

View File

@ -0,0 +1 @@
uid://nfn3x4l7pcob

View File

@ -1,12 +1,14 @@
[gd_resource type="Resource" script_class="ShaderPropertyBlock" load_steps=6 format=3 uid="uid://bssrxwasqgpbd"]
[gd_resource type="Resource" script_class="ShaderPropertyBlock" load_steps=8 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://efmv0fcfxlqe" path="res://addons/rokojori_action_library/Runtime/Physics/Wind/Properties/rj_GlobalWindNoiseTextureCloseProperty.tres" id="3_u8xv4"]
[ext_resource type="Resource" uid="uid://bqm71chf8v7rs" path="res://addons/rokojori_action_library/Runtime/Physics/Wind/Properties/rj_GlobalWindPositionCloseProperty.tres" id="4_uwq2i"]
[ext_resource type="Resource" uid="uid://dtmjjes2elpl0" path="res://addons/rokojori_action_library/Runtime/Physics/Wind/Properties/rj_GlobalWindSpeedProperty.tres" id="5_kcrsv"]
[ext_resource type="Resource" uid="uid://du6ytwf1rcwop" path="res://addons/rokojori_action_library/Runtime/Physics/Wind/Properties/rj_GlobalWindNoiseTextureFarProperty.tres" id="5_npfeq"]
[ext_resource type="Resource" uid="uid://dhb638puibjbo" path="res://addons/rokojori_action_library/Runtime/Physics/Wind/Properties/rj_GlobalWindPositionFarProperty.tres" id="6_y5mpi"]
[resource]
script = ExtResource("1_x3rvk")
shaderProperties = [ExtResource("2_dcpws"), ExtResource("3_kcrsv"), ExtResource("4_owh4a"), ExtResource("5_kcrsv")]
shaderProperties = [ExtResource("2_dcpws"), ExtResource("3_u8xv4"), ExtResource("4_uwq2i"), ExtResource("5_npfeq"), ExtResource("6_y5mpi"), ExtResource("5_kcrsv")]
metadata/_custom_type_script = "uid://by2xsdh6vbaja"

View File

@ -1,8 +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"]
[ext_resource type="Script" uid="uid://bsreukpi8eiyy" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/Sampler2DPropertyName.cs" id="1_6unrl"]
[resource]
script = ExtResource("1_prtqd")
propertyName = "rj_GlobalWindNoiseTexture"
script = ExtResource("1_6unrl")
propertyName = "rj_GlobalWindNoiseTextureClose"
metadata/_custom_type_script = "uid://bsreukpi8eiyy"

View File

@ -1,6 +1,6 @@
[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="Resource" uid="uid://bnjsr0w6xwkho" path="res://addons/rokojori_action_library/Runtime/Physics/Wind/Properties/rj_GlobalWindNoiseTextureClose.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"]

View File

@ -0,0 +1,8 @@
[gd_resource type="Resource" script_class="Sampler2DPropertyName" load_steps=2 format=3 uid="uid://cwwu7wohhc0be"]
[ext_resource type="Script" uid="uid://bsreukpi8eiyy" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/Sampler2DPropertyName.cs" id="1_s8txx"]
[resource]
script = ExtResource("1_s8txx")
propertyName = "rj_GlobalWindNoiseTextureFar"
metadata/_custom_type_script = "uid://bsreukpi8eiyy"

View File

@ -0,0 +1,11 @@
[gd_resource type="Resource" script_class="Sampler2DProperty" load_steps=4 format=3 uid="uid://du6ytwf1rcwop"]
[ext_resource type="Resource" uid="uid://cwwu7wohhc0be" path="res://addons/rokojori_action_library/Runtime/Physics/Wind/Properties/rj_GlobalWindNoiseTextureFar.tres" id="1_57cas"]
[ext_resource type="Script" uid="uid://co43lpc6cforf" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/Properties/Sampler2DProperty.cs" id="2_vmqqo"]
[ext_resource type="Texture2D" uid="uid://c30nul6romace" path="res://addons/rokojori_action_library/Runtime/Procedural/Noise/RGB 3D Noise.png" id="3_8nq0y"]
[resource]
script = ExtResource("2_vmqqo")
propertyName = ExtResource("1_57cas")
value = ExtResource("3_8nq0y")
metadata/_custom_type_script = "uid://co43lpc6cforf"

View File

@ -1,8 +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"]
[ext_resource type="Script" uid="uid://cebfjne1ewhnm" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/Vector2PropertyName.cs" id="1_n4dfn"]
[resource]
script = ExtResource("1_xy81n")
propertyName = "rj_GlobalWindPosition"
script = ExtResource("1_n4dfn")
propertyName = "rj_GlobalWindPositionClose"
metadata/_custom_type_script = "uid://cebfjne1ewhnm"

View File

@ -1,6 +1,6 @@
[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="Resource" uid="uid://cqw5ebx5oq2p0" path="res://addons/rokojori_action_library/Runtime/Physics/Wind/Properties/rj_GlobalWindPositionClose.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]

View File

@ -0,0 +1,8 @@
[gd_resource type="Resource" script_class="Vector2PropertyName" load_steps=2 format=3 uid="uid://qm0sg1s8xaox"]
[ext_resource type="Script" uid="uid://cebfjne1ewhnm" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/Vector2PropertyName.cs" id="1_pel8l"]
[resource]
script = ExtResource("1_pel8l")
propertyName = "rj_GlobalWindPositionFar"
metadata/_custom_type_script = "uid://cebfjne1ewhnm"

View File

@ -0,0 +1,10 @@
[gd_resource type="Resource" script_class="Vector2Property" load_steps=3 format=3 uid="uid://dhb638puibjbo"]
[ext_resource type="Resource" uid="uid://qm0sg1s8xaox" path="res://addons/rokojori_action_library/Runtime/Physics/Wind/Properties/rj_GlobalWindPositionFar.tres" id="1_dn5hy"]
[ext_resource type="Script" uid="uid://colw2dxvhfkxy" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/Properties/Vector2Property.cs" id="2_kk3m7"]
[resource]
script = ExtResource("2_kk3m7")
propertyName = ExtResource("1_dn5hy")
value = Vector2(0, -46.304832)
metadata/_custom_type_script = "uid://colw2dxvhfkxy"

View File

@ -21,15 +21,16 @@ namespace Rokojori
return;
}
UpdatePosition( rm, (float) delta );
UpdatePosition( rm, (float) delta, data.globalWindPositionClosePropertyName, data.closeMultiplier );
UpdatePosition( rm, (float) delta, data.globalWindPositionFarPropertyName, data.farMultiplier );
UpdateDirection( rm, (float) delta );
UpdateSpeed( rm, (float) delta );
}
void UpdatePosition( RenderingManager rm, float delta )
void UpdatePosition( RenderingManager rm, float delta, ShaderPropertyName positionName, float multiplier )
{
var windPositionProperty = rm.data.GetGlobalPropertyByName( data.globalWindPositionPropertyName );
var windPositionProperty = rm.data.GetGlobalPropertyByName( positionName );
if ( windPositionProperty == null )
{
@ -38,7 +39,7 @@ namespace Rokojori
var positionProperty = (Vector2Property) windPositionProperty;
var position = positionProperty.value;
position += -data.windSpeed.GetNormalizedWindSpeedOffset( delta, data.minimumScrollSpeedKMH, data.maximumScrollSpeedKMH ) * data.windDirection.Normalized();
position += multiplier * -data.windSpeed.GetNormalizedWindSpeedOffset( delta, data.minimumScrollSpeedKMH, data.maximumScrollSpeedKMH ) * data.windDirection.Normalized();
positionProperty.value = position;
}

View File

@ -21,7 +21,16 @@ namespace Rokojori
public float maximumScrollSpeedKMH = 100;
[Export]
public Vector2PropertyName globalWindPositionPropertyName;
public float closeMultiplier = 1.0f;
[Export]
public float farMultiplier = 0.1f;
[Export]
public Vector2PropertyName globalWindPositionClosePropertyName;
[Export]
public Vector2PropertyName globalWindPositionFarPropertyName;
[Export]
public Vector2PropertyName globalWindDirectionPropertyName;

View File

@ -80,12 +80,43 @@ namespace Rokojori
}
List<SplinePoint> GetFilteredSplinePoints()
{
var unfilteredSplinePoints = Nodes.GetDirectChildren<SplinePoint>( this );
if ( unfilteredSplinePoints.Count == 0 )
{
return unfilteredSplinePoints;
}
var splinePoints = new List<SplinePoint>();
var lastPoint = 0;
splinePoints.Add( unfilteredSplinePoints[ 0 ] );
for ( int i = 1; i < unfilteredSplinePoints.Count; i++ )
{
var last = unfilteredSplinePoints[ lastPoint ];
var p = unfilteredSplinePoints[ i ];
var distance = ( last.GlobalPosition - p.GlobalPosition ).Length();
if ( distance > 0.0001f )
{
splinePoints.Add( p );
lastPoint = i;
}
}
// this.LogInfo( "Filtered Spline Points:", unfilteredSplinePoints.Count, ">>", splinePoints.Count );
return splinePoints;
}
public SplineCurve GetCurve()
{
if ( splineCurve == null )
{
var splinePoints = Nodes.GetDirectChildren<SplinePoint>( this );
var splinePoints = GetFilteredSplinePoints();
splineCurve = new SplineCurveCreator().Create( splinePoints, closed );
min = splineCurve.MinPointPosition();
@ -104,8 +135,7 @@ namespace Rokojori
{
if ( splineCurveXZ == null )
{
var splinePoints = Nodes.GetDirectChildren<SplinePoint>( this );
var splinePoints = GetFilteredSplinePoints();
splineCurveXZ = new SplineCurveCreator().Create( splinePoints, closed ).CloneForXZ( 0 );
}

View File

@ -24,6 +24,12 @@ namespace Rokojori
public GeneratorEntry segment;
[Export]
public float segmentLength;
[Export]
public Vector3 segmentRotation;
[Export]
public float segmentYOffset;
[Export]
public Vector3 scaleAxis = new Vector3( 1, 0, 0 );
[Export]
public GeneratorEntry pole;
@ -60,6 +66,9 @@ namespace Rokojori
var id = 0;
var positions = new List<Vector3>();
var rotations = new List<Quaternion>();
for ( int i = 0; i < numPoints; i++ )
{
var t = i / (float) ( numPoints - 1 );
@ -82,18 +91,35 @@ namespace Rokojori
"D:", direction
);*/
var point = CreatePoint( points, id, position.X, position.Y, position.Z );
var point = CreatePoint( points, id, position.X, position.Y, position.Z, pole );
point.rotation = Math3D.LookRotation( direction, Vector3.Up );
positions.Add( position );
rotations.Add( point.rotation );
id = point.creatorID + 1;
}
for ( int i = 0; i < positions.Count - 1; i++ )
{
var position = positions[ i ].Lerp( positions[ i + 1 ], 0.5f );
var direction = positions[ i + 1 ] - positions[ i ];
var rotation = Math3D.LookRotation( direction, Vector3.Up );
var length = direction.Length() / segmentLength - 1.0f;
var point = CreatePoint( points, id, position.X, position.Y + segmentYOffset, position.Z, segment );
point.rotation = rotation * Quaternion.FromEuler( segmentRotation / 180.0f * Mathf.Pi );
point.scale = Vector3.One + length * scaleAxis;
id = point.creatorID + 1;
}
return points;
}
ScatterPoint CreatePoint( List<ScatterPoint> points, int id, float x, float y, float z )
ScatterPoint CreatePoint( List<ScatterPoint> points, int id, float x, float y, float z, GeneratorEntry entry )
{
var p = new ScatterPoint( this, id );
@ -101,7 +127,8 @@ namespace Rokojori
p.visible = ! setDiscarded;
p.seed = Noise.CreateSeed( p.position );
AssginSceneAndContainer( p );
p.scene = entry.GetPackedScene();
p.parent = entry.container;
points.Add( p );

View File

@ -0,0 +1,82 @@
using Godot;
using Godot.Collections;
using System.Collections.Generic;
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class RimEffect:SingleShaderCompositorEffect
{
public static readonly string shaderPath = Path( "Rim/RimShader.glsl" );
RDSampler sampler;
[Export( PropertyHint.Range, "0,50") ]
public float effectStrength = 1;
[Export( PropertyHint.Range, "-10,10") ]
public float rimOffsetX = 2f;
[Export( PropertyHint.Range, "-10,10") ]
public float rimOffsetY = 0f;
[Export( PropertyHint.Range, "0.0001,1") ]
public float minDepth = 0.001f;
[Export( PropertyHint.Range, "0.01,500.0") ]
public float depthScale = 1f;
[Export( PropertyHint.Range, "-10,10.0") ]
public float depthOffset = 1f;
[Export( PropertyHint.Range, "1,1000") ]
public float contrast = 1f;
[Export( PropertyHint.Range, "0,1") ]
public float debugView = 0f;
protected override void OnConfigure()
{
EffectCallbackType = EffectCallbackTypeEnum.PostOpaque;
_shaderPath = shaderPath;
_groupSize = 8;
}
protected override void OnInitialize()
{
base.OnInitialize();
sampler = context.Sampler( RenderingDevice.SamplerFilter.Nearest, RenderingDevice.SamplerRepeatMode.ClampToEdge );
}
protected override void SetConstants()
{
constants.Set(
(Vector2)context.internalSize,
new Vector2( depthScale, depthOffset ),
effectStrength,
rimOffsetX,
rimOffsetY,
minDepth,
contrast,
debugView
);
}
protected override void RenderView()
{
context.AssignScreenColorTexture();
context.AssignScreenDepthTexture( sampler );
context.pushConstants = constants;
context.ProcessComputeProgram();
}
}
}

View File

@ -0,0 +1 @@
uid://bkcgo0ho1x6ju

View File

@ -0,0 +1,63 @@
#[compute]
#version 450
layout( local_size_x = 8, local_size_y = 8, local_size_z = 1 ) in;
layout( rgba16f, set = 0, binding = 0 )
uniform image2D color_image;
layout( set = 1, binding = 0 )
uniform sampler2D depth_sampler;
layout( push_constant, std430 )
uniform Params
{
vec2 rasterSize;
vec2 amounts;
float effectStrength;
float rimOffsetX;
float rimOffsetY;
float minDepth;
float contrastIntensity;
float debugView;
} params;
float sampleDepth( vec2 coord )
{
coord = clamp( coord, vec2( 0 ), vec2( params.rasterSize ) - vec2( 1.0 ) );
vec2 uv = ( vec2( coord ) + 0.5 ) / params.rasterSize;
return texture( depth_sampler, uv ).r;
}
void main( )
{
ivec2 uv = ivec2( gl_GlobalInvocationID.xy );
ivec2 size = ivec2( params.rasterSize );
if ( uv.x >= size.x || uv.y >= size.y )
{
return;
}
vec2 rimOffset = vec2( params.rimOffsetX, params.rimOffsetY );
float depth = sampleDepth( uv );
float rimDepth = sampleDepth( uv + rimOffset );
float rimStrength = min( 1.0, max( 0.0, depth - rimDepth ) * params.contrastIntensity );
float amount = 1.0 - min( 1.0, pow( depth * params.amounts.x + params.amounts.y, params.minDepth ) );
vec4 color = imageLoad( color_image, uv );
float combinedAmount = max( 0.0, min( 1.0, amount * rimStrength * params.effectStrength ) );
color = mix( color, vec4( 1.0, 1.0, 1.0, 1.0 ), combinedAmount );
color = mix( color, vec4( amount, amount, amount, 1.0 ), params.debugView );
imageStore( color_image, uv, color );
}

View File

@ -0,0 +1,14 @@
[remap]
importer="glsl"
type="RDShaderFile"
uid="uid://c3ym5825e532r"
path="res://.godot/imported/RimShader.glsl-d18cc4c508ce033a11df2415ffe60f09.res"
[deps]
source_file="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Rim/RimShader.glsl"
dest_files=["res://.godot/imported/RimShader.glsl-d18cc4c508ce033a11df2415ffe60f09.res"]
[params]

View File

@ -14,7 +14,7 @@ namespace Rokojori
[Export( PropertyHint.Range, "0,1")]
public float amount = 1.0f;
[Export( PropertyHint.Range, "0.1,2")]
[Export( PropertyHint.Range, "0.01,10")]
public float radius = 0.5f;
[Export]

View File

@ -0,0 +1,39 @@
using Godot;
using Godot.Collections;
using System.Collections.Generic;
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class CircleWipeEffect:WipeCompositorEffect
{
public CircleWipeEffect():base()
{
InitializeWipe( new RG_CircleWipe( graph ) );
}
[ExportGroup( "Circle" )]
[Export( PropertyHint.Range, "-1,2")]
public float centerX = 0.5f;
[Export( PropertyHint.Range, "-1,2")]
public float centerY = 0.5f;
[Export( PropertyHint.Range, "0,0.5")]
public float fade = 0.1f;
protected override void ForAllViews()
{
SetWipeConstants(
centerX,
centerY,
fade
);
}
}
}

View File

@ -0,0 +1 @@
uid://kk0ei1lt88yk

View File

@ -0,0 +1,45 @@
using Godot;
using Godot.Collections;
using System.Collections.Generic;
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class DirectionalWipeEffect:WipeCompositorEffect
{
public DirectionalWipeEffect():base()
{
InitializeWipe( new RG_DirectionalWipe( graph ) );
}
[ExportGroup( "Directional" )]
[Export( PropertyHint.Range, "0,360")]
public float angle = 0.0f;
[Export( PropertyHint.Range, "0,0.5")]
public float fade = 0.1f;
public enum DirectionType
{
Single,
Double
}
[Export( PropertyHint.Range, "0,0.5")]
public DirectionType directionType = DirectionType.Single;
protected override void ForAllViews()
{
SetWipeConstants(
angle,
fade,
directionType == DirectionType.Single ? 0f : 1f
);
}
}
}

View File

@ -0,0 +1,45 @@
using Godot;
using Godot.Collections;
using System.Collections.Generic;
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class NoiseWipeEffect:WipeCompositorEffect
{
public NoiseWipeEffect():base()
{
InitializeWipe( new RG_NoiseWipe( graph ) );
}
[ExportGroup( "Noise" )]
[Export( PropertyHint.Range, "0,1")]
public float noiseAmount = 1.0f;
[Export( PropertyHint.Range, "0.1,100")]
public float noiseFrequency = 10f;
[Export]
public Vector2 noisePosition = Vector2.Zero;
[Export]
public Vector2 noiseWipeOffset = Vector2.Zero;
protected override void ForAllViews()
{
var noiseOffset = noisePosition + noiseWipeOffset * GetWipeColor().A;
SetWipeConstants(
noiseAmount,
noiseFrequency,
noiseOffset.X,
noiseOffset.Y
);
}
}
}

View File

@ -0,0 +1 @@
uid://bbpmy1vvogfb7

View File

@ -0,0 +1,103 @@
using Godot;
using Godot.Collections;
using System.Collections.Generic;
namespace Rokojori
{
[Tool]
[GlobalClass]
public abstract partial class WipeCompositorEffect:RDGraphCompositorEffect
{
[ExportGroup("Wipe")]
[Export(PropertyHint.Range, "0,1")]
public float wipeState = 0f;
[Export]
public Gradient wipeGradient = new Gradient();
[ExportGroup("Blend Mode")]
[Export]
public float replace = 1.0f;
[Export]
public float add = 0.0f;
[Export]
public float multiply = 0.0f;
[Export]
public float colorize = 0.0f;
[Export]
public bool normalizeBlendWeights = true;
protected CEG_ImageProcessor wipe;
protected CEG_ScreenColorTexure screenColorTexture;
public Color GetWipeColor()
{
var clampedState = MathX.Clamp01( wipeState );
var color = wipeGradient.Sample( clampedState );
color.A *= clampedState;
return color;
}
protected void InitializeWipe( CEG_ImageProcessor wipe )
{
this.wipe = wipe;
screenColorTexture = new CEG_ScreenColorTexure( graph );
graph.InitializeNodes();
wipe.SetTextureSlotInputs( screenColorTexture, screenColorTexture );
graph.SetProcessOrder(
screenColorTexture,
wipe
);
}
protected void SetWipeConstants( params object[] wipeConstants )
{
var blendWeights = GetBlendModeWeights();
var color = GetWipeColor();
wipe.constants.SetOrAdd( true,
color.R,
color.G,
color.B,
color.A,
blendWeights.X,
blendWeights.Y,
blendWeights.Z,
blendWeights.W
);
wipe.constants.SetOrAdd( false, wipeConstants );
}
public Vector4 GetBlendModeWeights()
{
var blendR = replace;
var blendA = add;
var blendM = multiply;
var blendC = colorize;
var v = new Vector4( blendR, blendA, blendM, blendC );
if ( normalizeBlendWeights )
{
var sum = blendR + blendA + blendM + blendC;
v /= sum;
}
return v;
}
}
}

View File

@ -0,0 +1 @@
uid://dij4etvyuohgl

View File

@ -170,7 +170,7 @@ namespace Rokojori
_uniformSets.Add( uniformSet );
}
public void CreateUniformaSet( params RDUniform[] uniforms )
public void CreateUniformSet( params RDUniform[] uniforms )
{
var setIndex = _uniformSets.Count;
_CreateUniformSetRid( setIndex, uniforms );

View File

@ -41,6 +41,54 @@ namespace Rokojori
_bytes = null;
}
public void SetOrAdd( bool reset, params object[] objects )
{
if ( reset )
{
Reset();
}
for ( int i = 0; i < objects.Length; i++ )
{
if ( objects[ i ] is int )
{
_AddInt( (int) objects[ i ] );
}
else if ( objects[ i ] is float )
{
_AddFloat( (float) objects[ i ] );
}
else if ( objects[ i ] is Vector2 )
{
_AddVector2( (Vector2) objects[ i ] );
}
else if ( objects[ i ] is Vector2I )
{
_AddVector2( (Vector2I) objects[ i ] );
}
else if ( objects[ i ] is Vector3 )
{
_AddVector3( (Vector3) objects[ i ] );
}
else if ( objects[ i ] is Vector3I )
{
_AddVector3( (Vector3I) objects[ i ] );
}
else if ( objects[ i ] is Vector4 )
{
_AddVector4( (Vector4) objects[ i ] );
}
}
}
public void Set( params object[] objects )
{
Reset();

View File

@ -7,6 +7,11 @@ namespace Rokojori
{
public RDTexture( RDContext context, Rid rid ):base( context, rid ){}
public static RDTexture Create( RDContext context, Texture2D texture )
{
return new RDTexture( context, texture.GetRid() );
}
public static RDTexture Create( RDContext effect, RDTextureFormat format, RDTextureView view )
{
return new RDTexture( effect, effect.renderingDevice.TextureCreate( format, view ) );

View File

@ -0,0 +1,49 @@
using Godot;
using System.Collections.Generic;
namespace Rokojori
{
public class RG_ImageTexture:RGGraphProcessor, RDGraphTextureSlotInput
{
RDTexture _texture;
public RDTexture GetTexture()
{
return _texture;
}
public RGGraphProcessor GetProcessor()
{
return this;
}
List<CompositorEffectGraphTextureSlot> _connectedSlots = new List<CompositorEffectGraphTextureSlot>();
public void SetConnected( CompositorEffectGraphTextureSlot slot )
{
_connectedSlots.Add( slot );
}
public RG_ImageTexture( RDGraph graph):base( graph )
{
}
public void SetImageTexture( RDTexture texture )
{
_texture = texture;
}
public override void Process()
{
}
public void ConnectTo( CompositorEffectGraphTextureSlot slot )
{
slot.SetInput( this );
}
}
}

View File

@ -0,0 +1 @@
uid://vh50asoqrs5

View File

@ -0,0 +1,155 @@
#[compute]
#version 450
vec3 colorize( vec3 original, vec3 color )
{
float grey = ( original.r + original.g + original.b ) / 3.0;
return grey < 0.5 ? mix( vec3( 0.0 ), color, grey * 2.0 ) :
mix( color, vec3( 1.0 ), ( grey - 0.5 ) * 2.0 );
}
float clamp01( float value )
{
return clamp( value, 0.0, 1.0 );
}
float normalizeToRange( float value, float min, float max )
{
return ( value - min ) / ( max - min );
}
float normalizeToRange01( float value, float min, float max )
{
return clamp01( normalizeToRange( value, min, max ) );
}
float map( float value, float inMin, float inMax, float outMin, float outMax )
{
return mix( outMin, outMax, normalizeToRange( value, inMin, inMax ) );
}
float mapClamped( float value, float inMin, float inMax, float outMin, float outMax )
{
return mix( outMin, outMax, normalizeToRange01( value, inMin, inMax ) );
}
vec2 rotate_v2( vec2 uv, float angle )
{
float s = sin( angle );
float c = cos( angle );
float x = uv.x;
float y = uv.y;
uv.x = c * x - s * y;
uv.y = s * x + c * y;
return uv;
}
vec2 rotateAround_v2( vec2 uv, float angle, vec2 pivot )
{
uv -= pivot;
uv = rotate_v2( uv, angle );
uv += pivot;
return uv;
}
layout( local_size_x = 8, local_size_y = 8, local_size_z = 1 ) in;
layout( rgba16f, set = 0, binding = 0 )
uniform image2D inputImage;
layout( rgba16f, set = 1, binding = 0 )
uniform image2D outputImage;
// layout( rgba16f, set = 2, binding = 0 )
// uniform image2D noiseImage;
layout( push_constant, std430 )
uniform Parameters
{
float r;
float g;
float b;
float a;
float replace;
float add;
float multiply;
float colorize;
float centerX;
float centerY;
float fade;
} parameters;
float PI = 3.141592653589793;
void main( )
{
ivec2 size = imageSize( inputImage );
ivec2 texel_coord = ivec2( gl_GlobalInvocationID.xy );
if ( any( greaterThanEqual( texel_coord, size ) ) )
{
return;
}
vec2 uv = ( vec2( texel_coord ) + 0.5 ) / vec2( size );
float aspect = float( size.y ) / float( size.x );
vec2 circleUV = uv;
circleUV.y -= 0.5;
circleUV.y *= aspect;
circleUV.y += 0.5;
float alpha = 0.0;
vec2 center = vec2( parameters.centerX, parameters.centerY );
float d0 = distance( center, vec2(0.0, 0.0) );
float d1 = distance( center, vec2(1.0, 0.0) );
float d2 = distance( center, vec2(0.0, 1.0) );
float d3 = distance( center, vec2(1.0, 1.0) );
float max_radius = max( max( d0, d1 ), max( d2, d3 ) );
float r = distance( circleUV, center );
float fadeValue = 1.0 - r / max_radius;
float fadeStart = parameters.a - parameters.fade * 2.0;
float fadeEnd = parameters.a + parameters.fade * 2.0;
float minFade = 0 + parameters.fade * 2.0;
float maxFade = 1 - parameters.fade * 2.0;
fadeValue = mapClamped( fadeValue, 0.0, 1.0, minFade, maxFade );
alpha = mapClamped( fadeValue, fadeStart, fadeEnd, 1.0, 0.0 );
vec4 color = imageLoad( inputImage, ivec2( uv * size ) );
vec4 replaced = vec4( parameters.r, parameters.g, parameters.b, 1.0 );
vec4 multiplied = replaced * color;
vec4 added = replaced + color;
vec4 colorized = vec4( colorize( color.rgb, replaced.rgb ), 1.0 );
vec4 mixed = replaced * parameters.replace +
added * parameters.add +
multiplied * parameters.multiply +
colorized * parameters.colorize;
vec4 blended = mix( color, mixed, alpha );
imageStore( outputImage, texel_coord, blended );
}

View File

@ -0,0 +1,14 @@
[remap]
importer="glsl"
type="RDShaderFile"
uid="uid://le4523acrrbb"
path="res://.godot/imported/CircleWipe.glsl-88a11984505e55894f404dcf7e1fddf2.res"
[deps]
source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Wipes/CircleWipe/CircleWipe.glsl"
dest_files=["res://.godot/imported/CircleWipe.glsl-88a11984505e55894f404dcf7e1fddf2.res"]
[params]

View File

@ -0,0 +1,16 @@
using Godot;
using System.Collections.Generic;
namespace Rokojori
{
public class RG_CircleWipe:CEG_ImageProcessor
{
public static readonly string shaderPath =
RDGraph.Path( "Nodes/Processors/Wipes/CircleWipe/CircleWipe.glsl" );
public RG_CircleWipe( RDGraph graph ):base( graph, shaderPath )
{}
}
}

View File

@ -0,0 +1 @@
uid://cn0byh5xg0l10

View File

@ -0,0 +1,177 @@
#[compute]
#version 450
vec3 colorize( vec3 original, vec3 color )
{
float grey = ( original.r + original.g + original.b ) / 3.0;
return grey < 0.5 ? mix( vec3( 0.0 ), color, grey * 2.0 ) :
mix( color, vec3( 1.0 ), ( grey - 0.5 ) * 2.0 );
}
float clamp01( float value )
{
return clamp( value, 0.0, 1.0 );
}
float normalizeToRange( float value, float min, float max )
{
return ( value - min ) / ( max - min );
}
float normalizeToRange01( float value, float min, float max )
{
return clamp01( normalizeToRange( value, min, max ) );
}
float map( float value, float inMin, float inMax, float outMin, float outMax )
{
return mix( outMin, outMax, normalizeToRange( value, inMin, inMax ) );
}
float mapClamped( float value, float inMin, float inMax, float outMin, float outMax )
{
return mix( outMin, outMax, normalizeToRange01( value, inMin, inMax ) );
}
vec2 rotate_v2( vec2 uv, float angle )
{
float s = sin( angle );
float c = cos( angle );
float x = uv.x;
float y = uv.y;
uv.x = c * x - s * y;
uv.y = s * x + c * y;
return uv;
}
vec2 rotateAround_v2( vec2 uv, float angle, vec2 pivot )
{
uv -= pivot;
uv = rotate_v2( uv, angle );
uv += pivot;
return uv;
}
layout( local_size_x = 8, local_size_y = 8, local_size_z = 1 ) in;
layout( rgba16f, set = 0, binding = 0 )
uniform image2D inputImage;
layout( rgba16f, set = 1, binding = 0 )
uniform image2D outputImage;
// layout( rgba16f, set = 2, binding = 0 )
// uniform image2D noiseImage;
layout( push_constant, std430 )
uniform Parameters
{
float r;
float g;
float b;
float a;
float replace;
float add;
float multiply;
float colorize;
float angle;
float fade;
float doubleSided;
} parameters;
float PI = 3.141592653589793;
float computeFadeValue( vec2 uv, float angle )
{
float minFade = 0 + parameters.fade;
float maxFade = 1 - parameters.fade;
float angle_rad = angle * PI / 180.0;
vec2 dir = vec2( cos( angle_rad), sin( angle_rad ) );
float proj = dot( uv - vec2(0.0), dir);
float p0 = dot( vec2( 0.0, 0.0 ), dir );
float p1 = dot( vec2( 1.0, 0.0 ), dir );
float p2 = dot( vec2( 0.0, 1.0 ), dir );
float p3 = dot( vec2( 1.0, 1.0 ), dir );
float min_p = min( min( p0, p1 ), min( p2, p3) );
float max_p = max( max( p0, p1 ), max( p2, p3) );
float fadeValue = ( proj - min_p ) / ( max_p - min_p );
fadeValue = mapClamped( fadeValue, 0.0, 1.0, minFade, maxFade );
return fadeValue;
}
void main( )
{
ivec2 size = imageSize( inputImage );
ivec2 texel_coord = ivec2( gl_GlobalInvocationID.xy );
if ( any( greaterThanEqual( texel_coord, size ) ) )
{
return;
}
vec2 uv = ( vec2( texel_coord ) + 0.5 ) / vec2( size );
float alpha = 0.0;
if ( parameters.doubleSided > 0.5 )
{
float fadeValueA = computeFadeValue( uv, parameters.angle );
float fadeValueB = computeFadeValue( uv, parameters.angle + 180.0 );
float fadeRange = 0.5 + parameters.fade;
float fadeStart = parameters.a * fadeRange - parameters.fade * 0.5;
float fadeEnd = parameters.a * fadeRange + parameters.fade * 0.5;;
float alphaA = mapClamped( fadeValueA, fadeStart, fadeEnd, 1.0, 0.0 );
float alphaB = mapClamped( fadeValueB, fadeStart, fadeEnd, 1.0, 0.0 );
alpha = max( alphaA, alphaB );
}
else
{
float fadeValue = computeFadeValue( uv, parameters.angle );
float fadeStart = parameters.a - parameters.fade;
float fadeEnd = parameters.a + parameters.fade;
alpha = mapClamped( fadeValue, fadeStart, fadeEnd, 1.0, 0.0 );
}
vec4 color = imageLoad( inputImage, ivec2( uv * size ) );
vec4 replaced = vec4( parameters.r, parameters.g, parameters.b, 1.0 );
vec4 multiplied = replaced * color;
vec4 added = replaced + color;
vec4 colorized = vec4( colorize( color.rgb, replaced.rgb ), 1.0 );
vec4 mixed = replaced * parameters.replace +
added * parameters.add +
multiplied * parameters.multiply +
colorized * parameters.colorize;
vec4 blended = mix( color, mixed, alpha );
imageStore( outputImage, texel_coord, blended );
}

Some files were not shown because too many files have changed in this diff Show More