From 76a4e8e87d23c0b0329604514864cf00a0cf7a91 Mon Sep 17 00:00:00 2001 From: Josef Date: Tue, 25 Mar 2025 08:08:51 +0100 Subject: [PATCH] Update --- .../Flash/Presets/Blue Shield - Flash.tres | 6 +- .../Flash/Presets/Green Charge - Flash.tres | 6 +- .../Flash/Presets/Orange Boost - Flash.tres | 6 +- .../Flash/Presets/Red Hit - Flash.tres | 6 +- .../Flash/Presets/White Blinking - Flash.tres | 6 +- .../Presets/White Outline - Highlight.tres | 4 +- .../Shake/Presets/Mini Poke - Shake.tres | 6 +- .../Presets/Small Impact Low FPS - Shake.tres | 4 +- .../Parametric/Plane/ClipMapPlaneMeshType.cs | 79 +++++++++++++++++++ .../Plane/ClipMapPlaneMeshType.cs.uid | 1 + Runtime/Procedural/Parametric/Plane/Plane.cs | 75 ++++++++++++++++++ .../Procedural/Parametric/Plane/Plane.cs.uid | 1 + .../Parametric/Plane/__PlaneMeshType__.cs | 19 +++++ .../Parametric/Plane/__PlaneMeshType__.cs.uid | 1 + .../Parametric/Spline/SplinePoint.cs | 2 +- 15 files changed, 199 insertions(+), 23 deletions(-) create mode 100644 Runtime/Procedural/Parametric/Plane/ClipMapPlaneMeshType.cs create mode 100644 Runtime/Procedural/Parametric/Plane/ClipMapPlaneMeshType.cs.uid create mode 100644 Runtime/Procedural/Parametric/Plane/Plane.cs create mode 100644 Runtime/Procedural/Parametric/Plane/Plane.cs.uid create mode 100644 Runtime/Procedural/Parametric/Plane/__PlaneMeshType__.cs create mode 100644 Runtime/Procedural/Parametric/Plane/__PlaneMeshType__.cs.uid diff --git a/Runtime/Animation/Flash/Presets/Blue Shield - Flash.tres b/Runtime/Animation/Flash/Presets/Blue Shield - Flash.tres index 2294de4..abf47de 100644 --- a/Runtime/Animation/Flash/Presets/Blue Shield - Flash.tres +++ b/Runtime/Animation/Flash/Presets/Blue Shield - Flash.tres @@ -1,8 +1,8 @@ [gd_resource type="Resource" script_class="FlashEffect" load_steps=8 format=3 uid="uid://bfxwx0fiejnk3"] -[ext_resource type="Script" path="res://addons/rokojori_action_library/Runtime/Animation/HDRColor.cs" id="1_ejko8"] -[ext_resource type="Script" path="res://addons/rokojori_action_library/Runtime/Animation/AnimationCurve.cs" id="2_3i2og"] -[ext_resource type="Script" path="res://addons/rokojori_action_library/Runtime/Animation/Flash/FlashEffect.cs" id="3_65ipm"] +[ext_resource type="Script" uid="uid://dncqth3uf3tb3" path="res://addons/rokojori_action_library/Runtime/Animation/HDRColor.cs" id="1_ejko8"] +[ext_resource type="Script" uid="uid://c5tm02yj1bhhx" path="res://addons/rokojori_action_library/Runtime/Animation/AnimationCurve.cs" id="2_3i2og"] +[ext_resource type="Script" uid="uid://cupnq55n3nimc" path="res://addons/rokojori_action_library/Runtime/Animation/Flash/FlashEffect.cs" id="3_65ipm"] [ext_resource type="Resource" uid="uid://ch5nsa6yafs5l" path="res://addons/rokojori_action_library/Runtime/Time/TimeLines/GameTime.tres" id="4_nyaof"] [sub_resource type="Resource" id="Resource_54hj8"] diff --git a/Runtime/Animation/Flash/Presets/Green Charge - Flash.tres b/Runtime/Animation/Flash/Presets/Green Charge - Flash.tres index 57938f1..6c207db 100644 --- a/Runtime/Animation/Flash/Presets/Green Charge - Flash.tres +++ b/Runtime/Animation/Flash/Presets/Green Charge - Flash.tres @@ -1,8 +1,8 @@ [gd_resource type="Resource" script_class="FlashEffect" load_steps=8 format=3 uid="uid://drjdsp2qnceql"] -[ext_resource type="Script" path="res://addons/rokojori_action_library/Runtime/Animation/HDRColor.cs" id="1_yrhv1"] -[ext_resource type="Script" path="res://addons/rokojori_action_library/Runtime/Animation/AnimationCurve.cs" id="2_cdv3p"] -[ext_resource type="Script" path="res://addons/rokojori_action_library/Runtime/Animation/Flash/FlashEffect.cs" id="3_87ql1"] +[ext_resource type="Script" uid="uid://dncqth3uf3tb3" path="res://addons/rokojori_action_library/Runtime/Animation/HDRColor.cs" id="1_yrhv1"] +[ext_resource type="Script" uid="uid://c5tm02yj1bhhx" path="res://addons/rokojori_action_library/Runtime/Animation/AnimationCurve.cs" id="2_cdv3p"] +[ext_resource type="Script" uid="uid://cupnq55n3nimc" path="res://addons/rokojori_action_library/Runtime/Animation/Flash/FlashEffect.cs" id="3_87ql1"] [ext_resource type="Resource" uid="uid://ch5nsa6yafs5l" path="res://addons/rokojori_action_library/Runtime/Time/TimeLines/GameTime.tres" id="4_2na64"] [sub_resource type="Resource" id="Resource_54hj8"] diff --git a/Runtime/Animation/Flash/Presets/Orange Boost - Flash.tres b/Runtime/Animation/Flash/Presets/Orange Boost - Flash.tres index bc6e5f0..32506f6 100644 --- a/Runtime/Animation/Flash/Presets/Orange Boost - Flash.tres +++ b/Runtime/Animation/Flash/Presets/Orange Boost - Flash.tres @@ -1,8 +1,8 @@ [gd_resource type="Resource" script_class="FlashEffect" load_steps=8 format=3 uid="uid://d06w8jorebto2"] -[ext_resource type="Script" path="res://addons/rokojori_action_library/Runtime/Animation/HDRColor.cs" id="1_c8lnw"] -[ext_resource type="Script" path="res://addons/rokojori_action_library/Runtime/Animation/AnimationCurve.cs" id="2_w323b"] -[ext_resource type="Script" path="res://addons/rokojori_action_library/Runtime/Animation/Flash/FlashEffect.cs" id="3_eqd4c"] +[ext_resource type="Script" uid="uid://dncqth3uf3tb3" path="res://addons/rokojori_action_library/Runtime/Animation/HDRColor.cs" id="1_c8lnw"] +[ext_resource type="Script" uid="uid://c5tm02yj1bhhx" path="res://addons/rokojori_action_library/Runtime/Animation/AnimationCurve.cs" id="2_w323b"] +[ext_resource type="Script" uid="uid://cupnq55n3nimc" path="res://addons/rokojori_action_library/Runtime/Animation/Flash/FlashEffect.cs" id="3_eqd4c"] [ext_resource type="Resource" uid="uid://ch5nsa6yafs5l" path="res://addons/rokojori_action_library/Runtime/Time/TimeLines/GameTime.tres" id="4_cs6ks"] [sub_resource type="Resource" id="Resource_ny3sx"] diff --git a/Runtime/Animation/Flash/Presets/Red Hit - Flash.tres b/Runtime/Animation/Flash/Presets/Red Hit - Flash.tres index d403e69..9d2f016 100644 --- a/Runtime/Animation/Flash/Presets/Red Hit - Flash.tres +++ b/Runtime/Animation/Flash/Presets/Red Hit - Flash.tres @@ -1,8 +1,8 @@ [gd_resource type="Resource" script_class="FlashEffect" load_steps=8 format=3 uid="uid://cwdnm658q3jta"] -[ext_resource type="Script" path="res://addons/rokojori_action_library/Runtime/Animation/HDRColor.cs" id="1_nmdum"] -[ext_resource type="Script" path="res://addons/rokojori_action_library/Runtime/Animation/AnimationCurve.cs" id="2_0sgd7"] -[ext_resource type="Script" path="res://addons/rokojori_action_library/Runtime/Animation/Flash/FlashEffect.cs" id="3_7qcuh"] +[ext_resource type="Script" uid="uid://dncqth3uf3tb3" path="res://addons/rokojori_action_library/Runtime/Animation/HDRColor.cs" id="1_nmdum"] +[ext_resource type="Script" uid="uid://c5tm02yj1bhhx" path="res://addons/rokojori_action_library/Runtime/Animation/AnimationCurve.cs" id="2_0sgd7"] +[ext_resource type="Script" uid="uid://cupnq55n3nimc" path="res://addons/rokojori_action_library/Runtime/Animation/Flash/FlashEffect.cs" id="3_7qcuh"] [ext_resource type="Resource" uid="uid://ch5nsa6yafs5l" path="res://addons/rokojori_action_library/Runtime/Time/TimeLines/GameTime.tres" id="4_rkq1j"] [sub_resource type="Resource" id="Resource_54hj8"] diff --git a/Runtime/Animation/Flash/Presets/White Blinking - Flash.tres b/Runtime/Animation/Flash/Presets/White Blinking - Flash.tres index 4a74d84..145451a 100644 --- a/Runtime/Animation/Flash/Presets/White Blinking - Flash.tres +++ b/Runtime/Animation/Flash/Presets/White Blinking - Flash.tres @@ -1,8 +1,8 @@ [gd_resource type="Resource" script_class="FlashEffect" load_steps=8 format=3 uid="uid://pok7bfoksfmr"] -[ext_resource type="Script" path="res://addons/rokojori_action_library/Runtime/Animation/HDRColor.cs" id="1_pp4qy"] -[ext_resource type="Script" path="res://addons/rokojori_action_library/Runtime/Animation/AnimationCurve.cs" id="2_f6f0o"] -[ext_resource type="Script" path="res://addons/rokojori_action_library/Runtime/Animation/Flash/FlashEffect.cs" id="3_dq1j1"] +[ext_resource type="Script" uid="uid://dncqth3uf3tb3" path="res://addons/rokojori_action_library/Runtime/Animation/HDRColor.cs" id="1_pp4qy"] +[ext_resource type="Script" uid="uid://c5tm02yj1bhhx" path="res://addons/rokojori_action_library/Runtime/Animation/AnimationCurve.cs" id="2_f6f0o"] +[ext_resource type="Script" uid="uid://cupnq55n3nimc" path="res://addons/rokojori_action_library/Runtime/Animation/Flash/FlashEffect.cs" id="3_dq1j1"] [ext_resource type="Resource" uid="uid://ch5nsa6yafs5l" path="res://addons/rokojori_action_library/Runtime/Time/TimeLines/GameTime.tres" id="4_d6hj6"] [sub_resource type="Resource" id="Resource_ny3sx"] diff --git a/Runtime/Animation/Highlight/Presets/White Outline - Highlight.tres b/Runtime/Animation/Highlight/Presets/White Outline - Highlight.tres index dfb47fd..ccd1361 100644 --- a/Runtime/Animation/Highlight/Presets/White Outline - Highlight.tres +++ b/Runtime/Animation/Highlight/Presets/White Outline - Highlight.tres @@ -1,7 +1,7 @@ [gd_resource type="Resource" script_class="HighlightEffect" load_steps=7 format=3 uid="uid://dadr1kd14m7g3"] -[ext_resource type="Script" path="res://addons/rokojori_action_library/Runtime/Animation/HDRColor.cs" id="1_sk831"] -[ext_resource type="Script" path="res://addons/rokojori_action_library/Runtime/Animation/Highlight/HighlightEffect.cs" id="2_pq63c"] +[ext_resource type="Script" uid="uid://dncqth3uf3tb3" path="res://addons/rokojori_action_library/Runtime/Animation/HDRColor.cs" id="1_sk831"] +[ext_resource type="Script" uid="uid://dkbln8rf5p0pu" path="res://addons/rokojori_action_library/Runtime/Animation/Highlight/HighlightEffect.cs" id="2_pq63c"] [ext_resource type="Resource" uid="uid://h6oi6vkj4c2m" path="res://addons/rokojori_action_library/Runtime/Time/TimeLines/RealTime.tres" id="3_8mahg"] [sub_resource type="Resource" id="Resource_27v41"] diff --git a/Runtime/Animation/Shake/Presets/Mini Poke - Shake.tres b/Runtime/Animation/Shake/Presets/Mini Poke - Shake.tres index 14cb1d7..367d09a 100644 --- a/Runtime/Animation/Shake/Presets/Mini Poke - Shake.tres +++ b/Runtime/Animation/Shake/Presets/Mini Poke - Shake.tres @@ -1,7 +1,7 @@ [gd_resource type="Resource" script_class="ShakeEffect" load_steps=8 format=3 uid="uid://begmg64jiaoq0"] -[ext_resource type="Script" path="res://addons/rokojori_action_library/Runtime/Animation/Shake/ShakeEffect.cs" id="1_gbi52"] -[ext_resource type="Script" path="res://addons/rokojori_action_library/Runtime/Animation/AnimationCurve.cs" id="2_g6huw"] +[ext_resource type="Script" uid="uid://bec6skfqkb2ci" path="res://addons/rokojori_action_library/Runtime/Animation/Shake/ShakeEffect.cs" id="1_gbi52"] +[ext_resource type="Script" uid="uid://c5tm02yj1bhhx" path="res://addons/rokojori_action_library/Runtime/Animation/AnimationCurve.cs" id="2_g6huw"] [ext_resource type="Resource" uid="uid://h6oi6vkj4c2m" path="res://addons/rokojori_action_library/Runtime/Time/TimeLines/RealTime.tres" id="3_pgufg"] [sub_resource type="Curve" id="Curve_j2uji"] @@ -19,7 +19,7 @@ scaleY = 1.0 scaleRandomRange = 0.0 [sub_resource type="Curve" id="Curve_c1l7g"] -min_value = -1.0 +_limits = [-1.0, 1.0, 0.0, 1.0] _data = [Vector2(0, 1), 0.0, 0.0, 0, 1, Vector2(1, 1), 0.0, 0.0, 1, 0] point_count = 2 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 f27b2c6..d3b3b1e 100644 --- a/Runtime/Animation/Shake/Presets/Small Impact Low FPS - Shake.tres +++ b/Runtime/Animation/Shake/Presets/Small Impact Low FPS - Shake.tres @@ -1,7 +1,7 @@ [gd_resource type="Resource" script_class="ShakeEffect" load_steps=8 format=3 uid="uid://c2wbn25rxynk8"] -[ext_resource type="Script" path="res://addons/rokojori_action_library/Runtime/Animation/Shake/ShakeEffect.cs" id="1_68es8"] -[ext_resource type="Script" path="res://addons/rokojori_action_library/Runtime/Animation/AnimationCurve.cs" id="2_wfmv2"] +[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"] [sub_resource type="Curve" id="Curve_j2uji"] diff --git a/Runtime/Procedural/Parametric/Plane/ClipMapPlaneMeshType.cs b/Runtime/Procedural/Parametric/Plane/ClipMapPlaneMeshType.cs new file mode 100644 index 0000000..4ead8a0 --- /dev/null +++ b/Runtime/Procedural/Parametric/Plane/ClipMapPlaneMeshType.cs @@ -0,0 +1,79 @@ +using System.Collections; +using System.Collections.Generic; +using Godot; +using System; + + + +namespace Rokojori +{ + [Tool] + [GlobalClass] + public partial class ClipMapPlaneMeshType:__PlaneMeshType__ + { + [Export] + public float maxCellSize = 100; + + [Export] + public float minCellSize = 10; + + [Export] + public Curve cellSizeOverDistance = MathX.Curve( 0, 1 ); + + + public override MeshGeometry GetMeshGeometry( float sizeX, float sizeZ ) + { + var xUnits = Mathf.Ceil( ( sizeX / 2 ) / maxCellSize ) * 2; + var zUnits = Mathf.Ceil( ( sizeZ / 2 ) / maxCellSize ) * 2; + + var mg = new MeshGeometry(); + + var size = new Vector2( xUnits * maxCellSize, zUnits * maxCellSize ); + var offset = size / -2f; + var maxDistance = offset.Length(); + + this.LogInfo( xUnits, zUnits ); + + for ( int i = 0; i < xUnits; i++ ) + { + for ( int j = 0; j < zUnits; j++ ) + { + var c = offset + new Vector2( i * maxCellSize, j * maxCellSize ); + var s = c.Length() / maxDistance; + + if ( cellSizeOverDistance != null ) + { + s = cellSizeOverDistance.Sample( s ); + } + + s = Mathf.Lerp( minCellSize, maxCellSize, s ); + + Add( mg, c, s ); + + } + } + + + + return mg; + } + + void Add( MeshGeometry mg, Vector2 center, float cellSize ) + { + var numDivisions = Mathf.CeilToInt( maxCellSize / cellSize ); + + var sectionMG = MeshGeometry.CreateFromUVFunction( + ( uv ) => + { + var pose = new Pose(); + + return pose; + + }, + numDivisions, numDivisions + ); + + mg.Add( sectionMG ); + } + } +} \ No newline at end of file diff --git a/Runtime/Procedural/Parametric/Plane/ClipMapPlaneMeshType.cs.uid b/Runtime/Procedural/Parametric/Plane/ClipMapPlaneMeshType.cs.uid new file mode 100644 index 0000000..586d75c --- /dev/null +++ b/Runtime/Procedural/Parametric/Plane/ClipMapPlaneMeshType.cs.uid @@ -0,0 +1 @@ +uid://cglc3w2xqcm1r diff --git a/Runtime/Procedural/Parametric/Plane/Plane.cs b/Runtime/Procedural/Parametric/Plane/Plane.cs new file mode 100644 index 0000000..a422cbf --- /dev/null +++ b/Runtime/Procedural/Parametric/Plane/Plane.cs @@ -0,0 +1,75 @@ +using System.Collections; +using System.Collections.Generic; +using Godot; +using System; + +namespace Rokojori +{ + [Tool] + [GlobalClass] + public partial class Plane:Node3D + { + [Export] + public float width { get => _width; set { _width = value; UpdateMesh(); } } + float _width = 200; + + + [Export] + public float height { get => _height; set { _height = value; UpdateMesh(); } } + float _height = 200; + + + [Export] + public __PlaneMeshType__ type { get => _type; set { _type = value; UpdateMesh(); } } + __PlaneMeshType__ _type; + + [Export] + public Material material; + + [Export] + public MeshInstance3D outputMesh; + + + [Export] + public bool initialized + { + get => _initialized; + set { if ( _initialized ) { return; } _initialized = true; UpdateMesh(); } + } + + bool _initialized; + + void UpdateMesh() + { + if ( ! _initialized ) + { + return; + } + + if ( _type == null ) + { + return; + } + + this.LogInfo( "Creating mesh" ); + + var mg = _type.GetMeshGeometry( width, height ); + + if ( outputMesh == null ) + { + outputMesh = this.CreateChild(); + } + + outputMesh.Mesh = mg.GenerateMesh(); + + if ( material != null ) + { + Materials.Set( outputMesh, material ); + } + + this.LogInfo( material, outputMesh, outputMesh.Mesh ); + + } + + } +} \ No newline at end of file diff --git a/Runtime/Procedural/Parametric/Plane/Plane.cs.uid b/Runtime/Procedural/Parametric/Plane/Plane.cs.uid new file mode 100644 index 0000000..021392d --- /dev/null +++ b/Runtime/Procedural/Parametric/Plane/Plane.cs.uid @@ -0,0 +1 @@ +uid://cqpri6uy5n2bg diff --git a/Runtime/Procedural/Parametric/Plane/__PlaneMeshType__.cs b/Runtime/Procedural/Parametric/Plane/__PlaneMeshType__.cs new file mode 100644 index 0000000..a29bcbd --- /dev/null +++ b/Runtime/Procedural/Parametric/Plane/__PlaneMeshType__.cs @@ -0,0 +1,19 @@ +using System.Collections; +using System.Collections.Generic; +using Godot; +using System; + + + +namespace Rokojori +{ + [Tool] + [GlobalClass] + public partial class __PlaneMeshType__:Resource + { + public virtual MeshGeometry GetMeshGeometry( float width, float height ) + { + return null; + } + } +} \ No newline at end of file diff --git a/Runtime/Procedural/Parametric/Plane/__PlaneMeshType__.cs.uid b/Runtime/Procedural/Parametric/Plane/__PlaneMeshType__.cs.uid new file mode 100644 index 0000000..dcccae7 --- /dev/null +++ b/Runtime/Procedural/Parametric/Plane/__PlaneMeshType__.cs.uid @@ -0,0 +1 @@ +uid://b12qi80x6nyic diff --git a/Runtime/Procedural/Parametric/Spline/SplinePoint.cs b/Runtime/Procedural/Parametric/Spline/SplinePoint.cs index 0894915..4bb1eb9 100644 --- a/Runtime/Procedural/Parametric/Spline/SplinePoint.cs +++ b/Runtime/Procedural/Parametric/Spline/SplinePoint.cs @@ -68,7 +68,7 @@ namespace Rokojori public void SetHandle( EditorNode3DGizmo gizmo, int id, bool secondary, Camera3D camera, Vector2 point ) { - var xzPlane = new Plane( Vector3.Up, startDragPosition); + var xzPlane = new Godot.Plane( Vector3.Up, startDragPosition ); var cameraDirection = camera.ProjectLocalRayNormal( point ); var intersection = xzPlane.IntersectsRay( camera.GlobalPosition, cameraDirection );