diff --git a/src/player/shot_setup/shot_setup.tscn b/src/player/shot_setup/shot_setup.tscn index d8e9c68..7ecba9b 100644 --- a/src/player/shot_setup/shot_setup.tscn +++ b/src/player/shot_setup/shot_setup.tscn @@ -45,6 +45,21 @@ streams_count = 2 stream_0/stream = ExtResource("11_i5g55") stream_1/stream = ExtResource("12_0losp") +[sub_resource type="Animation" id="Animation_ll5da"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("AudioStreamPlayer3D:playing") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [false] +} + [sub_resource type="Animation" id="Animation_dlkgq"] resource_name = "death" length = 8.0 @@ -140,21 +155,6 @@ tracks/5/keys = { "values": [true] } -[sub_resource type="Animation" id="Animation_ll5da"] -length = 0.001 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("AudioStreamPlayer3D:playing") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [false] -} - [sub_resource type="AnimationLibrary" id="AnimationLibrary_kc803"] _data = { "RESET": SubResource("Animation_ll5da"), @@ -574,8 +574,8 @@ unique_name_in_owner = true transform = Transform3D(1, 0, 0, 0, 0.707107, -0.707107, 0, 0.707107, 0.707107, 0, -0.02, 0) visible = false initial_speed = 50.0 -time_step = 0.01 -max_steps = 800 +time_step = 0.1 +max_steps = 100 [node name="ProjectedTarget" parent="ArrowPivot/ShotProjection" instance=ExtResource("6_mynqj")] diff --git a/src/shaders/desaturate.gdshader b/src/shaders/desaturate.gdshader index 73f08f4..cbe528c 100644 --- a/src/shaders/desaturate.gdshader +++ b/src/shaders/desaturate.gdshader @@ -8,7 +8,7 @@ uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_n void fragment() { vec4 source = texture(screen_texture, SCREEN_UV); - + COLOR.rgb = mix(vec3(dot(source.rgb, vec3(0.299, 0.587, 0.114))), source.rgb, saturation); COLOR.a = source.a; } \ No newline at end of file diff --git a/src/ui/3d/projectile_arc/projectile_arc.gd b/src/ui/3d/projectile_arc/projectile_arc.gd index 7cb4f77..6af81a6 100644 --- a/src/ui/3d/projectile_arc/projectile_arc.gd +++ b/src/ui/3d/projectile_arc/projectile_arc.gd @@ -36,10 +36,19 @@ const PUTT_ATTRITION := 0.8325 # green? ## If disabled, global gravity will be used instead. @export var check_gravity := true +## Improves performance by caching gravity at each point along the projection. +## This can cause problems if there is a moving gravity field. +@export var cache_gravity := true + var _tick_counter := 0 var _debug_points: Array[Vector3] = [] +var _gravity_cache: Array[Vector3] = [] + +var _cached_pos: Vector3 +var _cached_vel: Vector3 + @onready var polygon: CSGPolygon3D = %Polygon @onready var path: Path3D = %Path @@ -73,6 +82,11 @@ func _process(_delta: float) -> void: var pos := global_position var vel := -global_basis.z * initial_speed + if not cache_gravity or pos != _cached_pos or vel != _cached_vel: + _gravity_cache = [] + _cached_pos = pos + _cached_vel = vel + var final_normal: Vector3 for t in range(0, max_steps): @@ -82,11 +96,13 @@ func _process(_delta: float) -> void: # Get local gravity if enabled var local_gravity := gravity * gravity_vec if check_gravity and Game.settings.projection_gravity: - local_gravity = _get_gravity(pos) + if t >= len(_gravity_cache): + _gravity_cache.append(_get_gravity(pos)) + local_gravity = _gravity_cache[t] # Integrate projectile path + var next_pos := pos + vel * time_step + 0.5 * local_gravity * time_step * time_step vel += local_gravity * time_step - var next_pos := pos + vel * time_step # Collision if check_collision and Game.settings.projection_collisions: diff --git a/src/ui/shot_hud/death_alert.tscn b/src/ui/shot_hud/death_alert.tscn index 3654cc2..51ba09f 100644 --- a/src/ui/shot_hud/death_alert.tscn +++ b/src/ui/shot_hud/death_alert.tscn @@ -35,6 +35,57 @@ point_count = 2 curve_x = SubResource("Curve_ndj60") curve_y = SubResource("Curve_nld14") +[sub_resource type="Animation" id="Animation_4aged"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("AlertContainer/GradientBG:modulate") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(1, 1, 1, 1)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("AlertContainer/Text/Subheading:modulate") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(1, 1, 1, 1)] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath(".:modulate") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(1, 1, 1, 1)] +} +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Desaturator:material:shader_parameter/saturation") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [1.0] +} + [sub_resource type="Animation" id="Animation_l6yhv"] resource_name = "display" length = 8.0 @@ -116,57 +167,6 @@ tracks/5/keys = { "values": [1.0, 0.0, 0.0, 1.0] } -[sub_resource type="Animation" id="Animation_4aged"] -length = 0.001 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("AlertContainer/GradientBG:modulate") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [Color(1, 1, 1, 1)] -} -tracks/1/type = "value" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("AlertContainer/Text/Subheading:modulate") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [Color(1, 1, 1, 1)] -} -tracks/2/type = "value" -tracks/2/imported = false -tracks/2/enabled = true -tracks/2/path = NodePath(".:modulate") -tracks/2/interp = 1 -tracks/2/loop_wrap = true -tracks/2/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [Color(1, 1, 1, 1)] -} -tracks/3/type = "value" -tracks/3/imported = false -tracks/3/enabled = true -tracks/3/path = NodePath("Desaturator:material:shader_parameter/saturation") -tracks/3/interp = 1 -tracks/3/loop_wrap = true -tracks/3/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [1.0] -} - [sub_resource type="AnimationLibrary" id="AnimationLibrary_em7mg"] _data = { "RESET": SubResource("Animation_4aged"),