aboutsummaryrefslogtreecommitdiff
path: root/client/player/marker
diff options
context:
space:
mode:
Diffstat (limited to 'client/player/marker')
-rw-r--r--client/player/marker/interact_marker.gdshader47
-rw-r--r--client/player/marker/marker.gd27
-rw-r--r--client/player/marker/marker.tscn54
3 files changed, 128 insertions, 0 deletions
diff --git a/client/player/marker/interact_marker.gdshader b/client/player/marker/interact_marker.gdshader
new file mode 100644
index 00000000..3720290f
--- /dev/null
+++ b/client/player/marker/interact_marker.gdshader
@@ -0,0 +1,47 @@
+/*
+ Hurry Curry! - a game about cooking
+ Copyright 2024 nokoe
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, version 3 of the License only.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+*/
+shader_type spatial;
+
+uniform float max_width = .1;
+uniform float marker_length = .5;
+uniform float pulse_speed = 4.;
+uniform bool interactive = false;
+uniform bool interacting = false;
+
+void fragment() {
+ if (interacting) {
+ ALBEDO = vec3(0., 0., 15.);
+ } else if (interactive) {
+ ALBEDO = vec3(15., 0., 0.);
+ } else {
+ ALBEDO = vec3(.1, .1, .1);
+ }
+ vec2 uv = abs(2. * UV.xy - 1.);
+ float m_length = marker_length / max_width;
+ float anim;
+ if (interactive || interacting) {
+ anim = sin(TIME * pulse_speed) * .5 + 1.;
+ } else {
+ anim = .5;
+ }
+ float alpha = step(
+ 1. - max_width * anim, max(uv.x, uv.y))
+ * step(1. - max_width * m_length, min(uv.x, uv.y)
+ );
+ ALPHA = alpha;
+}
diff --git a/client/player/marker/marker.gd b/client/player/marker/marker.gd
new file mode 100644
index 00000000..07f6bfe8
--- /dev/null
+++ b/client/player/marker/marker.gd
@@ -0,0 +1,27 @@
+# Hurry Curry! - a game about cooking
+# Copyright 2024 metamuffin
+# Copyright 2024 nokoe
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+class_name Marker
+extends Node3D
+
+@onready var _cube: MeshInstance3D = $Cube
+@onready var mat: ShaderMaterial = _cube.get_active_material(0)
+
+func set_interactive(val: bool):
+ mat.set_shader_parameter("interactive", val)
+
+func set_interacting(val: bool):
+ mat.set_shader_parameter("interacting", val)
diff --git a/client/player/marker/marker.tscn b/client/player/marker/marker.tscn
new file mode 100644
index 00000000..bb638c7e
--- /dev/null
+++ b/client/player/marker/marker.tscn
@@ -0,0 +1,54 @@
+[gd_scene load_steps=7 format=3 uid="uid://c0euiv7duqfp4"]
+
+[ext_resource type="Script" path="res://player/marker/marker.gd" id="1_3njdu"]
+[ext_resource type="Shader" path="res://player/marker/interact_marker.gdshader" id="2_dejwy"]
+
+[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_o4v68"]
+
+[sub_resource type="ArrayMesh" id="ArrayMesh_2tdb0"]
+_surfaces = [{
+"aabb": AABB(-1, -1, -1, 2, 2, 2.00001),
+"format": 34896613377,
+"index_count": 36,
+"index_data": PackedByteArray(0, 0, 3, 0, 1, 0, 0, 0, 2, 0, 3, 0, 2, 0, 7, 0, 3, 0, 2, 0, 6, 0, 7, 0, 6, 0, 5, 0, 7, 0, 6, 0, 4, 0, 5, 0, 4, 0, 1, 0, 5, 0, 4, 0, 0, 0, 1, 0, 2, 0, 4, 0, 6, 0, 2, 0, 0, 0, 4, 0, 7, 0, 1, 0, 3, 0, 7, 0, 5, 0, 1, 0),
+"primitive": 3,
+"uv_scale": Vector4(0, 0, 0, 0),
+"vertex_count": 8,
+"vertex_data": PackedByteArray(0, 0, 0, 0, 254, 255, 0, 0, 0, 0, 255, 255, 254, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 254, 255, 0, 0, 255, 255, 255, 255, 254, 255, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0)
+}]
+blend_shape_mode = 0
+
+[sub_resource type="ArrayMesh" id="ArrayMesh_2ie13"]
+resource_name = "marker_Cube_001"
+_surfaces = [{
+"aabb": AABB(-1, -1, -1, 2, 2, 2.00001),
+"attribute_data": PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255),
+"format": 34896613399,
+"index_count": 36,
+"index_data": PackedByteArray(2, 0, 11, 0, 5, 0, 2, 0, 8, 0, 11, 0, 6, 0, 21, 0, 9, 0, 6, 0, 18, 0, 21, 0, 20, 0, 17, 0, 23, 0, 20, 0, 14, 0, 17, 0, 12, 0, 3, 0, 15, 0, 12, 0, 0, 0, 3, 0, 7, 0, 13, 0, 19, 0, 7, 0, 1, 0, 13, 0, 22, 0, 4, 0, 10, 0, 22, 0, 16, 0, 4, 0),
+"material": SubResource("StandardMaterial3D_o4v68"),
+"primitive": 3,
+"uv_scale": Vector4(0, 0, 0, 0),
+"vertex_count": 24,
+"vertex_data": PackedByteArray(0, 0, 0, 0, 254, 255, 255, 191, 0, 0, 0, 0, 254, 255, 255, 191, 0, 0, 0, 0, 254, 255, 84, 213, 0, 0, 255, 255, 254, 255, 255, 191, 0, 0, 255, 255, 254, 255, 255, 255, 0, 0, 255, 255, 254, 255, 84, 213, 0, 0, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 255, 191, 0, 0, 0, 0, 0, 0, 84, 213, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 84, 213, 255, 255, 0, 0, 254, 255, 255, 191, 255, 255, 0, 0, 254, 255, 255, 191, 255, 255, 0, 0, 254, 255, 84, 213, 255, 255, 255, 255, 254, 255, 255, 191, 255, 255, 255, 255, 254, 255, 255, 255, 255, 255, 255, 255, 254, 255, 84, 213, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 255, 191, 255, 255, 0, 0, 0, 0, 84, 213, 255, 255, 255, 255, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 84, 213, 255, 255, 255, 255, 0, 0, 255, 127, 84, 213, 84, 213, 255, 255, 255, 255, 255, 127, 255, 191, 84, 213, 84, 213, 255, 191, 255, 191, 0, 0, 255, 127, 84, 213, 84, 213, 255, 191, 255, 191, 255, 127, 255, 191, 84, 213, 84, 213, 255, 255, 255, 255, 0, 0, 255, 127, 170, 42, 170, 42, 255, 255, 255, 255, 255, 127, 255, 191, 170, 42, 170, 42, 255, 191, 255, 191, 0, 0, 255, 127, 170, 42, 170, 42, 255, 191, 255, 191, 255, 127, 255, 191, 170, 42, 170, 42)
+}]
+blend_shape_mode = 0
+shadow_mesh = SubResource("ArrayMesh_2tdb0")
+
+[sub_resource type="ShaderMaterial" id="ShaderMaterial_wuj1v"]
+render_priority = 0
+shader = ExtResource("2_dejwy")
+shader_parameter/max_width = 0.1
+shader_parameter/marker_length = 0.5
+shader_parameter/pulse_speed = 4.0
+shader_parameter/interactive = false
+shader_parameter/interacting = false
+
+[node name="Marker" type="Node3D"]
+script = ExtResource("1_3njdu")
+
+[node name="Cube" type="MeshInstance3D" parent="."]
+transform = Transform3D(0.25, 0, 0, 0, 0.25, 0, 0, 0, 0.25, 0, 0.25, 0)
+mesh = SubResource("ArrayMesh_2ie13")
+skeleton = NodePath("")
+surface_material_override/0 = SubResource("ShaderMaterial_wuj1v")