Compare commits
15 Commits
9ee6d08918
...
biome_gen_
| Author | SHA1 | Date | |
|---|---|---|---|
| c1e99a3b8e | |||
| 8e1ba915a2 | |||
|
|
577b4570da | ||
| 36dff9c070 | |||
| 56591bb907 | |||
| 9f254d9725 | |||
| abae8434fc | |||
|
|
e211f89fca | ||
| 3c7cbdc662 | |||
| 8c7f1c3c82 | |||
| b7308c5d66 | |||
|
|
d709d9236c | ||
| ff93a7ab2c | |||
| 122ec189eb | |||
| 889334e7a3 |
@@ -1,5 +1,14 @@
|
||||
extends Node3D
|
||||
|
||||
const CHUNK_TYPE_BIOME: int = 0
|
||||
const CHUNK_TYPE_STRAIGHT_TRACK: int = 1
|
||||
const CHUNK_TYPE_CURVED_TRACK: int = 2
|
||||
|
||||
const CHUNK_GENERATION_STEPS_PER_FRAME: int = 2
|
||||
const CHUNK_CLEANUP_STEPS_PER_FRAME: int = 4
|
||||
const LAMPPOST_WIRE_STEPS_PER_FRAME: int = 1
|
||||
const RAILWAY_SCENE_DIRECTORY: String = "res://tgcc/chunk/railway/scene"
|
||||
|
||||
@export_group("Rails")
|
||||
@export var rail_path: Path3D
|
||||
|
||||
@@ -14,17 +23,28 @@ extends Node3D
|
||||
@export_group("Lamppost")
|
||||
@export var lamppost_wire_material: ShaderMaterial
|
||||
@export_range(0.01, 1.0) var wire_thickness: float = 0.05
|
||||
@export var lamppost_dist_factor: int = 10
|
||||
|
||||
var board: Dictionary = {}
|
||||
var last_pos_train: Vector2i = Vector2i(999999, 999999)
|
||||
var noise_generator: FastNoiseLite
|
||||
var altitude_generator: FastNoiseLite
|
||||
var wire_connections: Dictionary = {}
|
||||
var chunk_candidate_cache: Dictionary = {}
|
||||
var pending_generation_cells: Array[Vector2i] = []
|
||||
var pending_cleanup_cells: Array[Vector2i] = []
|
||||
var pending_wire_cells: Array[Vector2i] = []
|
||||
var pending_wire_lookup: Dictionary = {}
|
||||
var pending_radar_update: bool = false
|
||||
var rail_chunk_catalogue: Dictionary = {}
|
||||
|
||||
var manual_biome: Biome = null
|
||||
|
||||
func _ready() -> void:
|
||||
if biome_list.is_empty() or rail_path == null: return
|
||||
|
||||
#connect events
|
||||
UIEvents.update_rail_chunks.connect(_update_rail_chunks)
|
||||
|
||||
noise_generator = FastNoiseLite.new()
|
||||
noise_generator.noise_type = FastNoiseLite.TYPE_PERLIN
|
||||
@@ -36,6 +56,8 @@ func _ready() -> void:
|
||||
altitude_generator.seed = randi()
|
||||
altitude_generator.frequency = district_scale * 0.5
|
||||
|
||||
_warm_chunk_candidate_cache()
|
||||
_warm_rail_chunk_catalogue()
|
||||
_update_set_pieces()
|
||||
|
||||
func _update_set_pieces() -> void:
|
||||
@@ -47,7 +69,7 @@ func _update_set_pieces() -> void:
|
||||
if not "exclusive_biome" in sp or sp.exclusive_biome == "":
|
||||
print("⚠️ Set Piece '", sp.name, "' not have exclusive biome -> always visible.")
|
||||
continue
|
||||
|
||||
|
||||
var local_biome = ""
|
||||
if manual_biome != null:
|
||||
local_biome = manual_biome.nome
|
||||
@@ -55,7 +77,7 @@ func _update_set_pieces() -> void:
|
||||
var grid_x = roundi(sp.global_position.x / chunk_size)
|
||||
var grid_z = roundi(sp.global_position.z / chunk_size)
|
||||
local_biome = _get_procedural_biome_name(noise_generator.get_noise_2d(grid_x, grid_z))
|
||||
|
||||
|
||||
print("Analyze: '", sp.name, "' | Need: [", sp.exclusive_biome, "] | Current biome is: [", local_biome, "]")
|
||||
if local_biome == sp.exclusive_biome:
|
||||
sp.show()
|
||||
@@ -67,15 +89,18 @@ func _update_set_pieces() -> void:
|
||||
print(" ❌ Temple is an invisible ghost.")
|
||||
|
||||
func _destroy_and_regenrate_world() -> void:
|
||||
_warm_chunk_candidate_cache()
|
||||
_clear_pending_world_work()
|
||||
|
||||
#Turn off old temples
|
||||
_update_set_pieces()
|
||||
|
||||
#Destroy all models
|
||||
for pos in board.keys():
|
||||
var cella = board[pos]
|
||||
if cella["tipo"] == "bioma":
|
||||
if cella.has("nodo") and is_instance_valid(cella["nodo"]):
|
||||
cella["nodo"].queue_free()
|
||||
if cella["type"] != "obstacle":
|
||||
if cella.has("node") and is_instance_valid(cella["node"]):
|
||||
cella["node"].queue_free()
|
||||
|
||||
#Clean board and wire connections
|
||||
board.clear()
|
||||
@@ -83,9 +108,19 @@ func _destroy_and_regenrate_world() -> void:
|
||||
|
||||
#Create train
|
||||
last_pos_train = Vector2i(999999, 999999)
|
||||
_train_radar()
|
||||
last_pos_train = Vector2i(999999, 999999)
|
||||
_train_radar()
|
||||
if rail_path != null and rail_path.train_instance != null:
|
||||
var train_pos = rail_path.train_instance.global_position
|
||||
var current_pos = Vector2i(roundi(train_pos.x / chunk_size), roundi(train_pos.z / chunk_size))
|
||||
_refresh_world(current_pos)
|
||||
pending_radar_update = true
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
_drain_cleanup_queue()
|
||||
_drain_generation_queue()
|
||||
_drain_wire_queue()
|
||||
|
||||
if pending_radar_update:
|
||||
pending_radar_update = false
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
if rail_path == null or rail_path.train_instance == null: return
|
||||
@@ -97,9 +132,8 @@ func _physics_process(_delta: float) -> void:
|
||||
|
||||
if current_pos != last_pos_train:
|
||||
last_pos_train = current_pos
|
||||
_generate_pieces_around_train(current_pos)
|
||||
_clean_far_chunks(current_pos)
|
||||
_train_radar()
|
||||
_refresh_world(current_pos)
|
||||
pending_radar_update = true
|
||||
|
||||
func collect_all_chunkinfo(root: Node, list: Array[Node]) -> void:
|
||||
if root == null: return
|
||||
@@ -110,11 +144,297 @@ func collect_all_chunkinfo(root: Node, list: Array[Node]) -> void:
|
||||
for child in root.get_children():
|
||||
collect_all_chunkinfo(child, list)
|
||||
|
||||
func _warm_chunk_candidate_cache() -> void:
|
||||
var unique_scenes: Dictionary = {}
|
||||
|
||||
for biome in biome_list:
|
||||
if biome == null:
|
||||
continue
|
||||
for scene in biome.available_chunks:
|
||||
if scene == null:
|
||||
continue
|
||||
unique_scenes[_get_chunk_scene_cache_key(scene)] = scene
|
||||
|
||||
if manual_biome != null:
|
||||
for scene in manual_biome.available_chunks:
|
||||
if scene == null:
|
||||
continue
|
||||
unique_scenes[_get_chunk_scene_cache_key(scene)] = scene
|
||||
|
||||
for scene in unique_scenes.values():
|
||||
_get_chunk_scene_metadata(scene)
|
||||
|
||||
func _warm_rail_chunk_catalogue() -> void:
|
||||
rail_chunk_catalogue.clear()
|
||||
|
||||
var directory := DirAccess.open(RAILWAY_SCENE_DIRECTORY)
|
||||
if directory == null:
|
||||
return
|
||||
|
||||
directory.list_dir_begin()
|
||||
var file_name := directory.get_next()
|
||||
while file_name != "":
|
||||
if not directory.current_is_dir() and file_name.ends_with(".tscn"):
|
||||
var scene_path := "%s/%s" % [RAILWAY_SCENE_DIRECTORY, file_name]
|
||||
var scene := load(scene_path) as PackedScene
|
||||
if scene != null:
|
||||
var chunk_type = _get_chunk_type_from_scene(scene)
|
||||
if chunk_type == CHUNK_TYPE_STRAIGHT_TRACK or chunk_type == CHUNK_TYPE_CURVED_TRACK:
|
||||
if not rail_chunk_catalogue.has(chunk_type):
|
||||
rail_chunk_catalogue[chunk_type] = []
|
||||
rail_chunk_catalogue[chunk_type].append(scene)
|
||||
file_name = directory.get_next()
|
||||
directory.list_dir_end()
|
||||
|
||||
func _get_chunk_scene_cache_key(scene: PackedScene) -> String:
|
||||
if scene == null:
|
||||
return ""
|
||||
if scene.resource_path != "":
|
||||
return scene.resource_path
|
||||
return "scene_%s" % scene.get_instance_id()
|
||||
|
||||
func _get_chunk_scene_metadata(scene: PackedScene) -> Dictionary:
|
||||
if scene == null:
|
||||
return {}
|
||||
|
||||
var key = _get_chunk_scene_cache_key(scene)
|
||||
if chunk_candidate_cache.has(key):
|
||||
return chunk_candidate_cache[key]
|
||||
|
||||
var preview_chunk = scene.instantiate()
|
||||
var info_list: Array[Node] = []
|
||||
collect_all_chunkinfo(preview_chunk, info_list)
|
||||
var info_node = info_list[0] if info_list.size() > 0 else null
|
||||
|
||||
if info_node == null or not info_node.has_method("get_rotated_data"):
|
||||
preview_chunk.queue_free()
|
||||
chunk_candidate_cache[key] = {}
|
||||
return {}
|
||||
|
||||
var info_path: NodePath = NodePath(".")
|
||||
if info_node != preview_chunk:
|
||||
info_path = preview_chunk.get_path_to(info_node)
|
||||
|
||||
var rotations = []
|
||||
for rot in range(4):
|
||||
rotations.append({
|
||||
"rotation": rot,
|
||||
"data": info_node.get_rotated_data(rot)
|
||||
})
|
||||
|
||||
var metadata = {
|
||||
"info_path": info_path,
|
||||
"rotations": rotations,
|
||||
"has_lamppost": "have_lamppost" in info_node and info_node.have_lamppost,
|
||||
}
|
||||
preview_chunk.queue_free()
|
||||
chunk_candidate_cache[key] = metadata
|
||||
return metadata
|
||||
|
||||
func _get_cached_chunk_info(instance: Node, scene: PackedScene) -> Node:
|
||||
var metadata = _get_chunk_scene_metadata(scene)
|
||||
if metadata.is_empty():
|
||||
return null
|
||||
|
||||
var info_path: NodePath = metadata["info_path"]
|
||||
if String(info_path) == ".":
|
||||
return instance
|
||||
return instance.get_node_or_null(info_path)
|
||||
|
||||
func _get_chunk_type_from_scene(scene: PackedScene) -> int:
|
||||
if scene == null:
|
||||
return CHUNK_TYPE_BIOME
|
||||
|
||||
var preview_chunk = scene.instantiate()
|
||||
var info_list: Array[Node] = []
|
||||
collect_all_chunkinfo(preview_chunk, info_list)
|
||||
var info_node = info_list[0] if info_list.size() > 0 else null
|
||||
var chunk_type = CHUNK_TYPE_BIOME
|
||||
if info_node != null and "chunk_type" in info_node:
|
||||
chunk_type = info_node.chunk_type
|
||||
preview_chunk.queue_free()
|
||||
return chunk_type
|
||||
|
||||
func _clear_pending_world_work() -> void:
|
||||
pending_generation_cells.clear()
|
||||
pending_cleanup_cells.clear()
|
||||
pending_wire_cells.clear()
|
||||
pending_wire_lookup.clear()
|
||||
pending_radar_update = false
|
||||
|
||||
func _collect_replaceable_rail_chunks(root: Node, result: Array[Node3D]) -> void:
|
||||
if root == null:
|
||||
return
|
||||
|
||||
if root is Node3D:
|
||||
var node_3d := root as Node3D
|
||||
if node_3d.scene_file_path.begins_with(RAILWAY_SCENE_DIRECTORY):
|
||||
var info_list: Array[Node] = []
|
||||
collect_all_chunkinfo(node_3d, info_list)
|
||||
var info_node = info_list[0] if info_list.size() > 0 else null
|
||||
if info_node != null and "chunk_type" in info_node:
|
||||
var chunk_type = info_node.chunk_type
|
||||
if chunk_type == CHUNK_TYPE_STRAIGHT_TRACK or chunk_type == CHUNK_TYPE_CURVED_TRACK:
|
||||
result.append(node_3d)
|
||||
return
|
||||
|
||||
for child in root.get_children():
|
||||
_collect_replaceable_rail_chunks(child, result)
|
||||
|
||||
func _pick_replacement_rail_scene(chunk_type: int, current_scene_path: String) -> PackedScene:
|
||||
var candidates: Array = rail_chunk_catalogue.get(chunk_type, [])
|
||||
if candidates.is_empty():
|
||||
return null
|
||||
|
||||
var alternatives: Array[PackedScene] = []
|
||||
for candidate in candidates:
|
||||
var scene := candidate as PackedScene
|
||||
if scene != null and scene.resource_path != current_scene_path:
|
||||
alternatives.append(scene)
|
||||
|
||||
if not alternatives.is_empty():
|
||||
return alternatives.pick_random()
|
||||
return candidates.pick_random() as PackedScene
|
||||
|
||||
func _replace_rail_chunk_instance(chunk_root: Node3D) -> bool:
|
||||
if chunk_root == null or not is_instance_valid(chunk_root):
|
||||
return false
|
||||
|
||||
var info_list: Array[Node] = []
|
||||
collect_all_chunkinfo(chunk_root, info_list)
|
||||
var info_node = info_list[0] if info_list.size() > 0 else null
|
||||
if info_node == null or not "chunk_type" in info_node:
|
||||
return false
|
||||
|
||||
var replacement_scene = _pick_replacement_rail_scene(info_node.chunk_type, chunk_root.scene_file_path)
|
||||
if replacement_scene == null:
|
||||
return false
|
||||
|
||||
var chunk_parent = chunk_root.get_parent()
|
||||
var replacement = replacement_scene.instantiate() as Node3D
|
||||
if chunk_parent == null or replacement == null:
|
||||
return false
|
||||
|
||||
var chunk_index = chunk_root.get_index()
|
||||
var chunk_name = chunk_root.name
|
||||
chunk_root.name = "%s_old" % chunk_name
|
||||
|
||||
replacement.transform = chunk_root.transform
|
||||
chunk_parent.add_child(replacement)
|
||||
chunk_parent.move_child(replacement, chunk_index)
|
||||
replacement.name = chunk_name
|
||||
replacement.owner = chunk_root.owner
|
||||
chunk_root.queue_free()
|
||||
return true
|
||||
|
||||
func _refresh_rail_chunks() -> void:
|
||||
print("update rail chunks")
|
||||
_warm_rail_chunk_catalogue()
|
||||
|
||||
var current_scene: Node = get_tree().current_scene
|
||||
if current_scene == null:
|
||||
return
|
||||
|
||||
var replaceable_chunks: Array[Node3D] = []
|
||||
_collect_replaceable_rail_chunks(current_scene, replaceable_chunks)
|
||||
|
||||
var replaced_count = 0
|
||||
for chunk_root in replaceable_chunks:
|
||||
if _replace_rail_chunk_instance(chunk_root):
|
||||
replaced_count += 1
|
||||
|
||||
if replaced_count > 0:
|
||||
await get_tree().process_frame
|
||||
_destroy_and_regenrate_world()
|
||||
|
||||
func _update_rail_chunks() -> void:
|
||||
call_deferred("_refresh_rail_chunks")
|
||||
|
||||
func _refresh_world(center: Vector2i) -> void:
|
||||
_rebuild_generation_queue(center)
|
||||
_rebuild_cleanup_queue(center)
|
||||
|
||||
func _rebuild_generation_queue(center: Vector2i) -> void:
|
||||
pending_generation_cells.clear()
|
||||
|
||||
for radius in range(eye_line + 1):
|
||||
for x in range(-radius, radius + 1):
|
||||
for z in range(-radius, radius + 1):
|
||||
if maxi(abs(x), abs(z)) != radius:
|
||||
continue
|
||||
|
||||
var grid_pos = center + Vector2i(x, z)
|
||||
if board.has(grid_pos):
|
||||
continue
|
||||
pending_generation_cells.append(grid_pos)
|
||||
|
||||
func _rebuild_cleanup_queue(center: Vector2i) -> void:
|
||||
pending_cleanup_cells.clear()
|
||||
var safe_margin = 2
|
||||
|
||||
for grid_pos in board.keys():
|
||||
var cell = board[grid_pos]
|
||||
if cell["type"] == "obstacle":
|
||||
continue
|
||||
|
||||
var dist_x = abs(grid_pos.x - center.x)
|
||||
var dist_z = abs(grid_pos.y - center.y)
|
||||
if dist_x > eye_line + safe_margin or dist_z > eye_line + safe_margin:
|
||||
pending_cleanup_cells.append(grid_pos)
|
||||
|
||||
func _drain_generation_queue() -> void:
|
||||
var processed = 0
|
||||
while processed < CHUNK_GENERATION_STEPS_PER_FRAME and not pending_generation_cells.is_empty():
|
||||
var grid_pos = pending_generation_cells.pop_front()
|
||||
if board.has(grid_pos):
|
||||
continue
|
||||
|
||||
var is_obstacle = _register_cell_with_ray(grid_pos)
|
||||
if not is_obstacle:
|
||||
_add_compatible_biome(grid_pos)
|
||||
processed += 1
|
||||
|
||||
func _drain_cleanup_queue() -> void:
|
||||
var processed = 0
|
||||
while processed < CHUNK_CLEANUP_STEPS_PER_FRAME and not pending_cleanup_cells.is_empty():
|
||||
var grid_pos = pending_cleanup_cells.pop_front()
|
||||
if not board.has(grid_pos):
|
||||
continue
|
||||
|
||||
var cell = board[grid_pos]
|
||||
if cell["type"] == "obstacle":
|
||||
continue
|
||||
|
||||
if cell.has("node") and is_instance_valid(cell["node"]):
|
||||
cell["node"].queue_free()
|
||||
board.erase(grid_pos)
|
||||
processed += 1
|
||||
|
||||
func _queue_lamppost_wire_connection(grid_pos: Vector2i) -> void:
|
||||
if pending_wire_lookup.has(grid_pos):
|
||||
return
|
||||
pending_wire_lookup[grid_pos] = true
|
||||
pending_wire_cells.append(grid_pos)
|
||||
|
||||
func _drain_wire_queue() -> void:
|
||||
var processed = 0
|
||||
while processed < LAMPPOST_WIRE_STEPS_PER_FRAME and not pending_wire_cells.is_empty():
|
||||
var grid_pos = pending_wire_cells.pop_front()
|
||||
pending_wire_lookup.erase(grid_pos)
|
||||
|
||||
if not board.has(grid_pos):
|
||||
continue
|
||||
if not board[grid_pos].get("have_lamppost", false):
|
||||
continue
|
||||
|
||||
_connect_lamppost_wires(grid_pos)
|
||||
processed += 1
|
||||
|
||||
func _generate_pieces_around_train(center: Vector2i) -> void:
|
||||
for x in range(-eye_line, eye_line + 1):
|
||||
for z in range(-eye_line, eye_line + 1):
|
||||
var grid_pos = center + Vector2i(x, z)
|
||||
|
||||
|
||||
if not board.has(grid_pos):
|
||||
var ce_obstacle = _register_cell_with_ray(grid_pos)
|
||||
if not ce_obstacle:
|
||||
@@ -166,7 +486,7 @@ func _register_cell_with_ray(grid_pos: Vector2i) -> bool:
|
||||
if info_list.size() > 0:
|
||||
var min_distance = 999999.0
|
||||
var center_cell_pos = Vector3(world_pos.x, 0, world_pos.z)
|
||||
|
||||
|
||||
for info in info_list:
|
||||
if info is Node3D:
|
||||
var pos_info = Vector3(info.global_position.x, 0, info.global_position.z)
|
||||
@@ -181,6 +501,7 @@ func _register_cell_with_ray(grid_pos: Vector2i) -> bool:
|
||||
right_info_node = info_list[0]
|
||||
|
||||
var exit_found = {"north": false, "est": false, "south": false, "west": false}
|
||||
var river_exit_found = {"north": false, "est": false, "south": false, "west": false}
|
||||
var height_found = {"north": 0, "est": 0, "south": 0, "west": 0}
|
||||
var have_lamppost = false
|
||||
|
||||
@@ -190,8 +511,9 @@ func _register_cell_with_ray(grid_pos: Vector2i) -> bool:
|
||||
var rotation_steps = roundi(rad_to_deg(right_info_node.global_rotation.y) / -90.0)
|
||||
var data = right_info_node.get_rotated_data(rotation_steps)
|
||||
exit_found = data["connections"]
|
||||
river_exit_found = data["river_connections"]
|
||||
height_found = data["heights"]
|
||||
|
||||
|
||||
if "have_lamppost" in right_info_node:
|
||||
have_lamppost = right_info_node.have_lamppost
|
||||
|
||||
@@ -199,6 +521,7 @@ func _register_cell_with_ray(grid_pos: Vector2i) -> bool:
|
||||
board[grid_pos] = {
|
||||
"type": "obstacle",
|
||||
"exit": exit_found,
|
||||
"river_exit": river_exit_found,
|
||||
"heights": height_found,
|
||||
"node": root_chunk,
|
||||
"info": right_info_node,
|
||||
@@ -206,7 +529,7 @@ func _register_cell_with_ray(grid_pos: Vector2i) -> bool:
|
||||
}
|
||||
|
||||
if have_lamppost:
|
||||
_connect_lamppost_wires(grid_pos)
|
||||
_queue_lamppost_wire_connection(grid_pos)
|
||||
|
||||
return true
|
||||
return false
|
||||
@@ -216,6 +539,10 @@ func _add_compatible_biome(grid_pos: Vector2i) -> void:
|
||||
var req_conn_est = _needed_connection(grid_pos + Vector2i(1, 0), "west")
|
||||
var req_conn_south = _needed_connection(grid_pos + Vector2i(0, 1), "north")
|
||||
var req_conn_west = _needed_connection(grid_pos + Vector2i(-1, 0), "est")
|
||||
var req_river_north = _needed_river_connection(grid_pos + Vector2i(0, -1), "south")
|
||||
var req_river_est = _needed_river_connection(grid_pos + Vector2i(1, 0), "west")
|
||||
var req_river_south = _needed_river_connection(grid_pos + Vector2i(0, 1), "north")
|
||||
var req_river_west = _needed_river_connection(grid_pos + Vector2i(-1, 0), "est")
|
||||
|
||||
var req_height_north = _needed_heights(grid_pos + Vector2i(0, -1), "south")
|
||||
var req_height_est = _needed_heights(grid_pos + Vector2i(1, 0), "west")
|
||||
@@ -229,43 +556,45 @@ func _add_compatible_biome(grid_pos: Vector2i) -> void:
|
||||
var valid_candidates = []
|
||||
|
||||
for scene in zone_catalogue:
|
||||
var test_chunk = scene.instantiate()
|
||||
var test_list: Array[Node] = []
|
||||
collect_all_chunkinfo(test_chunk, test_list)
|
||||
var info_test = test_list[0] if test_list.size() > 0 else null
|
||||
var metadata = _get_chunk_scene_metadata(scene)
|
||||
if metadata.is_empty():
|
||||
continue
|
||||
|
||||
if info_test != null and info_test.has_method("get_rotated_data"):
|
||||
for rot in range(4):
|
||||
var data = test_chunk.get_rotated_data(rot)
|
||||
var u_conn = data["connections"]
|
||||
var u_height = data["heights"]
|
||||
for candidate in metadata["rotations"]:
|
||||
var rot = candidate["rotation"]
|
||||
var data = candidate["data"]
|
||||
var u_conn = data["connections"]
|
||||
var u_river_conn = data["river_connections"]
|
||||
var u_height = data["heights"]
|
||||
|
||||
var match_conn_n = (req_conn_north == -1) or ((req_conn_north == 1) == u_conn["north"])
|
||||
var match_conn_e = (req_conn_est == -1) or ((req_conn_est == 1) == u_conn["est"])
|
||||
var match_conn_s = (req_conn_south == -1) or ((req_conn_south == 1) == u_conn["south"])
|
||||
var match_conn_o = (req_conn_west == -1) or ((req_conn_west == 1) == u_conn["west"])
|
||||
var match_river_n = (req_river_north == -1) or ((req_river_north == 1) == u_river_conn["north"])
|
||||
var match_river_e = (req_river_est == -1) or ((req_river_est == 1) == u_river_conn["est"])
|
||||
var match_river_s = (req_river_south == -1) or ((req_river_south == 1) == u_river_conn["south"])
|
||||
var match_river_o = (req_river_west == -1) or ((req_river_west == 1) == u_river_conn["west"])
|
||||
|
||||
var match_alt_n = (req_height_north == -1) or (req_height_north == u_height["north"])
|
||||
var match_alt_e = (req_height_est == -1) or (req_height_est == u_height["est"])
|
||||
var match_alt_s = (req_height_south == -1) or (req_height_south == u_height["south"])
|
||||
var match_alt_o = (req_height_west == -1) or (req_height_west == u_height["west"])
|
||||
|
||||
var diff_n = abs(u_height["north"] - height_target) if req_height_north == -1 else 0
|
||||
var diff_e = abs(u_height["est"] - height_target) if req_height_est == -1 else 0
|
||||
var diff_s = abs(u_height["south"] - height_target) if req_height_south == -1 else 0
|
||||
var diff_o = abs(u_height["west"] - height_target) if req_height_west == -1 else 0
|
||||
var excessive_jumps = diff_n > 1 or diff_e > 1 or diff_s > 1 or diff_o > 1
|
||||
|
||||
if match_conn_n and match_conn_e and match_conn_s and match_conn_o and match_river_n and match_river_e and match_river_s and match_river_o and match_alt_n and match_alt_e and match_alt_s and match_alt_o and not excessive_jumps:
|
||||
var score = 0
|
||||
if req_height_north == -1 and u_height["north"] == height_target: score += 1
|
||||
if req_height_est == -1 and u_height["est"] == height_target: score += 1
|
||||
if req_height_south == -1 and u_height["south"] == height_target: score += 1
|
||||
if req_height_west == -1 and u_height["west"] == height_target: score += 1
|
||||
|
||||
var match_conn_n = (req_conn_north == -1) or ((req_conn_north == 1) == u_conn["north"])
|
||||
var match_conn_e = (req_conn_est == -1) or ((req_conn_est == 1) == u_conn["est"])
|
||||
var match_conn_s = (req_conn_south == -1) or ((req_conn_south == 1) == u_conn["south"])
|
||||
var match_conn_o = (req_conn_west == -1) or ((req_conn_west == 1) == u_conn["west"])
|
||||
|
||||
var match_alt_n = (req_height_north == -1) or (req_height_north == u_height["north"])
|
||||
var match_alt_e = (req_height_est == -1) or (req_height_est == u_height["est"])
|
||||
var match_alt_s = (req_height_south == -1) or (req_height_south == u_height["south"])
|
||||
var match_alt_o = (req_height_west == -1) or (req_height_west == u_height["west"])
|
||||
|
||||
var diff_n = abs(u_height["north"] - height_target) if req_height_north == -1 else 0
|
||||
var diff_e = abs(u_height["est"] - height_target) if req_height_est == -1 else 0
|
||||
var diff_s = abs(u_height["south"] - height_target) if req_height_south == -1 else 0
|
||||
var diff_o = abs(u_height["west"] - height_target) if req_height_west == -1 else 0
|
||||
var excessive_jumps = diff_n > 1 or diff_e > 1 or diff_s > 1 or diff_o > 1
|
||||
|
||||
if match_conn_n and match_conn_e and match_conn_s and match_conn_o and match_alt_n and match_alt_e and match_alt_s and match_alt_o and not excessive_jumps:
|
||||
var score = 0
|
||||
if req_height_north == -1 and u_height["north"] == height_target: score += 1
|
||||
if req_height_est == -1 and u_height["est"] == height_target: score += 1
|
||||
if req_height_south == -1 and u_height["south"] == height_target: score += 1
|
||||
if req_height_west == -1 and u_height["west"] == height_target: score += 1
|
||||
|
||||
valid_candidates.append({"scene": scene, "rotation": rot, "data": data, "score": score})
|
||||
|
||||
test_chunk.queue_free()
|
||||
valid_candidates.append({"scene": scene, "rotation": rot, "data": data, "score": score})
|
||||
|
||||
if valid_candidates.size() > 0:
|
||||
var max_score = -1
|
||||
@@ -278,21 +607,20 @@ func _add_compatible_biome(grid_pos: Vector2i) -> void:
|
||||
|
||||
var choise = best_candidate.pick_random()
|
||||
var new_chunk = choise.scene.instantiate()
|
||||
add_child(new_chunk)
|
||||
new_chunk.position = Vector3(grid_pos.x * chunk_size, 0, grid_pos.y * chunk_size)
|
||||
new_chunk.rotation.y = choise.rotation * (-PI / 2.0)
|
||||
add_child(new_chunk)
|
||||
|
||||
var new_list: Array[Node] = []
|
||||
collect_all_chunkinfo(new_chunk, new_list)
|
||||
var info_new = new_list[0] if new_list.size() > 0 else null
|
||||
var info_new = _get_cached_chunk_info(new_chunk, choise.scene)
|
||||
|
||||
var have_lamppost = false
|
||||
if info_new != null and "have_lamppost" in new_chunk:
|
||||
if info_new != null and "have_lamppost" in info_new:
|
||||
have_lamppost = info_new.have_lamppost
|
||||
|
||||
board[grid_pos] = {
|
||||
"type": "bioma",
|
||||
"exit": choise.data["connections"],
|
||||
"river_exit": choise.data["river_connections"],
|
||||
"heights": choise.data["heights"],
|
||||
"node": new_chunk,
|
||||
"info": info_new,
|
||||
@@ -300,16 +628,14 @@ func _add_compatible_biome(grid_pos: Vector2i) -> void:
|
||||
}
|
||||
|
||||
if have_lamppost:
|
||||
_connect_lamppost_wires(grid_pos)
|
||||
_queue_lamppost_wire_connection(grid_pos)
|
||||
|
||||
else:
|
||||
var backup = zone_catalogue[0].instantiate()
|
||||
add_child(backup)
|
||||
backup.position = Vector3(grid_pos.x * chunk_size, 0, grid_pos.y * chunk_size)
|
||||
add_child(backup)
|
||||
|
||||
var backup_list: Array[Node] = []
|
||||
collect_all_chunkinfo(backup, backup_list)
|
||||
var info_backup = backup_list[0] if backup_list.size() > 0 else null
|
||||
var info_backup = _get_cached_chunk_info(backup, zone_catalogue[0])
|
||||
|
||||
var safe_heights = {
|
||||
"north": req_height_north if req_height_north != -1 else height_target,
|
||||
@@ -320,6 +646,7 @@ func _add_compatible_biome(grid_pos: Vector2i) -> void:
|
||||
board[grid_pos] = {
|
||||
"type": "biome",
|
||||
"exit": {"north":false, "est":false, "south":false, "west":false},
|
||||
"river_exit": {"north":false, "est":false, "south":false, "west":false},
|
||||
"heights": safe_heights,
|
||||
"node": backup,
|
||||
"info": info_backup,
|
||||
@@ -333,75 +660,28 @@ func _needed_connection(near_pos: Vector2i, side_needed: String) -> int:
|
||||
return 1 if board[near_pos]["exit"][side_needed] else 0
|
||||
return -1
|
||||
|
||||
func _needed_river_connection(near_pos: Vector2i, side_needed: String) -> int:
|
||||
if not board.has(near_pos):
|
||||
_register_cell_with_ray(near_pos)
|
||||
if board.has(near_pos) and board[near_pos].has("river_exit"):
|
||||
return 1 if board[near_pos]["river_exit"][side_needed] else 0
|
||||
return -1
|
||||
|
||||
func _needed_heights(near_pos: Vector2i, side_needed: String) -> int:
|
||||
if board.has(near_pos) and board[near_pos].has("heights"):
|
||||
return board[near_pos]["heights"][side_needed]
|
||||
return -1
|
||||
|
||||
func _train_radar() -> void:
|
||||
if rail_path == null or rail_path.curve == null or rail_path.train_instance == null: return
|
||||
|
||||
if manual_biome != null:
|
||||
return
|
||||
|
||||
var train_pos = rail_path.train_instance.global_position
|
||||
var grid_x = roundi(train_pos.x / chunk_size)
|
||||
var grid_z = roundi(train_pos.z / chunk_size)
|
||||
var current_biome = _get_procedural_biome_name(noise_generator.get_noise_2d(grid_x, grid_z))
|
||||
|
||||
var current_progress = rail_path.train_progress
|
||||
var total_length = rail_path.curve.get_baked_length()
|
||||
#var exchange_distance = 0.0
|
||||
#var next_biome = ""
|
||||
|
||||
for step in range(1, 31):
|
||||
var next_progress = wrapf(current_progress + (step * chunk_size), 0.0, total_length)
|
||||
var next_local_pos = rail_path.curve.sample_baked(next_progress, true)
|
||||
var next_global_pos = rail_path.to_global(next_local_pos)
|
||||
|
||||
var f_x = roundi(next_global_pos.x / chunk_size)
|
||||
var f_z = roundi(next_global_pos.z / chunk_size)
|
||||
var future_biome = _get_procedural_biome_name(noise_generator.get_noise_2d(f_x, f_z))
|
||||
|
||||
if future_biome != current_biome:
|
||||
#exchange_distance = step * chunk_size
|
||||
#next_biome = future_biome
|
||||
break
|
||||
|
||||
func _clean_far_chunks(centro_attuale: Vector2i) -> void:
|
||||
var cells_to_remove = []
|
||||
var safe_margin = 2
|
||||
|
||||
for grid_pos in board.keys():
|
||||
var cell = board[grid_pos]
|
||||
if cell["type"] == "obstacle": continue
|
||||
|
||||
var dist_x = abs(grid_pos.x - centro_attuale.x)
|
||||
var dist_z = abs(grid_pos.y - centro_attuale.y)
|
||||
|
||||
if dist_x > eye_line + safe_margin or dist_z > eye_line + safe_margin:
|
||||
if cell.has("node") and is_instance_valid(cell["node"]):
|
||||
cell["node"].queue_free()
|
||||
cells_to_remove.append(grid_pos)
|
||||
|
||||
for pos in cells_to_remove:
|
||||
board.erase(pos)
|
||||
|
||||
|
||||
func _get_lampposts(info_node: Node, side: String) -> Array[Node3D]:
|
||||
var lampposts: Array[Node3D] = []
|
||||
if side == "sx":
|
||||
if "connection_left" in info_node and info_node.connection_left != null:
|
||||
for p in info_node.connection_left:
|
||||
if is_instance_valid(p): lampposts.append(p)
|
||||
#if lampposts.is_empty() and "nodo_attacco_sx" in nodo_info and is_instance_valid(nodo_info.get("nodo_attacco_sx")):
|
||||
# lampposts.append(nodo_info.get("nodo_attacco_sx"))
|
||||
else:
|
||||
if "connection_right" in info_node and info_node.connection_right != null:
|
||||
for p in info_node.connection_right:
|
||||
if is_instance_valid(p): lampposts.append(p)
|
||||
#if lampposts.is_empty() and "nodo_attacco_dx" in nodo_info and is_instance_valid(nodo_info.get("nodo_attacco_dx")):
|
||||
# lampposts.append(nodo_info.get("nodo_attacco_dx"))
|
||||
return lampposts
|
||||
|
||||
func _connect_lamppost_wires(new_board_pos: Vector2i) -> void:
|
||||
@@ -425,7 +705,7 @@ func _connect_lamppost_wires(new_board_pos: Vector2i) -> void:
|
||||
var p_sx_your_best = null; var p_dx_your_best = null
|
||||
var best_closest_to_root = null
|
||||
var best_distance = 999999.0
|
||||
var ray_research = 3
|
||||
var ray_research = 6
|
||||
|
||||
for x in range(-ray_research, ray_research + 1):
|
||||
for z in range(-ray_research, ray_research + 1):
|
||||
@@ -471,7 +751,7 @@ func _connect_lamppost_wires(new_board_pos: Vector2i) -> void:
|
||||
if board.has(closest_pos) and board[closest_pos].get("have_lamppost", false):
|
||||
var closest_root = board[closest_pos]["node"]
|
||||
var closest_info = board[closest_pos]["info"]
|
||||
|
||||
|
||||
if not is_instance_valid(closest_root) or closest_root == new_root or closest_info == null: continue
|
||||
|
||||
if closest_info is Node3D: closest_info.force_update_transform()
|
||||
@@ -493,7 +773,7 @@ func _connect_lamppost_wires(new_board_pos: Vector2i) -> void:
|
||||
p_sx_your_best = closest_sx[i_t]
|
||||
p_dx_your_best = closest_dx[i_t]
|
||||
|
||||
var max_dist = chunk_size * 8.0
|
||||
var max_dist = chunk_size * lamppost_dist_factor
|
||||
|
||||
if best_closest_to_root != null and best_distance < max_dist:
|
||||
var dist_streight = p_sx_my_best.global_position.distance_to(p_sx_your_best.global_position) + p_dx_my_best.global_position.distance_to(p_dx_your_best.global_position)
|
||||
@@ -511,6 +791,7 @@ func _connect_lamppost_wires(new_board_pos: Vector2i) -> void:
|
||||
if not wire_connections.has(closest_id): wire_connections[closest_id] = 0
|
||||
wire_connections[closest_id] += 1
|
||||
|
||||
#draw lamppost
|
||||
func _draw_parable(p1: Vector3, p2: Vector3, parent: Node3D) -> void:
|
||||
var segments = 15
|
||||
var lowering = 1.5
|
||||
|
||||
@@ -12,6 +12,12 @@ class_name ChunkInfo
|
||||
@export var south: bool = false
|
||||
@export var west: bool = false
|
||||
|
||||
@export_group("River exit")
|
||||
@export var river_north: bool = false
|
||||
@export var river_est: bool = false
|
||||
@export var river_south: bool = false
|
||||
@export var river_west: bool = false
|
||||
|
||||
@export_group("Margin heights (level 0, 1, 2)")
|
||||
@export_range(0, 2, 1) var height_north: int = 0
|
||||
@export_range(0, 2, 1) var height_est: int = 0
|
||||
@@ -29,14 +35,17 @@ func _ready() -> void:
|
||||
|
||||
func get_rotated_data(steps_90: int) -> Dictionary:
|
||||
var original_exit = [north, est, south, west]
|
||||
var original_river_exit = [river_north, river_est, river_south, river_west]
|
||||
var original_height = [height_north, height_est, height_south, height_west]
|
||||
|
||||
var calculated_exit = []
|
||||
var calculated_river_exit = []
|
||||
var calculated_height = []
|
||||
|
||||
for i in range(4):
|
||||
var index = (i - steps_90 + 4) % 4
|
||||
calculated_exit.append(original_exit[index])
|
||||
calculated_river_exit.append(original_river_exit[index])
|
||||
calculated_height.append(original_height[index])
|
||||
|
||||
return {
|
||||
@@ -44,6 +53,10 @@ func get_rotated_data(steps_90: int) -> Dictionary:
|
||||
"north": calculated_exit[0], "est": calculated_exit[1],
|
||||
"south": calculated_exit[2], "west": calculated_exit[3]
|
||||
},
|
||||
"river_connections": {
|
||||
"north": calculated_river_exit[0], "est": calculated_river_exit[1],
|
||||
"south": calculated_river_exit[2], "west": calculated_river_exit[3]
|
||||
},
|
||||
"heights": {
|
||||
"north": calculated_height[0], "est": calculated_height[1],
|
||||
"south": calculated_height[2], "west": calculated_height[3]
|
||||
|
||||
@@ -90,6 +90,9 @@ wind_amount = 50
|
||||
cloud_speed = 0.01
|
||||
fireflies_amount = 550
|
||||
fireflies_spawn_ray = 60.0
|
||||
water_color_morning = Color(0.33333334, 0.654902, 0.5294118, 1)
|
||||
water_color_afternoon = Color(0.5803922, 0.5137255, 0.2901961, 1)
|
||||
water_color_night = Color(0.48235294, 0.45490196, 0.69411767, 1)
|
||||
metadata/_custom_type_script = "uid://butda6k2tli3o"
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_i3hjl"]
|
||||
@@ -265,7 +268,7 @@ shader_parameter/edge_softness_x = 0.5
|
||||
shader_parameter/night_intensity = 0.0
|
||||
shader_parameter/sun_color = Color(1, 1, 1, 1)
|
||||
|
||||
[node name="EnvironmentManager" type="Node3D" unique_id=1611939731 node_paths=PackedStringArray("particles_wind", "particles_snow", "particles_fireflies", "particles_rain", "environment_dust", "blur", "environment_shadows")]
|
||||
[node name="EnvironmentManager" type="Node3D" unique_id=1611939731 node_paths=PackedStringArray("particles_wind", "particles_snow", "particles_fireflies", "particles_rain", "environment_dust", "blur", "environment_shadows", "fog")]
|
||||
script = ExtResource("1_wecen")
|
||||
environment_config = SubResource("Resource_r4tfj")
|
||||
particles_wind = NodePath("Particles_Wind")
|
||||
@@ -276,6 +279,7 @@ godray = ExtResource("5_411rw")
|
||||
environment_dust = NodePath("EnvironmentDust")
|
||||
blur = NodePath("Blur")
|
||||
environment_shadows = NodePath("EnvironmentCloudsShadows")
|
||||
fog = NodePath("Fog")
|
||||
|
||||
[node name="Particles_Fireflies" type="GPUParticles3D" parent="." unique_id=947538133]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
|
||||
@@ -340,11 +344,11 @@ surface_material_override/0 = SubResource("ShaderMaterial_oqt1s")
|
||||
[node name="Fog" type="Node3D" parent="." unique_id=1626352238]
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="Fog" unique_id=96635311]
|
||||
transform = Transform3D(-42.075005, 7.553328e-06, 1.7196172e-13, 0, -3.7766642e-06, 45, 3.6783138e-06, 86.4, 1.9670128e-06, -67, 14, 0)
|
||||
transform = Transform3D(-42.075005, 7.553328e-06, 1.7196172e-13, 0, -3.7766642e-06, 45, 3.6783138e-06, 86.4, 1.9670128e-06, -41.926987, 14, 0)
|
||||
mesh = SubResource("QuadMesh_yn8v8")
|
||||
surface_material_override/0 = SubResource("ShaderMaterial_sxgg7")
|
||||
|
||||
[node name="MeshInstance3D2" type="MeshInstance3D" parent="Fog" unique_id=10121049]
|
||||
transform = Transform3D(-42.075005, 7.553328e-06, 1.7196172e-13, 0, -3.7766642e-06, 45, 3.6783138e-06, 86.4, 1.9670128e-06, 67, 14, 0)
|
||||
transform = Transform3D(-42.075005, 7.553328e-06, 1.7196172e-13, 0, -3.7766642e-06, 45, 3.6783138e-06, 86.4, 1.9670128e-06, 59.320038, 14, 0)
|
||||
mesh = SubResource("QuadMesh_yn8v8")
|
||||
surface_material_override/0 = SubResource("ShaderMaterial_sxgg7")
|
||||
|
||||
@@ -4,6 +4,7 @@ extends Node3D
|
||||
const NOISE_TEXTURE: Texture2D = preload("res://core/daynight/noise.tres")
|
||||
const WEATHER_SHADER: Material = preload("res://core/daynight/weather_overlay.tres")
|
||||
const WEATHER_PLAIN_SHADER: Material = preload("res://core/daynight/weather_plain_shader.tres")
|
||||
const DYNAMIC_ENVIRONMENT_UPDATES_PER_FRAME: int = 2 #how many update of the environment (apply materials) will be done per frame
|
||||
|
||||
@export var environment_config: EnvironmentConfig
|
||||
|
||||
@@ -20,6 +21,7 @@ const WEATHER_PLAIN_SHADER: Material = preload("res://core/daynight/weather_plai
|
||||
@export var environment_dust: ColorRect
|
||||
@export var blur: ColorRect
|
||||
@export var environment_shadows: MeshInstance3D
|
||||
@export var fog: Node3D
|
||||
|
||||
@export_group("Sound")
|
||||
@export var thunder_sounds: Array[AudioStream]
|
||||
@@ -34,6 +36,7 @@ var weather_controller: WeatherController
|
||||
|
||||
var day_tween: Tween
|
||||
var day_time: float = 0.0
|
||||
var pending_environment_nodes: Dictionary = {}
|
||||
|
||||
func _ready() -> void:
|
||||
|
||||
@@ -62,6 +65,7 @@ func _ready() -> void:
|
||||
godray,
|
||||
environment_dust,
|
||||
blur,
|
||||
fog,
|
||||
environment_shadows,
|
||||
sun,
|
||||
environment,
|
||||
@@ -74,9 +78,50 @@ func _ready() -> void:
|
||||
weather_controller.name = "WeatherController"
|
||||
add_child(weather_controller)
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
_process_pending_environment_nodes()
|
||||
|
||||
func _on_tree_node_added(node: Node) -> void:
|
||||
if node.is_in_group("wind_node") or node.is_in_group("weather_node") or node.is_in_group("weather_vegetables_node"):
|
||||
call_deferred("_apply_dynamic_environment_materials", node)
|
||||
_queue_dynamic_environment_node(node)
|
||||
|
||||
func _queue_dynamic_environment_node(node: Node) -> void:
|
||||
if not is_instance_valid(node):
|
||||
return
|
||||
|
||||
var ancestor = node.get_parent()
|
||||
while ancestor != null:
|
||||
if pending_environment_nodes.has(ancestor.get_instance_id()):
|
||||
return
|
||||
ancestor = ancestor.get_parent()
|
||||
|
||||
var stale_ids: Array[int] = []
|
||||
for node_id in pending_environment_nodes.keys():
|
||||
var pending_node = pending_environment_nodes[node_id]
|
||||
if not is_instance_valid(pending_node):
|
||||
stale_ids.append(node_id)
|
||||
continue
|
||||
if node.is_ancestor_of(pending_node):
|
||||
stale_ids.append(node_id)
|
||||
|
||||
for node_id in stale_ids:
|
||||
pending_environment_nodes.erase(node_id)
|
||||
|
||||
pending_environment_nodes[node.get_instance_id()] = node
|
||||
|
||||
func _process_pending_environment_nodes() -> void:
|
||||
var processed = 0
|
||||
for node_id in pending_environment_nodes.keys():
|
||||
if processed >= DYNAMIC_ENVIRONMENT_UPDATES_PER_FRAME:
|
||||
break
|
||||
|
||||
var node = pending_environment_nodes[node_id]
|
||||
pending_environment_nodes.erase(node_id)
|
||||
if not is_instance_valid(node):
|
||||
continue
|
||||
|
||||
_apply_dynamic_environment_materials(node)
|
||||
processed += 1
|
||||
|
||||
func _apply_dynamic_environment_materials(node: Node) -> void:
|
||||
if not is_instance_valid(node):
|
||||
|
||||
@@ -20,17 +20,14 @@ const SNOW_CAP_SHADER: Shader = preload("res://core/daynight/snow_cap.gdshader")
|
||||
|
||||
var _mesh_instance: MeshInstance3D
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
add_to_group("weather_overlay_ignore")
|
||||
_ensure_mesh_instance()
|
||||
_rebuild()
|
||||
|
||||
|
||||
func rebuild() -> void:
|
||||
_rebuild()
|
||||
|
||||
|
||||
func _ensure_mesh_instance() -> void:
|
||||
_mesh_instance = get_node_or_null("SnowCapMesh") as MeshInstance3D
|
||||
if _mesh_instance != null:
|
||||
@@ -41,7 +38,6 @@ func _ensure_mesh_instance() -> void:
|
||||
_mesh_instance.add_to_group("weather_overlay_ignore")
|
||||
add_child(_mesh_instance)
|
||||
|
||||
|
||||
func _rebuild() -> void:
|
||||
var cap_width: float = 0.0
|
||||
var cap_depth: float = 0.0
|
||||
@@ -78,7 +74,6 @@ func _rebuild() -> void:
|
||||
_mesh_instance.material_override = _build_material(cap_width, cap_depth)
|
||||
_mesh_instance.visible = true
|
||||
|
||||
|
||||
func _build_material(cap_width: float, cap_depth: float) -> ShaderMaterial:
|
||||
var material := ShaderMaterial.new()
|
||||
material.shader = SNOW_CAP_SHADER
|
||||
@@ -87,7 +82,6 @@ func _build_material(cap_width: float, cap_depth: float) -> ShaderMaterial:
|
||||
material.set_shader_parameter("half_depth", cap_depth * 0.5)
|
||||
return material
|
||||
|
||||
|
||||
func _get_target_aabb(target_mesh: MeshInstance3D) -> AABB:
|
||||
var points: Array[Vector3] = []
|
||||
for point in _get_aabb_points(target_mesh.get_aabb()):
|
||||
@@ -98,7 +92,6 @@ func _get_target_aabb(target_mesh: MeshInstance3D) -> AABB:
|
||||
merged = merged.expand(point)
|
||||
return merged
|
||||
|
||||
|
||||
func _get_aabb_points(aabb: AABB) -> Array[Vector3]:
|
||||
var p: Vector3 = aabb.position
|
||||
var s: Vector3 = aabb.size
|
||||
|
||||
@@ -2,6 +2,7 @@ shader_type spatial;
|
||||
render_mode blend_mix, depth_draw_always;
|
||||
|
||||
global uniform float global_rain_intensity;
|
||||
global uniform vec4 global_water_color = vec4(0.285, 0.534, 0.487, 1.0);
|
||||
|
||||
//Water color
|
||||
uniform vec4 deep_water_color : source_color = vec4(0.0, 0.1, 0.2, 1.0);
|
||||
@@ -44,12 +45,14 @@ void fragment() {
|
||||
float water_depth_gradient = exp(-depth_difference * beer_law_factor);
|
||||
vec4 base_water = mix(deep_water_color, shallow_water_color, water_depth_gradient);
|
||||
float rain_intensity = clamp(global_rain_intensity, 0.0, 1.0);
|
||||
base_water.rgb = mix(base_water.rgb, global_water_color.rgb, 0.7);
|
||||
|
||||
vec2 pos = world_pos_xz * ripple_scale;
|
||||
vec2 cell = floor(pos);
|
||||
vec2 local_pos = fract(pos) - 0.5;
|
||||
float random_val = fract(sin(dot(cell, vec2(12.9898, 78.233))) * 43758.5453);
|
||||
float is_active_cell = step(1.0 - ripple_density, random_val);
|
||||
float active_ripple_density = ripple_density * rain_intensity;
|
||||
float is_active_cell = step(1.0 - active_ripple_density, random_val);
|
||||
|
||||
float ring = 0.0;
|
||||
if (is_active_cell > 0.0) {
|
||||
|
||||
@@ -14,6 +14,7 @@ var godray: PackedScene
|
||||
var environment_dust: ColorRect
|
||||
var blur: ColorRect
|
||||
var environment_shadows: MeshInstance3D
|
||||
var fog: Node3D
|
||||
|
||||
var sun: DirectionalLight3D
|
||||
var environment: WorldEnvironment
|
||||
@@ -50,10 +51,12 @@ var current_wind_strength: float = 0.0
|
||||
var current_wind_fade: float = 0.0
|
||||
var max_wind_amount: int = 0
|
||||
var random_weather_restore_tween: Tween
|
||||
var random_event_remaining: float = 0.0
|
||||
var random_event_label_seconds: int = -1
|
||||
|
||||
func _init(wind: GPUParticles3D, snow: GPUParticles3D,
|
||||
fireflies: GPUParticles3D, rain: GPUParticles3D, ray: PackedScene,
|
||||
dust: ColorRect, blurr: ColorRect, envshadows: MeshInstance3D,
|
||||
dust: ColorRect, blurr: ColorRect, thefog: Node3D, envshadows: MeshInstance3D,
|
||||
thesun: DirectionalLight3D, theenvironment: WorldEnvironment, environmentconfig: EnvironmentConfig,
|
||||
thecamera: Camera3D, thecamerapivot: Node3D, thundersounds: Array[AudioStream], rainsounds: Array[AudioStream]) -> void:
|
||||
particles_wind = wind
|
||||
@@ -64,6 +67,7 @@ func _init(wind: GPUParticles3D, snow: GPUParticles3D,
|
||||
sun = thesun
|
||||
environment_dust = dust
|
||||
blur = blurr
|
||||
fog = thefog
|
||||
environment_shadows = envshadows
|
||||
environment = theenvironment
|
||||
environment_config = environmentconfig
|
||||
@@ -87,6 +91,7 @@ func _init(wind: GPUParticles3D, snow: GPUParticles3D,
|
||||
|
||||
toggle_dust(environment_config.enable_dust)
|
||||
toggle_blur(environment_config.enable_blur)
|
||||
toggle_fog(environment_config.enable_fog)
|
||||
|
||||
#set camera pivot if available
|
||||
if camera_pivot:
|
||||
@@ -104,10 +109,12 @@ func _ready() -> void:
|
||||
UIEvents.toggle_storm.connect(toggle_storm)
|
||||
UIEvents.toggle_dust.connect(toggle_dust)
|
||||
UIEvents.toggle_blur.connect(toggle_blur)
|
||||
UIEvents.toggle_fog.connect(toggle_fog)
|
||||
UIEvents.toggle_shadows.connect(toggle_shadows)
|
||||
_emit_weather_event_label()
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
_update_random_event_label(delta)
|
||||
|
||||
_follow_camera()
|
||||
|
||||
@@ -125,6 +132,7 @@ func _process(delta: float) -> void:
|
||||
var base_grad_top: Color
|
||||
var base_grad_bot: Color
|
||||
var base_grad_intensity: float
|
||||
var base_water_color: Color
|
||||
var base_rotation_sun: Vector3
|
||||
|
||||
if is_raining:
|
||||
@@ -152,6 +160,7 @@ func _process(delta: float) -> void:
|
||||
base_grad_top = environment_config.grad_top_morning.lerp(environment_config.grad_top_afternoon, t)
|
||||
base_grad_bot = environment_config.grad_top_morning.lerp(environment_config.grad_bot_afternoon, t)
|
||||
base_grad_intensity = lerp(environment_config.grad_intensity_morning, environment_config.grad_intensity_afternoon, t)
|
||||
base_water_color = environment_config.water_color_morning.lerp(environment_config.water_color_afternoon, t)
|
||||
base_rotation_sun = environment_config.sun_rotation_morning.lerp(environment_config.sun_rotation_afternoon, t)
|
||||
else:
|
||||
var t = day_time - 2.0
|
||||
@@ -165,6 +174,7 @@ func _process(delta: float) -> void:
|
||||
base_grad_top = environment_config.grad_top_afternoon.lerp(environment_config.grad_top_night, t)
|
||||
base_grad_bot = environment_config.grad_bot_afternoon.lerp(environment_config.grad_bot_night, t)
|
||||
base_grad_intensity = lerp(environment_config.grad_intensity_afternoon, environment_config.grad_intensity_night, t)
|
||||
base_water_color = environment_config.water_color_afternoon.lerp(environment_config.water_color_night, t)
|
||||
base_rotation_sun = environment_config.sun_rotation_afternoon.lerp(environment_config.sun_rotation_night, t)
|
||||
|
||||
var weather_color = environment_config.rain_mode_color
|
||||
@@ -176,6 +186,7 @@ func _process(delta: float) -> void:
|
||||
var final_sky_horizon = base_sky_horizon.lerp(base_sky_horizon * weather_color, clamp(rain_intensity, 0.0, 1.0))
|
||||
var final_fog_color = base_fog_color.lerp(base_fog_color * weather_color, clamp(rain_intensity, 0.0, 1.0))
|
||||
var final_fog_density = lerp(base_fog_density, base_fog_density * 4.0, clamp(rain_intensity, 0.0, 1.0))
|
||||
var final_water_color = base_water_color.darkened(clamp(environment_config.water_darkening_rain, 0.0, 1.0) * clamp(rain_intensity, 0.0, 1.0))
|
||||
|
||||
final_tint = final_tint.lerp(final_tint * environment_config.snow_mode_color, actual_snow_amount)
|
||||
final_sky_top = final_sky_top.lerp(final_sky_top * environment_config.snow_mode_color, actual_snow_amount)
|
||||
@@ -189,6 +200,7 @@ func _process(delta: float) -> void:
|
||||
RenderingServer.global_shader_parameter_set("global_gradient_color_top", final_grad_top)
|
||||
RenderingServer.global_shader_parameter_set("global_gradient_color_bot", final_grad_bot)
|
||||
RenderingServer.global_shader_parameter_set("global_gradient_intensity", base_grad_intensity)
|
||||
RenderingServer.global_shader_parameter_set("global_water_color", final_water_color)
|
||||
|
||||
var night_val = clamp(day_time - 2.0, 0.0, 1.0)
|
||||
|
||||
@@ -268,6 +280,23 @@ func _get_weather_anchor_position() -> Variant:
|
||||
return camera.global_position
|
||||
return null
|
||||
|
||||
func _get_weather_anchor_basis() -> Variant:
|
||||
var source_basis: Basis
|
||||
if camera_pivot and is_instance_valid(camera_pivot):
|
||||
source_basis = camera_pivot.global_basis
|
||||
elif camera and is_instance_valid(camera):
|
||||
source_basis = camera.global_basis
|
||||
else:
|
||||
return null
|
||||
|
||||
var forward := -source_basis.z
|
||||
forward.y = 0.0
|
||||
if forward.length_squared() <= 0.0001:
|
||||
return Basis.IDENTITY
|
||||
forward = forward.normalized()
|
||||
var right := forward.cross(Vector3.UP).normalized()
|
||||
return Basis(right, Vector3.UP, -forward)
|
||||
|
||||
func _follow_camera() -> void:
|
||||
var cam_pos = _get_weather_anchor_position()
|
||||
if cam_pos == null:
|
||||
@@ -280,6 +309,12 @@ func _follow_camera() -> void:
|
||||
particles_wind.global_position = Vector3(cam_pos.x, cam_pos.y, cam_pos.z)
|
||||
if particles_fireflies:
|
||||
particles_fireflies.global_position = Vector3(cam_pos.x, particles_fireflies.position.y, cam_pos.z)
|
||||
if fog:
|
||||
fog.global_position = Vector3(cam_pos.x, fog.global_position.y, cam_pos.z)
|
||||
#used to follow camera pivot or camera
|
||||
var anchor_basis = _get_weather_anchor_basis()
|
||||
if anchor_basis != null:
|
||||
fog.global_basis = anchor_basis
|
||||
#endregion
|
||||
|
||||
#region Fireflies
|
||||
@@ -417,6 +452,8 @@ func _update_wind_amount_from_strength(value: float) -> void:
|
||||
func trigger_random_weather_event(duration: float = 0.0) -> void:
|
||||
if random_weather_restore_tween and random_weather_restore_tween.is_valid():
|
||||
random_weather_restore_tween.kill()
|
||||
random_event_remaining = 0.0
|
||||
random_event_label_seconds = -1
|
||||
|
||||
var previous_rain: bool = is_raining
|
||||
var previous_snow: bool = is_snowing
|
||||
@@ -434,12 +471,26 @@ func trigger_random_weather_event(duration: float = 0.0) -> void:
|
||||
_apply_weather_event_state(true, false, false, true)
|
||||
|
||||
if duration > 0.0:
|
||||
random_event_remaining = duration
|
||||
_emit_weather_event_label()
|
||||
random_weather_restore_tween = create_tween()
|
||||
random_weather_restore_tween.tween_interval(duration)
|
||||
random_weather_restore_tween.tween_callback(func():
|
||||
random_event_remaining = 0.0
|
||||
random_event_label_seconds = -1
|
||||
_apply_weather_event_state(previous_rain, previous_snow, previous_wind, previous_storm)
|
||||
)
|
||||
|
||||
func _update_random_event_label(delta: float) -> void:
|
||||
if random_event_remaining <= 0.0:
|
||||
return
|
||||
|
||||
random_event_remaining = maxf(random_event_remaining - delta, 0.0)
|
||||
var display_seconds: int = ceili(random_event_remaining)
|
||||
if display_seconds != random_event_label_seconds:
|
||||
random_event_label_seconds = display_seconds
|
||||
_emit_weather_event_label()
|
||||
|
||||
func _apply_weather_event_state(rain_enabled: bool, snow_enabled: bool, wind_enabled: bool, storm_enabled: bool = false) -> void:
|
||||
if is_storm and not storm_enabled:
|
||||
toggle_storm(false)
|
||||
@@ -753,6 +804,8 @@ func _emit_weather_event_label() -> void:
|
||||
active_events.append("Wind")
|
||||
if not active_events.is_empty():
|
||||
weather_label = "Weather: %s" % " + ".join(active_events)
|
||||
if random_event_remaining > 0.0:
|
||||
weather_label += " (%s'')" % ceili(random_event_remaining)
|
||||
UIEvents.weather_event_changed.emit(weather_label)
|
||||
|
||||
#disable snow and set default values and shader
|
||||
@@ -769,7 +822,7 @@ func init_snow(value: float = 0.0):
|
||||
RenderingServer.global_shader_parameter_set("global_snow_accumulation_speed", environment_config.snow_accumulation_speed)
|
||||
RenderingServer.global_shader_parameter_set("global_snow_melt_speed", environment_config.snow_melt_speed)
|
||||
RenderingServer.global_shader_parameter_set("global_snow_max_accumulation", environment_config.snow_max_accumulation)
|
||||
RenderingServer.global_shader_parameter_set("global_snow_cap_enabled", 1.0 if environment_config.show_snow_accumulation_volume else 0.0)
|
||||
RenderingServer.global_shader_parameter_set("global_snow_cap_enabled", environment_config.show_snow_accumulation_volume)
|
||||
RenderingServer.global_shader_parameter_set("global_snow_cap_height", environment_config.snow_cap_height)
|
||||
RenderingServer.global_shader_parameter_set("global_snow_cap_flatness_start", environment_config.snow_cap_flatness_start)
|
||||
RenderingServer.global_shader_parameter_set("global_snow_cap_flatness_end", environment_config.snow_cap_flatness_end)
|
||||
@@ -804,6 +857,10 @@ func toggle_blur(value: bool) -> void:
|
||||
|
||||
ApplyPostProcessBlurConfig()
|
||||
|
||||
func toggle_fog(value: bool) -> void:
|
||||
if fog:
|
||||
fog.visible = value
|
||||
|
||||
func toggle_shadows(value: bool) -> void:
|
||||
if environment_shadows:
|
||||
environment_shadows.visible = value
|
||||
|
||||
@@ -6,10 +6,11 @@ global uniform float global_snow_start_time = -1.0;
|
||||
global uniform float global_snow_accumulation_speed = 0.1;
|
||||
global uniform float global_snow_melt_time = -1.0;
|
||||
global uniform float global_snow_melt_speed = 0.1;
|
||||
global uniform float global_snow_amount = 0.0;
|
||||
global uniform float global_snow_threshold = 0.5;
|
||||
global uniform vec4 global_snow_color = vec4(0.92, 0.96, 1.0, 1.0);
|
||||
global uniform float global_snow_max_accumulation = 0.72;
|
||||
global uniform float global_snow_cap_enabled = 1.0;
|
||||
global uniform bool global_snow_cap_enabled = true;
|
||||
global uniform float global_snow_cap_height = 0.06;
|
||||
global uniform float global_snow_cap_flatness_start = 0.72;
|
||||
global uniform float global_snow_cap_flatness_end = 0.96;
|
||||
@@ -70,16 +71,22 @@ float fbm(vec2 p) {
|
||||
return clamp(value, 0.0, 1.0);
|
||||
}
|
||||
|
||||
float get_snow_amount() {
|
||||
float snow_amount = 0.0;
|
||||
if (global_snow_start_time >= 0.0) {
|
||||
snow_amount = clamp((TIME - global_snow_start_time) * global_snow_accumulation_speed, 0.0, 1.0);
|
||||
float get_snow_progress() {
|
||||
bool has_snow_timeline = global_snow_start_time >= 0.0 || global_snow_melt_time >= 0.0;
|
||||
float snow_progress = clamp(global_snow_amount, 0.0, 1.0);
|
||||
|
||||
if (has_snow_timeline) {
|
||||
snow_progress = 0.0;
|
||||
if (global_snow_start_time >= 0.0) {
|
||||
snow_progress = clamp((TIME - global_snow_start_time) * global_snow_accumulation_speed, 0.0, 1.0);
|
||||
}
|
||||
if (global_snow_melt_time >= 0.0) {
|
||||
float melt = clamp((TIME - global_snow_melt_time) * global_snow_melt_speed, 0.0, 1.0);
|
||||
snow_progress *= (1.0 - melt);
|
||||
}
|
||||
}
|
||||
if (global_snow_melt_time >= 0.0) {
|
||||
float melt = clamp((TIME - global_snow_melt_time) * global_snow_melt_speed, 0.0, 1.0);
|
||||
snow_amount *= (1.0 - melt);
|
||||
}
|
||||
return snow_amount * global_snow_max_accumulation;
|
||||
|
||||
return snow_progress;
|
||||
}
|
||||
|
||||
float ripple_ring(vec2 uv, float time_offset) {
|
||||
@@ -90,24 +97,24 @@ float ripple_ring(vec2 uv, float time_offset) {
|
||||
}
|
||||
|
||||
void vertex() {
|
||||
float snow_amount = get_snow_amount();
|
||||
float snow_progress = get_snow_progress();
|
||||
float snow_accumulation = snow_progress * global_snow_max_accumulation;
|
||||
vec3 world_pos = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xyz;
|
||||
vec3 world_normal = normalize((MODEL_MATRIX * vec4(NORMAL, 0.0)).xyz);
|
||||
float snow_cap_enabled = step(0.5, global_snow_cap_enabled);
|
||||
|
||||
float flat_surface = smoothstep(
|
||||
max(global_snow_threshold, global_snow_cap_flatness_start),
|
||||
global_snow_cap_flatness_end,
|
||||
world_normal.y
|
||||
);
|
||||
float accumulation_growth = smoothstep(0.08, 0.65, snow_amount);
|
||||
float accumulation_growth = smoothstep(0.08, 0.65, snow_progress);
|
||||
float cap_noise = fbm(world_pos.xz * global_snow_cap_noise_scale + vec2(11.3, 4.7));
|
||||
float cap_variation = mix(1.0 - global_snow_cap_noise_strength, 1.0 + global_snow_cap_noise_strength, cap_noise);
|
||||
|
||||
v_snow_amount = snow_amount;
|
||||
v_snow_cap_mask = flat_surface * accumulation_growth * cap_variation * snow_cap_enabled;
|
||||
v_snow_amount = snow_progress;
|
||||
v_snow_cap_mask = flat_surface * accumulation_growth * cap_variation * (global_snow_cap_enabled ? 1.0 : 0.0);
|
||||
|
||||
VERTEX += NORMAL * (global_snow_cap_height * snow_amount * v_snow_cap_mask);
|
||||
VERTEX += NORMAL * (global_snow_cap_height * snow_accumulation * v_snow_cap_mask);
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
@@ -117,16 +124,17 @@ void fragment() {
|
||||
float noise_val = texture(noise_texture, world_pos.xz * snow_noise_scale).r;
|
||||
|
||||
//Snow
|
||||
float snow_amount = v_snow_amount;
|
||||
float snow_progress = v_snow_amount;
|
||||
float snow_accumulation = snow_progress * global_snow_max_accumulation;
|
||||
|
||||
float snow_edge = smoothstep(
|
||||
global_snow_threshold - snow_edge_softness,
|
||||
global_snow_threshold + snow_edge_softness,
|
||||
facing_up + (noise_val - 0.5) * 0.4
|
||||
);
|
||||
float flat_accumulation = smoothstep(0.0, 0.35, v_snow_cap_mask) * snow_amount;
|
||||
float snow_coverage = smoothstep(0.0, 0.6, noise_val + snow_amount - 0.4 + flat_accumulation * 0.25);
|
||||
float snow_factor = max(snow_edge * snow_coverage * snow_amount, flat_accumulation);
|
||||
float flat_accumulation = smoothstep(0.0, 0.35, v_snow_cap_mask) * snow_accumulation;
|
||||
float snow_coverage = smoothstep(0.0, 0.6, noise_val + snow_progress - 0.4 + flat_accumulation * 0.25);
|
||||
float snow_factor = max(snow_edge * snow_coverage * snow_progress, flat_accumulation);
|
||||
float snow_opacity = smoothstep(0.04, 0.28, snow_factor);
|
||||
snow_opacity = max(snow_opacity, flat_accumulation * 0.9);
|
||||
|
||||
|
||||
@@ -5,3 +5,17 @@
|
||||
[resource]
|
||||
render_priority = 0
|
||||
shader = ExtResource("1_weather")
|
||||
shader_parameter/snow_noise_scale = 0.15
|
||||
shader_parameter/snow_edge_softness = 0.2
|
||||
shader_parameter/snow_roughness_variation = 0.15
|
||||
shader_parameter/snow_color_variation = 0.05
|
||||
shader_parameter/ripple_scale = 1.5
|
||||
shader_parameter/ripple_speed = 2.0
|
||||
shader_parameter/ripple_layers = 3.0
|
||||
shader_parameter/streak_scale = 2.0
|
||||
shader_parameter/streak_speed = 0.8
|
||||
shader_parameter/wetness_darkening = 0.25
|
||||
shader_parameter/wet_roughness = 0.05
|
||||
shader_parameter/rain_normal_strength = 0.4
|
||||
shader_parameter/puddle_noise_scale = 0.08
|
||||
shader_parameter/puddle_threshold = 0.45
|
||||
|
||||
@@ -1,7 +1,21 @@
|
||||
[gd_resource type="ShaderMaterial" format=3]
|
||||
[gd_resource type="ShaderMaterial" format=3 uid="uid://b34bnqbrtxktw"]
|
||||
|
||||
[ext_resource type="Shader" path="res://core/daynight/weather_plain_shader.gdshader" id="1_weather_plain"]
|
||||
[ext_resource type="Shader" uid="uid://do8puw7u8dvry" path="res://core/daynight/weather_plain_shader.gdshader" id="1_weather_plain"]
|
||||
[ext_resource type="Texture2D" uid="uid://bpswbjh4jj1ou" path="res://core/daynight/noise.tres" id="2_noise"]
|
||||
|
||||
[resource]
|
||||
render_priority = 0
|
||||
shader = ExtResource("1_weather_plain")
|
||||
shader_parameter/snow_edge_softness = 0.15
|
||||
shader_parameter/snow_color_variation = 0.05
|
||||
shader_parameter/ripple_scale = 1.5
|
||||
shader_parameter/ripple_speed = 2.0
|
||||
shader_parameter/ripple_layers = 3.0
|
||||
shader_parameter/streak_scale = 2.0
|
||||
shader_parameter/streak_speed = 0.8
|
||||
shader_parameter/wetness_darkening = 0.25
|
||||
shader_parameter/wet_roughness = 0.05
|
||||
shader_parameter/rain_normal_strength = 0.4
|
||||
shader_parameter/puddle_noise_scale = 0.08
|
||||
shader_parameter/puddle_threshold = 0.45
|
||||
shader_parameter/noise_texture = ExtResource("2_noise")
|
||||
|
||||
@@ -81,8 +81,9 @@ extends Resource
|
||||
#Post-process effect toggles (initial values)
|
||||
@export_group("Post Process")
|
||||
@export var enable_dust: bool = false #Floating dust particles overlay
|
||||
@export var enable_blur: bool = false #Screen blur effect
|
||||
@export var enable_blur: bool = true #Screen blur effect
|
||||
@export var enable_environment_shadows: bool = true #Cloud shadow projection on terrain
|
||||
@export var enable_fog: bool = false #Enable fog around the train
|
||||
@export var blur_amount: float = 0.6
|
||||
|
||||
@export_group("Dust")
|
||||
@@ -176,3 +177,14 @@ extends Resource
|
||||
@export var fireflies_amount: int = 60 #Number of firefly particles
|
||||
@export var fireflies_spawn_ray: float = 20.0 #Horizontal spawn radius
|
||||
@export var fireflies_spawn_height: float = 3.0 #Vertical spawn range
|
||||
|
||||
#Water settings
|
||||
@export_group("Water")
|
||||
@export var water_color_morning: Color = Color(0.285, 0.534, 0.487, 1.0) #Tint for morning
|
||||
@export var water_color_afternoon: Color = Color(0.889, 0.733, 0.205, 1.0) #Tint for afternoon (sunset)
|
||||
@export var water_color_night: Color = Color(0.728, 0.54, 0.986, 1.0); #Tint for night
|
||||
@export var water_darkening_rain: float = 0.7 #Percentage of darkening when is rainy
|
||||
|
||||
#Random events
|
||||
@export_group("Random Events")
|
||||
@export var random_event_duration: float = 30.0 #Duration time for random event
|
||||
|
||||
@@ -27,6 +27,12 @@ signal toggle_dust(value: bool)
|
||||
signal toggle_blur(value: bool)
|
||||
@warning_ignore("unused_signal")
|
||||
signal toggle_shadows(value: bool)
|
||||
@warning_ignore("unused_signal")
|
||||
signal toggle_fog(value: bool)
|
||||
|
||||
#railway signals
|
||||
@warning_ignore("unused_signal")
|
||||
signal update_rail_chunks()
|
||||
|
||||
#day cycle signals
|
||||
@warning_ignore("unused_signal")
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
[ext_resource type="PackedScene" uid="uid://cjv1e8pc6gde1" path="res://tgcc/chunk/countryside/scene/chunk_country_corner_01.tscn" id="8_nurqm"]
|
||||
[ext_resource type="PackedScene" uid="uid://cu2chsjh8wuvp" path="res://tgcc/chunk/countryside/scene/chunk_country_straight_02.tscn" id="9_51cxd"]
|
||||
[ext_resource type="PackedScene" uid="uid://dqoai3665vb0a" path="res://tgcc/chunk/countryside/scene/chunk_country_corner_02.tscn" id="9_q6kbb"]
|
||||
[ext_resource type="PackedScene" uid="uid://c73yk6858dmwn" path="res://tgcc/chunk/countryside/scene/chunk_country_cross_4_01.tscn" id="10_ufarv"]
|
||||
[ext_resource type="PackedScene" uid="uid://cjv1e8pc6gde1" path="res://tgcc/chunk/countryside/scene/chunk_country_corner_01.tscn" id="10_ufarv"]
|
||||
[ext_resource type="PackedScene" uid="uid://cv5xmnow451kl" path="res://core/camera.tscn" id="11_o1bk6"]
|
||||
[ext_resource type="Script" uid="uid://dboerd4a6dwj7" path="res://core/biome_generator/rails.gd" id="12_4is5r"]
|
||||
[ext_resource type="PackedScene" uid="uid://qmt8bkiksgj3" path="res://tgcc/chunk/countryside/scene/chunk_country_cross_3_02.tscn" id="12_81wux"]
|
||||
@@ -28,8 +28,10 @@
|
||||
[ext_resource type="AudioStream" uid="uid://creenugno7hm" path="res://core/daynight/sounds/thunder_4.mp3" id="18_lfsx4"]
|
||||
[ext_resource type="PackedScene" uid="uid://pxmcy0lhne5d" path="res://tgcc/chunk/countryside/scene/chunk_country_straight_03.tscn" id="19_ne4de"]
|
||||
[ext_resource type="AudioStream" uid="uid://bm6dq4jwsbxf6" path="res://core/daynight/sounds/thunder_5.mp3" id="19_niwdr"]
|
||||
[ext_resource type="PackedScene" uid="uid://bs3dkwcc8w2uk" path="res://tgcc/chunk/river/scene/chunk_r_l_1.tscn" id="20_q6kbb"]
|
||||
[ext_resource type="AudioStream" uid="uid://byuxpukhy72n8" path="res://core/daynight/sounds/rain_1.mp3" id="20_quqod"]
|
||||
[ext_resource type="PackedScene" uid="uid://1c1ion0qnho4" path="res://tgcc/map/map_1/map_1.tscn" id="20_xkcqp"]
|
||||
[ext_resource type="PackedScene" uid="uid://btipd6wev016d" path="res://tgcc/chunk/river/scene/chunk_r_r_1.tscn" id="21_81wux"]
|
||||
[ext_resource type="AudioStream" uid="uid://h5yhjn1x3f4j" path="res://core/daynight/sounds/rain_2.mp3" id="21_appab"]
|
||||
[ext_resource type="AudioStream" uid="uid://elrjw0smm0cj" path="res://core/daynight/sounds/rain_3.mp3" id="22_yime3"]
|
||||
[ext_resource type="Script" uid="uid://cx2tlvxhvatj5" path="res://docs/museums/daynight/control.gd" id="23_ou3jn"]
|
||||
@@ -112,7 +114,7 @@ compositor_effects = Array[CompositorEffect]([SubResource("CompositorEffect_q52t
|
||||
[sub_resource type="Resource" id="Resource_3qrd0"]
|
||||
script = ExtResource("6_s3jnv")
|
||||
name = "countryside"
|
||||
available_chunks = Array[PackedScene]([ExtResource("7_xgfli"), ExtResource("8_nurqm"), ExtResource("9_q6kbb"), ExtResource("7_4elh6"), ExtResource("8_hvd8d"), ExtResource("12_81wux"), ExtResource("13_1ugwu"), ExtResource("10_ufarv"), ExtResource("15_ky1rt"), ExtResource("16_5g563"), ExtResource("17_tbmwr"), ExtResource("9_51cxd"), ExtResource("19_ne4de")])
|
||||
available_chunks = Array[PackedScene]([ExtResource("7_xgfli"), ExtResource("8_nurqm"), ExtResource("9_q6kbb"), ExtResource("7_4elh6"), ExtResource("8_hvd8d"), ExtResource("12_81wux"), ExtResource("13_1ugwu"), ExtResource("10_ufarv"), ExtResource("15_ky1rt"), ExtResource("16_5g563"), ExtResource("17_tbmwr"), ExtResource("9_51cxd"), ExtResource("19_ne4de"), ExtResource("20_q6kbb"), ExtResource("21_81wux")])
|
||||
metadata/_custom_type_script = "uid://wv6kcqkibium"
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_pypsn"]
|
||||
@@ -171,6 +173,30 @@ shadow_blur = 0.5
|
||||
directional_shadow_mode = 0
|
||||
directional_shadow_max_distance = 200.0
|
||||
|
||||
[node name="MainMap" parent="." unique_id=1895741703 instance=ExtResource("20_xkcqp")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 280, 0, 0)
|
||||
|
||||
[node name="rail" type="Path3D" parent="." unique_id=1795138464 node_paths=PackedStringArray("cameras")]
|
||||
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 270, 2, -0.101)
|
||||
curve = SubResource("Curve3D_ndco5")
|
||||
script = ExtResource("12_4is5r")
|
||||
train_model = ExtResource("13_5rdtm")
|
||||
cameras = NodePath("../cameras")
|
||||
sleepers_model = ExtResource("14_ahang")
|
||||
fireworks_scene = ExtResource("15_atdal")
|
||||
|
||||
[node name="Marker3D" type="Marker3D" parent="rail" unique_id=1460318018]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.7581053, -1.6046681, 59.658325)
|
||||
|
||||
[node name="Marker3D2" type="Marker3D" parent="rail" unique_id=131965864]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 127.14737, 0, 169.44846)
|
||||
|
||||
[node name="Marker3D3" type="Marker3D" parent="rail" unique_id=492991547]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -91.191925, 0, 539.03174)
|
||||
|
||||
[node name="Marker3D4" type="Marker3D" parent="rail" unique_id=1550097358]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -312.19193, 0, 349.03174)
|
||||
|
||||
[node name="Control" type="Control" parent="." unique_id=630650980]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
@@ -209,9 +235,9 @@ text = "Rain"
|
||||
[node name="Wind" type="CheckButton" parent="Control" unique_id=1013004982]
|
||||
layout_mode = 0
|
||||
offset_left = 8.0
|
||||
offset_top = 231.0
|
||||
offset_top = 256.0
|
||||
offset_right = 96.0
|
||||
offset_bottom = 262.0
|
||||
offset_bottom = 287.0
|
||||
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_focus_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_pressed_color = Color(1, 1, 1, 1)
|
||||
@@ -223,18 +249,18 @@ text = "Wind"
|
||||
[node name="WindSlider" type="HSlider" parent="Control" unique_id=28050098]
|
||||
layout_mode = 0
|
||||
offset_left = 103.0
|
||||
offset_top = 238.0
|
||||
offset_top = 263.0
|
||||
offset_right = 187.0
|
||||
offset_bottom = 254.0
|
||||
offset_bottom = 279.0
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
|
||||
[node name="Fireflies" type="CheckButton" parent="Control" unique_id=1046228444]
|
||||
layout_mode = 0
|
||||
offset_left = 8.0
|
||||
offset_top = 259.0
|
||||
offset_top = 284.0
|
||||
offset_right = 117.0
|
||||
offset_bottom = 290.0
|
||||
offset_bottom = 315.0
|
||||
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_focus_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_pressed_color = Color(1, 1, 1, 1)
|
||||
@@ -353,16 +379,16 @@ text = "Shadows"
|
||||
[node name="RandomWeather" type="Button" parent="Control" unique_id=1047710802]
|
||||
layout_mode = 0
|
||||
offset_left = 12.0
|
||||
offset_top = 289.0
|
||||
offset_right = 157.0
|
||||
offset_bottom = 320.0
|
||||
offset_top = 314.0
|
||||
offset_right = 195.0
|
||||
offset_bottom = 345.0
|
||||
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_focus_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_pressed_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_hover_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_hover_pressed_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_outline_color = Color(1, 1, 1, 1)
|
||||
text = "Random Weather (10\")"
|
||||
text = "Random Weather"
|
||||
|
||||
[node name="WeatherEventLabel" type="Label" parent="Control" unique_id=641424797]
|
||||
layout_mode = 0
|
||||
@@ -374,29 +400,33 @@ theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_outline_color = Color(1, 1, 1, 1)
|
||||
text = "Weather: Clear"
|
||||
|
||||
[node name="MainMap" parent="." unique_id=1895741703 instance=ExtResource("20_xkcqp")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 280, 0, 0)
|
||||
[node name="Fog" type="CheckButton" parent="Control" unique_id=2101743368]
|
||||
layout_mode = 0
|
||||
offset_left = 7.0
|
||||
offset_top = 228.0
|
||||
offset_right = 97.0
|
||||
offset_bottom = 259.0
|
||||
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_focus_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_pressed_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_hover_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_hover_pressed_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_outline_color = Color(1, 1, 1, 1)
|
||||
text = "Fog"
|
||||
|
||||
[node name="rail" type="Path3D" parent="." unique_id=1795138464 node_paths=PackedStringArray("cameras")]
|
||||
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 270, 2, -0.101)
|
||||
curve = SubResource("Curve3D_ndco5")
|
||||
script = ExtResource("12_4is5r")
|
||||
train_model = ExtResource("13_5rdtm")
|
||||
cameras = NodePath("../cameras")
|
||||
sleepers_model = ExtResource("14_ahang")
|
||||
fireworks_scene = ExtResource("15_atdal")
|
||||
|
||||
[node name="Marker3D" type="Marker3D" parent="rail" unique_id=1460318018]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.7581053, -1.6046681, 59.658325)
|
||||
|
||||
[node name="Marker3D2" type="Marker3D" parent="rail" unique_id=131965864]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 127.14737, 0, 169.44846)
|
||||
|
||||
[node name="Marker3D3" type="Marker3D" parent="rail" unique_id=492991547]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -91.191925, 0, 539.03174)
|
||||
|
||||
[node name="Marker3D4" type="Marker3D" parent="rail" unique_id=1550097358]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -312.19193, 0, 349.03174)
|
||||
[node name="UpdateRails" type="Button" parent="Control" unique_id=267134156]
|
||||
layout_mode = 0
|
||||
offset_left = 12.0
|
||||
offset_top = 351.0
|
||||
offset_right = 195.0
|
||||
offset_bottom = 382.0
|
||||
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_focus_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_pressed_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_hover_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_hover_pressed_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_outline_color = Color(1, 1, 1, 1)
|
||||
text = "Update Rails"
|
||||
|
||||
[connection signal="toggled" from="Control/Snow" to="Control" method="_on_snow_toggled"]
|
||||
[connection signal="toggled" from="Control/Rain" to="Control" method="_on_rain_toggled"]
|
||||
@@ -411,3 +441,5 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -312.19193, 0, 349.03174)
|
||||
[connection signal="toggled" from="Control/Pause" to="Control" method="_on_pause_toggled"]
|
||||
[connection signal="toggled" from="Control/Shadows" to="Control" method="_on_shadows_toggled"]
|
||||
[connection signal="pressed" from="Control/RandomWeather" to="Control" method="_on_random_weather_pressed"]
|
||||
[connection signal="toggled" from="Control/Fog" to="Control" method="_on_fog_toggled"]
|
||||
[connection signal="pressed" from="Control/UpdateRails" to="Control" method="_on_update_rails_pressed"]
|
||||
|
||||
@@ -7,6 +7,8 @@ extends Control
|
||||
@onready var wind_slider: HSlider = $WindSlider
|
||||
@onready var day_time_option: OptionButton = $DayTimeOptions
|
||||
|
||||
var default_random_event_duration: float = 10.0
|
||||
|
||||
func _ready() -> void:
|
||||
UIEvents.day_time_changed.connect(_on_day_time_changed)
|
||||
UIEvents.day_time_option_changed.connect(_on_day_time_option_changed)
|
||||
@@ -29,7 +31,10 @@ func _on_wind_slider_value_changed(value: float) -> void:
|
||||
UIEvents.wind_change.emit(value)
|
||||
|
||||
func _on_random_weather_pressed() -> void:
|
||||
UIEvents.trigger_random_weather.emit(10.0)
|
||||
var duration: float = default_random_event_duration
|
||||
if day_night != null and day_night.environment_config != null:
|
||||
duration = day_night.environment_config.random_event_duration
|
||||
UIEvents.trigger_random_weather.emit(duration)
|
||||
|
||||
func _on_fireflies_toggled(toggled_on: bool) -> void:
|
||||
UIEvents.toggle_fireflies.emit(toggled_on)
|
||||
@@ -96,3 +101,9 @@ func _on_day_time_option_changed(index: int) -> void:
|
||||
|
||||
func _on_option_button_item_selected(index: int) -> void:
|
||||
UIEvents.time_option_item_changed.emit(index)
|
||||
|
||||
func _on_fog_toggled(toggled_on: bool) -> void:
|
||||
UIEvents.toggle_fog.emit(toggled_on)
|
||||
|
||||
func _on_update_rails_pressed() -> void:
|
||||
UIEvents.update_rail_chunks.emit()
|
||||
|
||||
@@ -206,9 +206,9 @@ text = "Fireflies"
|
||||
[node name="RandomWeather" type="Button" parent="Control" unique_id=1114190563]
|
||||
layout_mode = 0
|
||||
offset_left = 24.0
|
||||
offset_top = 121.0
|
||||
offset_right = 169.0
|
||||
offset_bottom = 152.0
|
||||
offset_top = 157.0
|
||||
offset_right = 207.0
|
||||
offset_bottom = 188.0
|
||||
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_focus_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_pressed_color = Color(1, 1, 1, 1)
|
||||
@@ -244,9 +244,9 @@ text = "Storm"
|
||||
[node name="DayTimeLabel" type="Label" parent="Control" unique_id=1673596218]
|
||||
layout_mode = 0
|
||||
offset_left = 26.0
|
||||
offset_top = 170.0
|
||||
offset_top = 211.0
|
||||
offset_right = 360.0
|
||||
offset_bottom = 193.0
|
||||
offset_bottom = 234.0
|
||||
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_outline_color = Color(1, 1, 1, 1)
|
||||
text = "Time 00:00"
|
||||
@@ -254,18 +254,18 @@ text = "Time 00:00"
|
||||
[node name="DayTimeSlider" type="HSlider" parent="Control" unique_id=530788076]
|
||||
layout_mode = 0
|
||||
offset_left = 26.0
|
||||
offset_top = 194.0
|
||||
offset_top = 235.0
|
||||
offset_right = 205.0
|
||||
offset_bottom = 210.0
|
||||
offset_bottom = 251.0
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
|
||||
[node name="DayTimeOptions" type="OptionButton" parent="Control" unique_id=1354705309]
|
||||
layout_mode = 0
|
||||
offset_left = 25.0
|
||||
offset_top = 217.0
|
||||
offset_top = 258.0
|
||||
offset_right = 136.0
|
||||
offset_bottom = 248.0
|
||||
offset_bottom = 289.0
|
||||
selected = 1
|
||||
item_count = 4
|
||||
popup/item_0/text = "Sunrise"
|
||||
@@ -280,9 +280,9 @@ popup/item_3/id = 4
|
||||
[node name="Dust" type="CheckButton" parent="Control" unique_id=2023312048]
|
||||
layout_mode = 0
|
||||
offset_left = 21.0
|
||||
offset_top = 252.0
|
||||
offset_top = 293.0
|
||||
offset_right = 150.0
|
||||
offset_bottom = 283.0
|
||||
offset_bottom = 324.0
|
||||
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_focus_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_pressed_color = Color(1, 1, 1, 1)
|
||||
@@ -295,9 +295,9 @@ text = "Dust"
|
||||
[node name="Blur" type="CheckButton" parent="Control" unique_id=1758807681]
|
||||
layout_mode = 0
|
||||
offset_left = 21.0
|
||||
offset_top = 280.0
|
||||
offset_top = 321.0
|
||||
offset_right = 150.0
|
||||
offset_bottom = 311.0
|
||||
offset_bottom = 352.0
|
||||
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_focus_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_pressed_color = Color(1, 1, 1, 1)
|
||||
@@ -310,9 +310,9 @@ text = "Blur"
|
||||
[node name="Pause" type="CheckButton" parent="Control" unique_id=156986934]
|
||||
layout_mode = 0
|
||||
offset_left = 212.0
|
||||
offset_top = 186.0
|
||||
offset_top = 227.0
|
||||
offset_right = 307.0
|
||||
offset_bottom = 217.0
|
||||
offset_bottom = 258.0
|
||||
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_focus_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_pressed_color = Color(1, 1, 1, 1)
|
||||
@@ -324,9 +324,9 @@ text = "Pause"
|
||||
[node name="Shadows" type="CheckButton" parent="Control" unique_id=1751516495]
|
||||
layout_mode = 0
|
||||
offset_left = 21.0
|
||||
offset_top = 304.0
|
||||
offset_top = 345.0
|
||||
offset_right = 150.0
|
||||
offset_bottom = 335.0
|
||||
offset_bottom = 376.0
|
||||
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_focus_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_pressed_color = Color(1, 1, 1, 1)
|
||||
@@ -345,6 +345,20 @@ offset_bottom = 90.0
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
|
||||
[node name="Fog" type="CheckButton" parent="Control" unique_id=24312462]
|
||||
layout_mode = 0
|
||||
offset_left = 20.0
|
||||
offset_top = 118.0
|
||||
offset_right = 110.0
|
||||
offset_bottom = 149.0
|
||||
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_focus_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_pressed_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_hover_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_hover_pressed_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_outline_color = Color(1, 1, 1, 1)
|
||||
text = "Fog"
|
||||
|
||||
[node name="Scene" type="Node" parent="." unique_id=701973010]
|
||||
|
||||
[node name="chunk_country_corner_01" parent="Scene" unique_id=200417581 instance=ExtResource("14_iu8wf")]
|
||||
@@ -389,6 +403,7 @@ transform = Transform3D(-0.85, 0, -1.2834644e-07, 0, 0.85, 0, 1.2834644e-07, 0,
|
||||
[connection signal="toggled" from="Control/Pause" to="Control" method="_on_pause_toggled"]
|
||||
[connection signal="toggled" from="Control/Shadows" to="Control" method="_on_shadows_toggled"]
|
||||
[connection signal="value_changed" from="Control/WindSlider" to="Control" method="_on_wind_slider_value_changed"]
|
||||
[connection signal="toggled" from="Control/Fog" to="Control" method="_on_fog_toggled"]
|
||||
|
||||
[editable path="Scene/chunk_country_cross3_02/PaloLuce"]
|
||||
[editable path="Scene/chunk_country_end_01/PaloLuce2"]
|
||||
|
||||
@@ -11,7 +11,7 @@ config_version=5
|
||||
[application]
|
||||
|
||||
config/name="tgcc"
|
||||
run/main_scene="uid://cae0mnf353dy3"
|
||||
run/main_scene="uid://38qpxwbpvd28"
|
||||
config/features=PackedStringArray("4.6", "Forward Plus")
|
||||
run/max_fps=60
|
||||
config/icon="uid://bfar1kk3pgq8f"
|
||||
@@ -142,3 +142,7 @@ global_snow_cap_enabled={
|
||||
"type": "bool",
|
||||
"value": false
|
||||
}
|
||||
global_water_color={
|
||||
"type": "color",
|
||||
"value": Color(0, 0, 0, 1)
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ surface_material_override/1 = ExtResource("6_b82gs")
|
||||
surface_material_override/0 = ExtResource("6_b82gs")
|
||||
surface_material_override/1 = ExtResource("5_wbwk3")
|
||||
|
||||
[node name="MSH_Staccioanta_1_017" parent="." index="10" unique_id=1757093874]
|
||||
[node name="MSH_Staccioanta_1_017" parent="." index="10" unique_id=845283196]
|
||||
surface_material_override/0 = ExtResource("7_be1u8")
|
||||
|
||||
[node name="PaliLuci_001" parent="." index="11" unique_id=239883314]
|
||||
|
||||
@@ -171,7 +171,7 @@ surface_material_override/0 = ExtResource("2_t65ww")
|
||||
[node name="Bags" parent="." index="1" unique_id=885374680]
|
||||
surface_material_override/0 = SubResource("ShaderMaterial_q2s76")
|
||||
|
||||
[node name="Cart" parent="." index="2" unique_id=1431553734]
|
||||
[node name="Cart" parent="." index="2" unique_id=884973125]
|
||||
surface_material_override/0 = ExtResource("11_iulsg")
|
||||
surface_material_override/1 = SubResource("ShaderMaterial_mqw0y")
|
||||
surface_material_override/2 = SubResource("ShaderMaterial_dxwao")
|
||||
@@ -212,7 +212,7 @@ surface_material_override/1 = ExtResource("7_q2s76")
|
||||
[node name="Water_006" parent="." index="12" unique_id=2064105008]
|
||||
surface_material_override/0 = ExtResource("10_r4bww")
|
||||
|
||||
[node name="WoodPile" parent="." index="13" unique_id=1512653267]
|
||||
[node name="WoodPile" parent="." index="13" unique_id=1088104699]
|
||||
surface_material_override/0 = ExtResource("11_iulsg")
|
||||
surface_material_override/1 = ExtResource("12_ytk0o")
|
||||
surface_material_override/2 = SubResource("ShaderMaterial_ytk0o")
|
||||
|
||||
712
tgcc/chunk/countryside/scene/chunk_test_river_02.tscn
Normal file
712
tgcc/chunk/countryside/scene/chunk_test_river_02.tscn
Normal file
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -1,12 +1,35 @@
|
||||
[gd_scene format=3 uid="uid://bgb4pfflokl5s"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://c87qfar8b0ak0" path="res://tgcc/chunk/prop/pylon/pylon.fbx" id="1_lbnkk"]
|
||||
[ext_resource type="Material" uid="uid://buxlrrpn7rdgs" path="res://tgcc/chunk/material/wood.tres" id="2_8ym60"]
|
||||
[ext_resource type="Shader" uid="uid://d0ch5ofrgf7y6" path="res://core/daynight/trunk_shader.gdshader" id="3_88p0r"]
|
||||
[ext_resource type="Material" uid="uid://cn20mp8ep3yxu" path="res://tgcc/chunk/material/wires.tres" id="4_t1abq"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_wpudh"]
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_21pk4"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("3_88p0r")
|
||||
shader_parameter/albedo_color = Color(0.35906908, 0.35906908, 0.35906908, 1)
|
||||
shader_parameter/albedo_color = Color(0.2864734, 0.29280058, 0.2625562, 1)
|
||||
shader_parameter/use_texture = true
|
||||
shader_parameter/uv_scale = Vector2(3, 3)
|
||||
shader_parameter/palette_shift_y = 0.0
|
||||
shader_parameter/gradient_start_y = 0.0
|
||||
shader_parameter/gradient_end_y = 1.5
|
||||
shader_parameter/light_steps = 3.0
|
||||
shader_parameter/step_softness = 0.1
|
||||
shader_parameter/shadow_color = Color(0.4, 0.4, 0.6, 1)
|
||||
shader_parameter/shadow_offset = 0.0
|
||||
shader_parameter/cast_shadow_strength = 0.6
|
||||
shader_parameter/use_ghibli_glint = true
|
||||
shader_parameter/glint_color = Color(1, 0.95, 0.85, 1)
|
||||
shader_parameter/glint_intensity = 1.0
|
||||
shader_parameter/glint_sharpness = 32.0
|
||||
shader_parameter/emission_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/emission_energy = 0.0
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_equlh"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("3_88p0r")
|
||||
shader_parameter/albedo_color = Color(0.45348388, 0.45351064, 0.42169568, 1)
|
||||
shader_parameter/use_texture = true
|
||||
shader_parameter/uv_scale = Vector2(1, 1)
|
||||
shader_parameter/palette_shift_y = 0.0
|
||||
@@ -24,36 +47,17 @@ shader_parameter/glint_sharpness = 32.0
|
||||
shader_parameter/emission_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/emission_energy = 0.0
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_q1sqc"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("3_88p0r")
|
||||
shader_parameter/albedo_color = Color(0.35056442, 0.17908111, 0.051149555, 1)
|
||||
shader_parameter/use_texture = true
|
||||
shader_parameter/uv_scale = Vector2(1, 1)
|
||||
shader_parameter/palette_shift_y = 0.0
|
||||
shader_parameter/gradient_start_y = 0.0
|
||||
shader_parameter/gradient_end_y = 10.0
|
||||
shader_parameter/light_steps = 3.0
|
||||
shader_parameter/step_softness = 0.1
|
||||
shader_parameter/shadow_color = Color(0.4, 0.4, 0.6, 1)
|
||||
shader_parameter/shadow_offset = 0.0
|
||||
shader_parameter/cast_shadow_strength = 0.6
|
||||
shader_parameter/use_ghibli_glint = true
|
||||
shader_parameter/glint_color = Color(1, 0.95, 0.85, 1)
|
||||
shader_parameter/glint_intensity = 1.0
|
||||
shader_parameter/glint_sharpness = 32.0
|
||||
shader_parameter/emission_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/emission_energy = 0.0
|
||||
[node name="PaloLuce" unique_id=830472879 instance=ExtResource("1_lbnkk")]
|
||||
|
||||
[node name="PaloLuce" unique_id=1607500596 instance=ExtResource("1_lbnkk")]
|
||||
|
||||
[node name="Cube" parent="." index="0" unique_id=1142687027]
|
||||
transform = Transform3D(-4.3711393e-06, 100.00001, 1.1920929e-05, 0, -1.1920929e-05, 100.00001, 100.000015, 4.371139e-06, 5.210804e-13, -0.0027855237, 0, -0.002785524)
|
||||
surface_material_override/0 = SubResource("ShaderMaterial_wpudh")
|
||||
surface_material_override/1 = SubResource("ShaderMaterial_q1sqc")
|
||||
[node name="Pylon" parent="." index="0" unique_id=938151162]
|
||||
transform = Transform3D(9.360515e-06, -3.932214e-07, -100, -86.173874, 50.735218, -8.265819e-06, 50.735218, 86.173874, 4.410226e-06, -0.61381716, 6.4698167, 0.52650124)
|
||||
surface_material_override/0 = ExtResource("2_8ym60")
|
||||
surface_material_override/1 = SubResource("ShaderMaterial_21pk4")
|
||||
surface_material_override/2 = ExtResource("4_t1abq")
|
||||
surface_material_override/3 = SubResource("ShaderMaterial_equlh")
|
||||
|
||||
[node name="dx" type="Marker3D" parent="." index="1" unique_id=817453817]
|
||||
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 0.6740973, 7.234124, -0.002785494)
|
||||
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 0.6448493, 7.234124, -0.002785494)
|
||||
|
||||
[node name="sx" type="Marker3D" parent="." index="2" unique_id=1025556497]
|
||||
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, -0.67131174, 7.234124, -0.002785553)
|
||||
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, -0.61281574, 7.234124, -0.002785553)
|
||||
|
||||
@@ -123,6 +123,7 @@ buffer = PackedFloat32Array(0.09478149, -0.4699982, -0.8787032, -19.27537, -0.99
|
||||
|
||||
[node name="chunk_railway_station_hero" unique_id=1050909298 node_paths=PackedStringArray("connection_left", "connection_right") instance=ExtResource("1_c8ljj")]
|
||||
script = ExtResource("9_5ow1i")
|
||||
chunk_type = 1
|
||||
have_lamppost = true
|
||||
connection_left = [NodePath("PaloLuce3/sx"), NodePath("PaloLuce2/sx"), NodePath("PaloLuce/sx")]
|
||||
connection_right = [NodePath("PaloLuce/dx"), NodePath("PaloLuce2/dx"), NodePath("PaloLuce3/dx")]
|
||||
|
||||
@@ -45,10 +45,10 @@ connection_right = [NodePath("PaloLuce/dx"), NodePath("PaloLuce2/dx")]
|
||||
[node name="Chunk_001" parent="." index="0" unique_id=1122765659]
|
||||
surface_material_override/0 = ExtResource("2_5cqaj")
|
||||
|
||||
[node name="Chunk_020" parent="." index="1" unique_id=467050080]
|
||||
[node name="Chunk_020" parent="." index="1" unique_id=107670766]
|
||||
surface_material_override/0 = ExtResource("2_1yd65")
|
||||
|
||||
[node name="Cube_159" parent="." index="2" unique_id=1552861257]
|
||||
[node name="Cube_159" parent="." index="2" unique_id=334311805 groups=["weather_node"]]
|
||||
surface_material_override/0 = ExtResource("3_dldiy")
|
||||
surface_material_override/1 = ExtResource("4_5cqaj")
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ size = Vector3(20, 10, 20)
|
||||
|
||||
[node name="chunk_railway_straight_2" unique_id=476549215 instance=ExtResource("1_g8fwq")]
|
||||
script = ExtResource("2_5gtba")
|
||||
chunk_type = 1
|
||||
est = true
|
||||
|
||||
[node name="Chunk_014" parent="." index="0" unique_id=1534185754]
|
||||
|
||||
@@ -66,6 +66,7 @@ size = Vector3(20, 10, 20)
|
||||
|
||||
[node name="chunk_railway_straight_bridge" unique_id=1049036234 node_paths=PackedStringArray("connection_left", "connection_right") instance=ExtResource("1_bwiif")]
|
||||
script = ExtResource("1_uoylj")
|
||||
chunk_type = 1
|
||||
est = true
|
||||
west = true
|
||||
have_lamppost = true
|
||||
|
||||
BIN
tgcc/chunk/river/mesh/Chunk_R_L_1.fbx
Normal file
BIN
tgcc/chunk/river/mesh/Chunk_R_L_1.fbx
Normal file
Binary file not shown.
44
tgcc/chunk/river/mesh/Chunk_R_L_1.fbx.import
Normal file
44
tgcc/chunk/river/mesh/Chunk_R_L_1.fbx.import
Normal file
@@ -0,0 +1,44 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://d0rca3oo1k30n"
|
||||
path="res://.godot/imported/Chunk_R_L_1.fbx-f315be000da513deddf8c1537ffe1a0f.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://tgcc/chunk/river/mesh/Chunk_R_L_1.fbx"
|
||||
dest_files=["res://.godot/imported/Chunk_R_L_1.fbx-f315be000da513deddf8c1537ffe1a0f.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=true
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
fbx/importer=0
|
||||
fbx/allow_geometry_helper_nodes=false
|
||||
fbx/embedded_image_handling=1
|
||||
fbx/naming_version=2
|
||||
BIN
tgcc/chunk/river/mesh/Chunk_R_R_1.fbx
Normal file
BIN
tgcc/chunk/river/mesh/Chunk_R_R_1.fbx
Normal file
Binary file not shown.
44
tgcc/chunk/river/mesh/Chunk_R_R_1.fbx.import
Normal file
44
tgcc/chunk/river/mesh/Chunk_R_R_1.fbx.import
Normal file
@@ -0,0 +1,44 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://bryeoru3tfbcq"
|
||||
path="res://.godot/imported/Chunk_R_R_1.fbx-3c3c617da890fc412ffcc0f1d56c3abe.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://tgcc/chunk/river/mesh/Chunk_R_R_1.fbx"
|
||||
dest_files=["res://.godot/imported/Chunk_R_R_1.fbx-3c3c617da890fc412ffcc0f1d56c3abe.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=true
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
fbx/importer=0
|
||||
fbx/allow_geometry_helper_nodes=false
|
||||
fbx/embedded_image_handling=1
|
||||
fbx/naming_version=2
|
||||
730
tgcc/chunk/river/scene/chunk_r_l_1.tscn
Normal file
730
tgcc/chunk/river/scene/chunk_r_l_1.tscn
Normal file
File diff suppressed because one or more lines are too long
829
tgcc/chunk/river/scene/chunk_r_r_1.tscn
Normal file
829
tgcc/chunk/river/scene/chunk_r_r_1.tscn
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user