feat: add day/night cycle and visual workplace props

DayNightCycle.gd smoothly rotates DirectionalLight3D and interpolates sky colors, ambient light, fog, and procedural sky material across a configurable 240-second cycle with warm sunset/sunrise peaks and deep night ambiance. No simulation dependency — purely visual.

JajceWorld.tscn now includes visible workplace structures replacing the invisible Marker3Ds: wooden pantry crate, guard tower post, study desk, and rest bench. Each has a distinct material color matching the profession palette.

The DayNightCycle node is added to JajceWorld.tscn with node_paths wired to DirectionalLight3D and WorldEnvironment. Script reference uses path-based ext_resource (uid generation deferred to editor first load).
This commit is contained in:
2026-07-06 00:01:36 +02:00
parent 3379d08b93
commit 097cfaeaca
2 changed files with 179 additions and 1 deletions
+57 -1
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=20 format=3]
[gd_scene load_steps=26 format=3]
[ext_resource type="Terrain3DAssets" path="res://terrain/jajce/assets.tres" id="1_assets"]
[ext_resource type="PackedScene" path="res://world/resource_nodes/ResourceNode.tscn" id="2_resource"]
@@ -12,6 +12,7 @@
[ext_resource type="PackedScene" path="res://world/jajce/WaterfallBody.tscn" id="10_waterfall"]
[ext_resource type="PackedScene" path="res://world/jajce/WaterfallMist.tscn" id="11_mist"]
[ext_resource type="PackedScene" path="res://world/jajce/ChimneySmoke.tscn" id="12_smoke"]
[ext_resource type="Script" path="res://world/jajce/day_night_cycle.gd" id="13_daynight"]
[sub_resource type="Terrain3DMaterial" id="Terrain3DMaterial_jajce"]
_shader_parameters = {
@@ -85,6 +86,40 @@ adjustment_brightness = 1.04
adjustment_contrast = 1.03
adjustment_saturation = 1.1
[sub_resource type="StandardMaterial3D" id="Material_pantry"]
albedo_color = Color(0.5, 0.32, 0.2, 1)
roughness = 0.85
[sub_resource type="StandardMaterial3D" id="Material_guard"]
albedo_color = Color(0.55, 0.45, 0.35, 1)
roughness = 0.8
[sub_resource type="StandardMaterial3D" id="Material_study"]
albedo_color = Color(0.45, 0.35, 0.22, 1)
roughness = 0.82
[sub_resource type="StandardMaterial3D" id="Material_rest"]
albedo_color = Color(0.35, 0.28, 0.22, 1)
roughness = 0.88
[sub_resource type="BoxMesh" id="Mesh_pantry_base"]
material = SubResource("Material_pantry")
size = Vector3(1.6, 1.1, 1.6)
[sub_resource type="CylinderMesh" id="Mesh_guard_post"]
material = SubResource("Material_guard")
top_radius = 0.35
bottom_radius = 0.4
height = 2.5
[sub_resource type="BoxMesh" id="Mesh_study_desk"]
material = SubResource("Material_study")
size = Vector3(2.0, 0.25, 1.2)
[sub_resource type="BoxMesh" id="Mesh_rest_bench"]
material = SubResource("Material_rest")
size = Vector3(2.8, 0.3, 0.9)
[node name="JajceWorld" type="Node3D"]
script = ExtResource("3_world")
@@ -223,15 +258,31 @@ yield_per_action = 3.0
[node name="PantryMarker" type="Marker3D" parent="LegacyActivityMarkers"]
position = Vector3(0, 0, -8)
[node name="PantryVisual" type="MeshInstance3D" parent="LegacyActivityMarkers/PantryMarker"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.55, 0)
mesh = SubResource("Mesh_pantry_base")
[node name="GuardZone" type="Marker3D" parent="LegacyActivityMarkers"]
position = Vector3(0, 0, 8)
[node name="GuardTowerVisual" type="MeshInstance3D" parent="LegacyActivityMarkers/GuardZone"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.25, 0)
mesh = SubResource("Mesh_guard_post")
[node name="StudyZone" type="Marker3D" parent="LegacyActivityMarkers"]
position = Vector3(-6, 0, 6)
[node name="StudyDeskVisual" type="MeshInstance3D" parent="LegacyActivityMarkers/StudyZone"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.125, 0)
mesh = SubResource("Mesh_study_desk")
[node name="RestZone" type="Marker3D" parent="LegacyActivityMarkers"]
position = Vector3(4, 0, 5)
[node name="RestBenchVisual" type="MeshInstance3D" parent="LegacyActivityMarkers/RestZone"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.15, 0)
mesh = SubResource("Mesh_rest_bench")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
rotation_degrees = Vector3(-55, -35, 0)
light_color = Color(1, 0.87, 0.72, 1)
@@ -241,3 +292,8 @@ directional_shadow_max_distance = 180.0
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_greybox")
[node name="DayNightCycle" type="Node" parent="." node_paths=PackedStringArray("directional_light", "world_environment")]
script = ExtResource("13_daynight")
directional_light = NodePath("../DirectionalLight3D")
world_environment = NodePath("../WorldEnvironment")