aboutsummaryrefslogtreecommitdiff
path: root/client/map/environment
diff options
context:
space:
mode:
Diffstat (limited to 'client/map/environment')
-rw-r--r--client/map/environment/environment.gd20
-rw-r--r--client/map/environment/environment.tscn76
-rw-r--r--client/map/environment/presets/day_sky.tres4
-rw-r--r--client/map/environment/presets/night_sky.tres7
-rw-r--r--client/map/environment/world_environment.tscn19
5 files changed, 126 insertions, 0 deletions
diff --git a/client/map/environment/environment.gd b/client/map/environment/environment.gd
new file mode 100644
index 00000000..4f866ac8
--- /dev/null
+++ b/client/map/environment/environment.gd
@@ -0,0 +1,20 @@
+extends Node3D
+
+@onready var rain: GPUParticles3D = $Rain
+@onready var wind: GPUParticles3D = $Wind
+
+@onready var world_environment: EnvironmentSetup = $WorldEnvironment
+
+func update(active: Array):
+ if active.has("night"):
+ world_environment.set_sky("night")
+
+ wind.emitting = active.has("wind")
+ var a: ParticleProcessMaterial = wind.process_material
+ # TODO ramp
+ a.initial_velocity_max = 15. if active.has("wind") else 0.
+ a.initial_velocity_min = 15. if active.has("wind") else 0.
+
+ # TODO ramp
+ rain.emitting = active.has("rain")
+ rain.amount = 500 if active.has("rain") else 0
diff --git a/client/map/environment/environment.tscn b/client/map/environment/environment.tscn
new file mode 100644
index 00000000..73e2be55
--- /dev/null
+++ b/client/map/environment/environment.tscn
@@ -0,0 +1,76 @@
+[gd_scene load_steps=11 format=3 uid="uid://nroo08m5og0"]
+
+[ext_resource type="Script" path="res://map/environment/environment.gd" id="1_qy481"]
+[ext_resource type="PackedScene" uid="uid://cb4ic3ssk4r8r" path="res://map/environment/world_environment.tscn" id="2_68o16"]
+
+[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_fyrr8"]
+emission_shape_offset = Vector3(0, 5, 0)
+emission_shape = 3
+emission_box_extents = Vector3(5, 5, 5)
+direction = Vector3(0, -1, 0)
+spread = 5.0
+initial_velocity_min = 10.0
+initial_velocity_max = 10.0
+scale_over_velocity_max = 1000.0
+turbulence_influence_min = 0.01
+turbulence_influence_max = 0.01
+
+[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_6mo3f"]
+depth_draw_mode = 2
+albedo_color = Color(0.792157, 0.74902, 1, 1)
+roughness = 0.07
+
+[sub_resource type="CapsuleMesh" id="CapsuleMesh_6kss1"]
+material = SubResource("StandardMaterial3D_6mo3f")
+radius = 0.01
+height = 0.5
+radial_segments = 4
+rings = 4
+
+[sub_resource type="Curve" id="Curve_frsnm"]
+_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.111524, 0.771057), 1.26444, 1.26444, 0, 0, Vector2(0.866171, 0.820827), -1.03348, -1.03348, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
+point_count = 4
+
+[sub_resource type="CurveTexture" id="CurveTexture_3gn1x"]
+curve = SubResource("Curve_frsnm")
+
+[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_pyn6b"]
+emission_shape_offset = Vector3(-2.5, 0, 0)
+emission_shape = 3
+emission_box_extents = Vector3(5, 5, 5)
+spread = 5.0
+initial_velocity_min = 2.0
+initial_velocity_max = 2.0
+gravity = Vector3(0, 0, 0)
+scale_curve = SubResource("CurveTexture_3gn1x")
+scale_over_velocity_max = 1000.0
+turbulence_enabled = true
+turbulence_influence_min = 0.01
+turbulence_influence_max = 0.01
+
+[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ig8qu"]
+depth_draw_mode = 2
+albedo_color = Color(0.412412, 0.527344, 0.250208, 1)
+
+[sub_resource type="SphereMesh" id="SphereMesh_4trvf"]
+material = SubResource("StandardMaterial3D_ig8qu")
+radius = 0.03
+height = 0.06
+
+[node name="Environment" type="Node3D"]
+script = ExtResource("1_qy481")
+
+[node name="Rain" type="GPUParticles3D" parent="."]
+emitting = false
+amount = 500
+process_material = SubResource("ParticleProcessMaterial_fyrr8")
+draw_pass_1 = SubResource("CapsuleMesh_6kss1")
+
+[node name="Wind" type="GPUParticles3D" parent="."]
+emitting = false
+amount = 150
+lifetime = 5.0
+process_material = SubResource("ParticleProcessMaterial_pyn6b")
+draw_pass_1 = SubResource("SphereMesh_4trvf")
+
+[node name="WorldEnvironment" parent="." instance=ExtResource("2_68o16")]
diff --git a/client/map/environment/presets/day_sky.tres b/client/map/environment/presets/day_sky.tres
new file mode 100644
index 00000000..0e1c9458
--- /dev/null
+++ b/client/map/environment/presets/day_sky.tres
@@ -0,0 +1,4 @@
+[gd_resource type="ProceduralSkyMaterial" format=3 uid="uid://617pq1rgdgbn"]
+
+[resource]
+ground_bottom_color = Color(0.0826605, 0.065772, 0.0461518, 1)
diff --git a/client/map/environment/presets/night_sky.tres b/client/map/environment/presets/night_sky.tres
new file mode 100644
index 00000000..f1b888ef
--- /dev/null
+++ b/client/map/environment/presets/night_sky.tres
@@ -0,0 +1,7 @@
+[gd_resource type="ProceduralSkyMaterial" format=3 uid="uid://c88b6e1mfqds0"]
+
+[resource]
+sky_top_color = Color(0.167333, 0.162044, 0.423032, 1)
+sky_horizon_color = Color(0.390429, 0.285861, 0.305681, 1)
+ground_bottom_color = Color(0.0826605, 0.065772, 0.0461518, 1)
+ground_horizon_color = Color(0.392157, 0.286275, 0.305882, 1)
diff --git a/client/map/environment/world_environment.tscn b/client/map/environment/world_environment.tscn
new file mode 100644
index 00000000..b3298e28
--- /dev/null
+++ b/client/map/environment/world_environment.tscn
@@ -0,0 +1,19 @@
+[gd_scene load_steps=5 format=3 uid="uid://cb4ic3ssk4r8r"]
+
+[ext_resource type="Material" uid="uid://c88b6e1mfqds0" path="res://map/environment/presets/night_sky.tres" id="1_6wb0p"]
+[ext_resource type="Script" path="res://map/auto_setup/environment_setup.gd" id="1_iatcp"]
+
+[sub_resource type="Sky" id="Sky_trwp7"]
+sky_material = ExtResource("1_6wb0p")
+
+[sub_resource type="Environment" id="Environment_8cwcp"]
+background_mode = 2
+sky = SubResource("Sky_trwp7")
+tonemap_mode = 2
+ssao_enabled = true
+sdfgi_use_occlusion = true
+sdfgi_energy = 2.0
+
+[node name="WorldEnvironment" type="WorldEnvironment"]
+environment = SubResource("Environment_8cwcp")
+script = ExtResource("1_iatcp")