From a02cce81085ea16fdeea6469ebeb06e7b215fd1a Mon Sep 17 00:00:00 2001 From: Josef Date: Sun, 19 May 2024 18:00:51 +0200 Subject: [PATCH] TimeLines, Virtual Cameras --- Scenes/Main/CameraRotation.cs | 5 + .../Post Processing Material.tres | 10 +- Scenes/Main/TimeLines/GameTime.tres | 4 + Scenes/Main/TimeLines/RealTime.tres | 4 + Scenes/Main/main.tscn | 176 ++++++++++++++---- Scripts/Rokojori/Rokojori-Action-Library | 2 +- project.godot | 25 +++ 7 files changed, 184 insertions(+), 42 deletions(-) create mode 100644 Scenes/Main/TimeLines/GameTime.tres create mode 100644 Scenes/Main/TimeLines/RealTime.tres diff --git a/Scenes/Main/CameraRotation.cs b/Scenes/Main/CameraRotation.cs index bfb2c13..bf24185 100644 --- a/Scenes/Main/CameraRotation.cs +++ b/Scenes/Main/CameraRotation.cs @@ -27,6 +27,11 @@ namespace Rokojori public override void _Process( double delta ) { + if ( camera == null ) + { + return; + } + yaw += (float) delta * yawSpeed; yaw = MathX.Repeat( yaw, 360 ); diff --git a/Scenes/Main/Post Processing/Post Processing Material.tres b/Scenes/Main/Post Processing/Post Processing Material.tres index a7b8ed8..a895cc5 100644 --- a/Scenes/Main/Post Processing/Post Processing Material.tres +++ b/Scenes/Main/Post Processing/Post Processing Material.tres @@ -4,15 +4,15 @@ [sub_resource type="Curve" id="Curve_72bdg"] bake_resolution = 256 -_data = [Vector2(0, 0), 0.934966, 0.318872, 0, 0, Vector2(0.171975, 0.237113), 0.764319, 0.764319, 0, 0, Vector2(0.745223, 0.731959), 1.14794, 1.14794, 0, 0, Vector2(1, 1), 0.167437, 0.662796, 0, 0] -point_count = 4 +_data = [Vector2(0, 0), 0.934966, 2.22274, 0, 0, Vector2(0.521657, 0.504516), 0.912491, 0.912491, 0, 0, Vector2(1, 1), 1.84965, 0.662796, 0, 0] +point_count = 3 [sub_resource type="CurveTexture" id="CurveTexture_1xu1n"] curve = SubResource("Curve_72bdg") [sub_resource type="Curve" id="Curve_l5ikv"] bake_resolution = 256 -_data = [Vector2(0, 0.659794), 0.0, 1.51065, 0, 0, Vector2(0.33758, 0.742268), -0.539519, -0.539519, 0, 0, Vector2(0.700637, 0.494845), -0.61886, -0.61886, 0, 0, Vector2(1, 0.268041), -0.79508, 0.0, 0, 0] +_data = [Vector2(0, 0.785195), 0.0, 1.47857, 0, 0, Vector2(0.303201, 0.882573), -0.453976, -0.453976, 0, 0, Vector2(0.59322, 0.55607), -0.61886, -0.61886, 0, 0, Vector2(1, 0), -2.41143, 0.0, 0, 0] point_count = 4 [sub_resource type="CurveTexture" id="CurveTexture_bljsk"] @@ -23,9 +23,9 @@ shader = ExtResource("1_t3jqc") shader_parameter/distortionSpread = 0.0 shader_parameter/distortionOffset = 0.0 shader_parameter/saturationMultiply = 1.05 -shader_parameter/effectStrength = 1.0 +shader_parameter/effectStrength = 0.488 shader_parameter/vignetteStrength = 0.595 -shader_parameter/vignetteSize = 0.772 +shader_parameter/vignetteSize = 0.912 shader_parameter/vignetteSmoothnes = 7.257 shader_parameter/vignetteColor = Vector4(0.06, 0.24, 0.68, 0) shader_parameter/vignetteOffset = 0.1 diff --git a/Scenes/Main/TimeLines/GameTime.tres b/Scenes/Main/TimeLines/GameTime.tres new file mode 100644 index 0000000..612d6b5 --- /dev/null +++ b/Scenes/Main/TimeLines/GameTime.tres @@ -0,0 +1,4 @@ +[gd_resource type="RJTimeLine" format=3 uid="uid://tcd6shqgnegq"] + +[resource] +autoStart = true diff --git a/Scenes/Main/TimeLines/RealTime.tres b/Scenes/Main/TimeLines/RealTime.tres new file mode 100644 index 0000000..acff0a7 --- /dev/null +++ b/Scenes/Main/TimeLines/RealTime.tres @@ -0,0 +1,4 @@ +[gd_resource type="RJTimeLine" format=3 uid="uid://bkjk4tcrqmmvv"] + +[resource] +autoStart = true diff --git a/Scenes/Main/main.tscn b/Scenes/Main/main.tscn index 3d280ee..e2dd704 100644 --- a/Scenes/Main/main.tscn +++ b/Scenes/Main/main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=23 format=4 uid="uid://i7w8ikjtrf50"] +[gd_scene load_steps=31 format=4 uid="uid://i7w8ikjtrf50"] [ext_resource type="Script" path="res://Scripts/Rokojori/Rokojori-Action-Library/Runtime/Actions/OnReady.cs" id="1_yccmv"] [ext_resource type="Script" path="res://Scripts/Rokojori/Rokojori-Action-Library/Runtime/Actions/ActionList.cs" id="2_700ed"] @@ -9,35 +9,23 @@ [ext_resource type="Script" path="res://Scripts/Rokojori/Rokojori-Action-Library/Runtime/Sensors/OnSensor.cs" id="5_2svkf"] [ext_resource type="Script" path="res://Scripts/Rokojori/Rokojori-Action-Library/Runtime/Actions/Delay.cs" id="5_dxi60"] [ext_resource type="Sky" uid="uid://bh5lty4gkpl05" path="res://Scenes/Main/Sky/Sky.tres" id="6_j62u8"] -[ext_resource type="Script" path="res://Scripts/Rokojori/Rokojori-Action-Library/Runtime/Actions/GDDelay.gd" id="6_k5tdq"] +[ext_resource type="Script" path="res://Scripts/Rokojori/Rokojori-Action-Library/Runtime/Actions/ActionReference.cs" id="6_yjmna"] [ext_resource type="Material" uid="uid://boee6yoxxqlh4" path="res://Scenes/Main/Sphere/SphereMaterial.tres" id="7_4bw4m"] [ext_resource type="Script" path="res://Scripts/Rokojori/Rokojori-Action-Library/Runtime/Actions/LoadScene.cs" id="7_812j6"] [ext_resource type="Material" uid="uid://bonr80mq4fvdt" path="res://Scenes/Main/Ground/forrest_ground_01_4k.gltf/textures/Forest Ground.tres" id="7_nxv8j"] +[ext_resource type="Script" path="res://Scripts/Rokojori/Rokojori-Action-Library/Runtime/Time/TimeLineManager.cs" id="8_1dfex"] [ext_resource type="Script" path="res://Scenes/Main/CameraRotation.cs" id="8_32a5r"] +[ext_resource type="RJTimeLine" uid="uid://tcd6shqgnegq" path="res://Scenes/Main/TimeLines/GameTime.tres" id="8_aoohl"] +[ext_resource type="RJTimeLine" uid="uid://bkjk4tcrqmmvv" path="res://Scenes/Main/TimeLines/RealTime.tres" id="9_g5col"] [ext_resource type="Material" uid="uid://b80wiio2w25qh" path="res://Scenes/Main/Cube/Red.tres" id="10_1p0wn"] +[ext_resource type="Script" path="res://Scripts/Rokojori/Rokojori-Action-Library/Runtime/Time/TimeLineScheduler.cs" id="11_0el58"] [ext_resource type="Material" uid="uid://bpl7mn4afiypj" path="res://Scenes/Main/Cube/OrangeCube.tres" id="11_aafwq"] [ext_resource type="Script" path="res://Scripts/Doc-Generator/CreateDoc.cs" id="12_lgfge"] +[ext_resource type="Script" path="res://Scripts/Rokojori/Rokojori-Action-Library/Runtime/VirtualCameras/VirtualCamera3DSlot.cs" id="13_mtnhw"] +[ext_resource type="Script" path="res://Scripts/Rokojori/Rokojori-Action-Library/Runtime/VirtualCameras/VirtualCamera3DManager.cs" id="13_ncewi"] +[ext_resource type="Script" path="res://Scripts/Rokojori/Rokojori-Action-Library/Runtime/VirtualCameras/FollowCamera3D.cs" id="14_5vi0f"] [ext_resource type="Script" path="res://Scenes/Main/PlaceRandomly.cs" id="17_7nlb0"] - -[sub_resource type="Environment" id="Environment_ac8gh"] -background_mode = 2 -sky = ExtResource("6_j62u8") -tonemap_white = 2.0 -ssao_enabled = true -ssao_radius = 0.75 -ssao_intensity = 4.0 -ssao_power = 1.60766 -ssao_detail = 0.71 -ssao_horizon = 0.07 -ssao_sharpness = 1.0 -ssao_light_affect = 1.0 -ssao_ao_channel_affect = 1.0 -glow_enabled = true -fog_enabled = true -fog_light_color = Color(0.684557, 0.757645, 0.85301, 1) -fog_sun_scatter = 0.01 -fog_density = 0.005 -fog_sky_affect = 0.0 +[ext_resource type="Script" path="res://Scripts/Rokojori/Rokojori-Action-Library/Runtime/VirtualCameras/MouseEditorCamera.cs" id="18_ix51h"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_5npgd"] @@ -73,6 +61,36 @@ _surfaces = [{ blend_shape_mode = 0 shadow_mesh = SubResource("ArrayMesh_84g0c") +[sub_resource type="Environment" id="Environment_ac8gh"] +background_mode = 2 +sky = ExtResource("6_j62u8") +tonemap_white = 2.0 +ssr_enabled = true +ssr_max_steps = 32 +ssr_fade_in = 0.310579 +ssr_fade_out = 3.4822 +ssr_depth_tolerance = 15.41 +ssao_enabled = true +ssao_radius = 0.5 +ssao_power = 2.0 +ssao_detail = 0.0 +ssao_horizon = 0.0 +ssao_sharpness = 0.0 +ssao_light_affect = 1.0 +ssao_ao_channel_affect = 1.0 +ssil_enabled = true +ssil_radius = 1.0 +ssil_intensity = 2.0 +ssil_sharpness = 1.0 +ssil_normal_rejection = 0.51 +glow_enabled = true +fog_enabled = true +fog_light_color = Color(0.684557, 0.757645, 0.85301, 1) +fog_sun_scatter = 0.01 +fog_density = 0.005 +fog_sky_affect = 0.0 +adjustment_enabled = true + [node name="Main" type="Node3D"] [node name="App" type="Node" parent="."] @@ -93,32 +111,99 @@ message = "I'm Ready" script = ExtResource("4_e7y33") actions = [] -[node name="GDDelay" type="RJSequenceAction" parent="App/OnReady/InitializeAsync"] -script = ExtResource("6_k5tdq") -message = "GD" - -[node name="Hello 3" type="RJSequenceAction" parent="App/OnReady/InitializeAsync"] -script = ExtResource("5_dxi60") -duration = 1.0 -message = "H3" - -[node name="Hello 2" type="RJSequenceAction" parent="App/OnReady/InitializeAsync"] +[node name="Wait 1" type="RJSequenceAction" parent="App/OnReady/InitializeAsync"] script = ExtResource("5_dxi60") duration = 1.0 message = "H2" +[node name="Set Cube 3 Camera" type="RJAction" parent="App/OnReady/InitializeAsync" node_paths=PackedStringArray("referencedAction")] +script = ExtResource("6_yjmna") +referencedAction = NodePath("../../../../Camera Rig/VirtualCamera3DManager/Follow Cube 3") + +[node name="Wait 2" type="RJSequenceAction" parent="App/OnReady/InitializeAsync"] +script = ExtResource("5_dxi60") +duration = 1.0 +message = "H2" + +[node name="Set Cube 2 Camera" type="RJAction" parent="App/OnReady/InitializeAsync" node_paths=PackedStringArray("referencedAction")] +script = ExtResource("6_yjmna") +referencedAction = NodePath("../../../../Camera Rig/VirtualCamera3DManager/Follow Cube 2") + [node name="LoadScene" type="RJSequenceAction" parent="App/OnReady/InitializeAsync" node_paths=PackedStringArray("target", "onLoaded")] script = ExtResource("7_812j6") scenePath = "res://Scenes/Boxes.tscn" target = NodePath("../../../../Level/Target") onLoaded = NodePath("../../../../Level/PlaceRandomly") +[node name="TimeLineManager" type="RJTimeLineManager" parent="App"] +script = ExtResource("8_1dfex") +timeLines = Array[RJTimeLine]([ExtResource("9_g5col"), ExtResource("8_aoohl")]) + +[node name="TimeLineScheduler" type="Node" parent="App/TimeLineManager"] +script = ExtResource("11_0el58") + [node name="UI" type="Node" parent="."] [node name="Camera Rig" type="Node" parent="."] [node name="Camera3D" type="Camera3D" parent="Camera Rig"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 4) +transform = Transform3D(-0.997666, -0.000137031, 0.0682764, 1.60071e-10, 0.999998, 0.00200701, -0.0682766, 0.00200232, -0.997664, -1.97626, 7.36922, -8.17166) + +[node name="Cube5" type="MeshInstance3D" parent="Camera Rig/Camera3D"] +transform = Transform3D(0.1, -9.31333e-10, 1.11759e-07, 9.31329e-10, 0.1, 7.68381e-08, -2.23519e-08, -1.53676e-08, 0.5, 0, 0, -0.5) +material_override = ExtResource("11_aafwq") +extra_cull_margin = 50.0 +mesh = SubResource("ArrayMesh_hfjcl") +skeleton = NodePath("") + +[node name="VirtualCamera3DManager" type="RJVirtualCamera3DManager" parent="Camera Rig" node_paths=PackedStringArray("camera")] +cameraPrioritySmoothingCoefficient = 0.05 +script = ExtResource("13_ncewi") +camera = NodePath("../Camera3D") + +[node name="Follow Cube 3" type="RJAction" parent="Camera Rig/VirtualCamera3DManager" node_paths=PackedStringArray("camera")] +script = ExtResource("13_mtnhw") +camera = NodePath("../../Follow Cube 3") + +[node name="Follow Cube 2" type="RJAction" parent="Camera Rig/VirtualCamera3DManager" node_paths=PackedStringArray("camera")] +script = ExtResource("13_mtnhw") +camera = NodePath("../../Follow Cube 2") + +[node name="Mouse Editor Camera" type="RJAction" parent="Camera Rig/VirtualCamera3DManager" node_paths=PackedStringArray("camera")] +script = ExtResource("13_mtnhw") +camera = NodePath("../../MouseEditorCamera") +priority = 1.0 + +[node name="Follow Cube 3" type="RJVirtualCamera3D" parent="Camera Rig" node_paths=PackedStringArray("target")] +transform = Transform3D(0.998556, -1.0122e-07, -0.0530693, -3.76575e-13, 0.999928, -1.90724e-06, 0.0530706, 1.90452e-06, 0.998532, 6.2834, 2.72301, -1.60043) +script = ExtResource("14_5vi0f") +target = NodePath("../../Level/Cube3") + +[node name="Follow Cube 2" type="RJVirtualCamera3D" parent="Camera Rig" node_paths=PackedStringArray("target")] +transform = Transform3D(-0.464403, -0.213594, -0.859417, -7.45032e-09, 0.970406, -0.241185, 0.885585, -0.112009, -0.45068, 2.62978, 1.69766, -3.5164) +script = ExtResource("14_5vi0f") +target = NodePath("../../Level/Cube2") + +[node name="MouseEditorCamera" type="RJVirtualCamera3D" parent="Camera Rig" node_paths=PackedStringArray("orbitButton", "orbitModifierButtons", "panButton", "panModifierButtons", "zoomInButton", "zoomInModifierButtons", "zoomOutButton", "zoomOutModifierButtons")] +transform = Transform3D(0.997654, -0.000137016, -0.0682755, 0, 0.999827, -0.0020071, 0.0682756, 0.0020021, 0.997652, -1.97626, 7.36922, -8.17166) +script = ExtResource("18_ix51h") +target = Vector3(-2.8, 7.345, 3.865) +yaw = -3.915 +pitch = 0.115 +distance = 12.065 +yawSpeed = -0.2 +pitchSpeed = 0.2 +minPitch = 0.0 +orbitButton = NodePath("../../Interactions/Testing/Mouse Button Right") +orbitModifierButtons = [] +panSpeedX = 0.002 +panSpeedY = 0.002 +panButton = NodePath("../../Interactions/Testing/Mouse Button Middle") +panModifierButtons = [] +zoomInButton = NodePath("../../Interactions/Testing/Wheel Down") +zoomInModifierButtons = [] +zoomOutButton = NodePath("../../Interactions/Testing/Wheel Up") +zoomOutModifierButtons = [] [node name="ColorRect" type="ColorRect" parent="Camera Rig"] material = ExtResource("4_nld4j") @@ -128,9 +213,8 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -[node name="CameraRotation" type="Node" parent="Camera Rig" node_paths=PackedStringArray("camera", "target")] +[node name="CameraRotation" type="Node" parent="Camera Rig" node_paths=PackedStringArray("target")] script = ExtResource("8_32a5r") -camera = NodePath("../Camera3D") target = NodePath("../../Level/Sphere2") yawSpeed = 20.0 pitch = -27.63 @@ -144,6 +228,26 @@ distance = 5.66 script = ExtResource("4_n75gv") inputActionName = "Jump" +[node name="Mouse Button Right" type="RJSensor" parent="Interactions/Testing"] +script = ExtResource("4_n75gv") +inputActionName = "MouseButtonRight" + +[node name="Mouse Button Middle" type="RJSensor" parent="Interactions/Testing"] +script = ExtResource("4_n75gv") +inputActionName = "MouseButtonMiddle" + +[node name="Wheel Up" type="RJSensor" parent="Interactions/Testing"] +script = ExtResource("4_n75gv") +inputActionName = "WheelUp" +pollAsButton = true +pollAsReleasedOnly = true + +[node name="Wheel Down" type="RJSensor" parent="Interactions/Testing"] +script = ExtResource("4_n75gv") +inputActionName = "WheelDown" +pollAsButton = true +pollAsReleasedOnly = true + [node name="OnSensor" type="Node" parent="Interactions/Testing" node_paths=PackedStringArray("sensor", "onStart")] script = ExtResource("5_2svkf") sensor = NodePath("../Jump") @@ -213,7 +317,7 @@ mesh = SubResource("ArrayMesh_hfjcl") skeleton = NodePath("") [node name="Cube3" type="MeshInstance3D" parent="Level"] -transform = Transform3D(0.389297, 0, 0.313764, 0, 0.5, 0, -0.313764, 0, 0.389297, 2.30825, 0.5, -4.76624) +transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 6.01882, 2.723, 3.37783) material_override = ExtResource("11_aafwq") extra_cull_margin = 50.0 mesh = SubResource("ArrayMesh_hfjcl") diff --git a/Scripts/Rokojori/Rokojori-Action-Library b/Scripts/Rokojori/Rokojori-Action-Library index a383c5d..0e4f09e 160000 --- a/Scripts/Rokojori/Rokojori-Action-Library +++ b/Scripts/Rokojori/Rokojori-Action-Library @@ -1 +1 @@ -Subproject commit a383c5da496e1be9e6d2ee641a984d76edd613ff +Subproject commit 0e4f09e19cee9d4590a3e085df0658ad62fd0755 diff --git a/project.godot b/project.godot index 4232a74..03c0173 100644 --- a/project.godot +++ b/project.godot @@ -30,6 +30,31 @@ Jump={ "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null) ] } +MouseButtonRight={ +"deadzone": 0.5, +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":2,"position":Vector2(263, 28),"global_position":Vector2(269, 90),"factor":1.0,"button_index":2,"canceled":false,"pressed":true,"double_click":false,"script":null) +] +} +MouseButtonLeft={ +"deadzone": 0.5, +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(196, 15),"global_position":Vector2(202, 77),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null) +] +} +MouseButtonMiddle={ +"deadzone": 0.5, +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":4,"position":Vector2(271, 30),"global_position":Vector2(277, 92),"factor":1.0,"button_index":3,"canceled":false,"pressed":true,"double_click":false,"script":null) +] +} +WheelUp={ +"deadzone": 0.0, +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":4,"canceled":false,"pressed":false,"double_click":false,"script":null) +] +} +WheelDown={ +"deadzone": 0.0, +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":5,"canceled":false,"pressed":false,"double_click":false,"script":null) +] +} [rendering]