add final godrays
This commit is contained in:
@@ -1,120 +0,0 @@
|
||||
# Blender 4.5.3 LTS
|
||||
# www.blender.org
|
||||
o Plane.021
|
||||
v -5.000001 15.000000 10.000000
|
||||
v -5.000000 15.000000 -10.000000
|
||||
v -5.000000 -5.000000 10.000000
|
||||
v -4.999999 -5.000000 -10.000000
|
||||
v 9.999999 0.000000 10.000000
|
||||
v 10.000001 0.000000 -10.000000
|
||||
v -10.000000 0.000000 10.000000
|
||||
v -9.999999 0.000000 -10.000000
|
||||
v 9.999999 1.000000 10.000000
|
||||
v 10.000001 1.000000 -10.000000
|
||||
v -10.000000 1.000000 10.000000
|
||||
v -9.999999 1.000000 -10.000000
|
||||
v 9.999999 2.000000 10.000000
|
||||
v 10.000001 2.000000 -10.000000
|
||||
v -10.000000 2.000000 10.000000
|
||||
v -9.999999 2.000000 -10.000000
|
||||
v 9.999999 3.000000 10.000000
|
||||
v 10.000001 3.000000 -10.000000
|
||||
v -10.000000 3.000000 10.000000
|
||||
v -9.999999 3.000000 -10.000000
|
||||
v 9.999999 4.000000 10.000000
|
||||
v 10.000001 4.000000 -10.000000
|
||||
v -10.000000 4.000000 10.000000
|
||||
v -9.999999 4.000000 -10.000000
|
||||
v 9.999999 5.000000 10.000000
|
||||
v 10.000001 5.000000 -10.000000
|
||||
v -10.000001 5.000000 10.000000
|
||||
v -9.999999 5.000000 -10.000000
|
||||
v 9.999999 6.000000 10.000000
|
||||
v 10.000001 6.000000 -10.000000
|
||||
v -10.000000 6.000000 10.000000
|
||||
v -9.999999 6.000000 -10.000000
|
||||
v 9.999999 7.000000 10.000000
|
||||
v 10.000001 7.000000 -10.000000
|
||||
v -10.000000 7.000000 10.000000
|
||||
v -9.999999 7.000000 -10.000000
|
||||
v 9.999999 8.000000 10.000000
|
||||
v 10.000001 8.000000 -10.000000
|
||||
v -10.000000 8.000000 10.000000
|
||||
v -9.999999 8.000000 -10.000000
|
||||
v 9.999999 9.000000 10.000000
|
||||
v 10.000001 9.000000 -10.000000
|
||||
v -10.000000 9.000000 10.000000
|
||||
v -9.999999 9.000000 -10.000000
|
||||
v 9.999999 10.000000 10.000000
|
||||
v 10.000001 10.000000 -10.000000
|
||||
v -10.000000 10.000000 10.000000
|
||||
v -9.999999 10.000000 -10.000000
|
||||
v 4.999999 15.000000 10.000000
|
||||
v 5.000000 15.000000 -10.000000
|
||||
v 5.000000 -5.000000 10.000000
|
||||
v 5.000001 -5.000000 -10.000000
|
||||
v 3.999999 15.000000 10.000000
|
||||
v 4.000000 15.000000 -10.000000
|
||||
v 4.000000 -5.000000 10.000000
|
||||
v 4.000001 -5.000000 -10.000000
|
||||
v 2.999999 15.000000 10.000000
|
||||
v 3.000000 15.000000 -10.000000
|
||||
v 3.000000 -5.000000 10.000000
|
||||
v 3.000001 -5.000000 -10.000000
|
||||
v 1.999999 15.000000 10.000000
|
||||
v 2.000000 15.000000 -10.000000
|
||||
v 2.000000 -5.000000 10.000000
|
||||
v 2.000001 -5.000000 -10.000000
|
||||
v 0.999999 15.000000 10.000000
|
||||
v 1.000000 15.000000 -10.000000
|
||||
v 1.000000 -5.000000 10.000000
|
||||
v 1.000001 -5.000000 -10.000000
|
||||
v -0.000001 15.000000 10.000000
|
||||
v 0.000000 15.000000 -10.000000
|
||||
v -0.000000 -5.000000 10.000000
|
||||
v 0.000001 -5.000000 -10.000000
|
||||
v -1.000001 15.000000 10.000000
|
||||
v -1.000000 15.000000 -10.000000
|
||||
v -1.000000 -5.000000 10.000000
|
||||
v -0.999999 -5.000000 -10.000000
|
||||
v -2.000001 15.000000 10.000000
|
||||
v -2.000000 15.000000 -10.000000
|
||||
v -2.000000 -5.000000 10.000000
|
||||
v -1.999999 -5.000000 -10.000000
|
||||
v -3.000001 15.000000 10.000000
|
||||
v -3.000000 15.000000 -10.000000
|
||||
v -3.000000 -5.000000 10.000000
|
||||
v -2.999999 -5.000000 -10.000000
|
||||
v -4.000001 15.000000 10.000000
|
||||
v -4.000000 15.000000 -10.000000
|
||||
v -4.000000 -5.000000 10.000000
|
||||
v -3.999999 -5.000000 -10.000000
|
||||
vn -1.0000 -0.0000 -0.0000
|
||||
vn -0.0000 1.0000 -0.0000
|
||||
vt 0.000000 0.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.000000 1.000000
|
||||
s 0
|
||||
f 1/1/1 2/2/1 4/3/1 3/4/1
|
||||
f 5/1/2 6/2/2 8/3/2 7/4/2
|
||||
f 9/1/2 10/2/2 12/3/2 11/4/2
|
||||
f 13/1/2 14/2/2 16/3/2 15/4/2
|
||||
f 17/1/2 18/2/2 20/3/2 19/4/2
|
||||
f 21/1/2 22/2/2 24/3/2 23/4/2
|
||||
f 25/1/2 26/2/2 28/3/2 27/4/2
|
||||
f 29/1/2 30/2/2 32/3/2 31/4/2
|
||||
f 33/1/2 34/2/2 36/3/2 35/4/2
|
||||
f 37/1/2 38/2/2 40/3/2 39/4/2
|
||||
f 41/1/2 42/2/2 44/3/2 43/4/2
|
||||
f 45/1/2 46/2/2 48/3/2 47/4/2
|
||||
f 49/1/1 50/2/1 52/3/1 51/4/1
|
||||
f 53/1/1 54/2/1 56/3/1 55/4/1
|
||||
f 57/1/1 58/2/1 60/3/1 59/4/1
|
||||
f 61/1/1 62/2/1 64/3/1 63/4/1
|
||||
f 65/1/1 66/2/1 68/3/1 67/4/1
|
||||
f 69/1/1 70/2/1 72/3/1 71/4/1
|
||||
f 73/1/1 74/2/1 76/3/1 75/4/1
|
||||
f 77/1/1 78/2/1 80/3/1 79/4/1
|
||||
f 81/1/1 82/2/1 84/3/1 83/4/1
|
||||
f 85/1/1 86/2/1 88/3/1 87/4/1
|
||||
@@ -1,25 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="wavefront_obj"
|
||||
importer_version=1
|
||||
type="Mesh"
|
||||
uid="uid://dhoajfy0bq3yd"
|
||||
path="res://.godot/imported/gpdrays_planes.obj-aebdf6aa7871a31e32d010cafc1a6472.mesh"
|
||||
|
||||
[deps]
|
||||
|
||||
files=["res://.godot/imported/gpdrays_planes.obj-aebdf6aa7871a31e32d010cafc1a6472.mesh"]
|
||||
|
||||
source_file="res://Assets/Meshes/Chunk/Prop/gpdrays_planes.obj"
|
||||
dest_files=["res://.godot/imported/gpdrays_planes.obj-aebdf6aa7871a31e32d010cafc1a6472.mesh", "res://.godot/imported/gpdrays_planes.obj-aebdf6aa7871a31e32d010cafc1a6472.mesh"]
|
||||
|
||||
[params]
|
||||
|
||||
generate_tangents=true
|
||||
generate_lods=true
|
||||
generate_shadow_mesh=true
|
||||
generate_lightmap_uv2=false
|
||||
generate_lightmap_uv2_texel_size=0.2
|
||||
scale_mesh=Vector3(1, 1, 1)
|
||||
offset_mesh=Vector3(0, 0, 0)
|
||||
force_disable_mesh_compression=false
|
||||
4
Assets/Meshes/Godrays.tres
Normal file
4
Assets/Meshes/Godrays.tres
Normal file
@@ -0,0 +1,4 @@
|
||||
[gd_resource type="PlaneMesh" format=3 uid="uid://djremrthsiasg"]
|
||||
|
||||
[resource]
|
||||
size = Vector2(2, 10)
|
||||
43
GodrayBurst.gd
Normal file
43
GodrayBurst.gd
Normal file
@@ -0,0 +1,43 @@
|
||||
extends MeshInstance3D
|
||||
|
||||
@export var life_time: float = 8.0 # Quanto dura l'intera animazione di movimento/intensità in secondi
|
||||
# --- NUOVI PARAMETRI PER L'APPARIZIONE MORBIDA ---
|
||||
@export var fade_in_time: float = 4.0 # Quanti secondi ci mette ad apparire dolcemente
|
||||
@export var max_base_alpha: float = 1.0 # Il valore massimo a cui arriva l'alpha (se 1.0 è troppo forte, abbassalo qui)
|
||||
|
||||
func _ready():
|
||||
# Duplichiamo il materiale per renderlo unico per questo specifico raggio
|
||||
var mat = get_active_material(0).duplicate()
|
||||
set_surface_override_material(0, mat)
|
||||
|
||||
add_to_group("camere")
|
||||
|
||||
# IMPORTANTE: Impostiamo subito l'alpha a 0 prima che il gioco faccia il primo frame,
|
||||
# così evitiamo il fastidioso "pop" visivo iniziale.
|
||||
mat.set_shader_parameter("base_alpha", 0.0)
|
||||
|
||||
# Avvia le animazioni
|
||||
animate_godray(mat)
|
||||
|
||||
func animate_godray(mat: ShaderMaterial):
|
||||
# --- 1. NUOVA ANIMAZIONE: FADE IN DEL BASE ALPHA ---
|
||||
var tween_alpha = create_tween()
|
||||
# In fade_in_time secondi (es. 2), porta base_alpha da 0.0 a max_base_alpha (es. 1.0)
|
||||
tween_alpha.tween_property(mat, "shader_parameter/base_alpha", max_base_alpha, fade_in_time).from(0.0)
|
||||
|
||||
|
||||
# --- 2. VECCHIE ANIMAZIONI: INTENSITA' E BORDI ---
|
||||
var tween_intensity = create_tween()
|
||||
# Imposta il valore iniziale a 1.0 e scende a 0.2
|
||||
tween_intensity.tween_property(mat, "shader_parameter/intensity_multiplier", 0.2, life_time * 0.3).from(1.0)
|
||||
# Sale a 0.5
|
||||
tween_intensity.tween_property(mat, "shader_parameter/intensity_multiplier", 0.5, life_time * 0.3)
|
||||
# Scende a 0.0 (che lo fa sparire dolcemente alla fine)
|
||||
tween_intensity.tween_property(mat, "shader_parameter/intensity_multiplier", 0.0, life_time * 0.4)
|
||||
|
||||
# Quando l'intensità arriva a 0 alla fine del suo ciclo vitale, elimina questo godray
|
||||
tween_intensity.tween_callback(queue_free)
|
||||
|
||||
var tween_edge = create_tween()
|
||||
tween_edge.tween_property(mat, "shader_parameter/edge_fade_power", 0.5, life_time * 0.5).from(2.0)
|
||||
tween_edge.tween_property(mat, "shader_parameter/edge_fade_power", 2.0, life_time * 0.5)
|
||||
1
GodrayBurst.gd.uid
Normal file
1
GodrayBurst.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://duu1t8cjm12oi
|
||||
@@ -16,11 +16,11 @@ seamless = true
|
||||
render_priority = 0
|
||||
shader = ExtResource("1_pbkwa")
|
||||
shader_parameter/noise_texture = SubResource("NoiseTexture2D_eyx0r")
|
||||
shader_parameter/ray_color = Color(1, 0.9, 0.7, 1)
|
||||
shader_parameter/ray_color = Color(0.99999994, 0.782454, 0.2698755, 1)
|
||||
shader_parameter/base_alpha = 1.0
|
||||
shader_parameter/noise_stretching = 1.4890000232275
|
||||
shader_parameter/noise_scale = 0.18500000552762
|
||||
shader_parameter/scrolling_speed = Vector2(0, 0.05)
|
||||
shader_parameter/noise_stretching = 3.17200010317
|
||||
shader_parameter/noise_scale = 1.0
|
||||
shader_parameter/scrolling_speed = Vector2(0, 0.15)
|
||||
shader_parameter/depth_softness = 1.0
|
||||
shader_parameter/edge_fade_power = 2.0
|
||||
shader_parameter/intensity_multiplier = 0.5330000253175
|
||||
|
||||
@@ -11,7 +11,7 @@ seamless = true
|
||||
render_priority = 0
|
||||
shader = ExtResource("1_23efu")
|
||||
shader_parameter/noise_texture = SubResource("NoiseTexture2D_5lko7")
|
||||
shader_parameter/cloud_scale = 0.007000000332500001
|
||||
shader_parameter/cloud_scale = 0.0070000003325
|
||||
shader_parameter/cloud_speed = 0.0030000001425
|
||||
shader_parameter/direction = Vector2(1, 0.2)
|
||||
shader_parameter/sun_angle = Vector2(0.5, 0.5)
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
[ext_resource type="Script" uid="uid://dcaxomfkulrig" path="res://Scripts/Day_night_Cycle.gd" id="1_cr3ar"]
|
||||
[ext_resource type="Material" uid="uid://dknvdsov2jrg6" path="res://Materials/Fog.tres" id="2_4xv0h"]
|
||||
[ext_resource type="Material" uid="uid://cwbxvmtih5wsc" path="res://Materials/GodRays.tres" id="2_vpybn"]
|
||||
[ext_resource type="Material" uid="uid://7bu5f4o0v8vw" path="res://Materials/Rain.tres" id="3_4wepm"]
|
||||
[ext_resource type="Material" uid="uid://cknq8qhom7ral" path="res://Materials/ShadowPostProcess.tres" id="4_00nhk"]
|
||||
[ext_resource type="Texture2D" uid="uid://v4gyjc8j7ygj" path="res://Assets/Textures/Lightingl.png" id="4_gffi5"]
|
||||
[ext_resource type="Shader" uid="uid://l6rkqonic7dj" path="res://Shaders/Sky.gdshader" id="5_bedag"]
|
||||
[ext_resource type="PackedScene" uid="uid://bvynwhkogurml" path="res://Scenes/Godrays_Scene.tscn" id="5_gwrkm"]
|
||||
[ext_resource type="FastNoiseLite" uid="uid://c0mtwrkptjcuw" path="res://Assets/Textures/Noise_Clouds.tres" id="6_00nhk"]
|
||||
[ext_resource type="Texture2D" uid="uid://dxahudyvihk8b" path="res://Assets/Textures/Stars.png" id="6_jawsd"]
|
||||
[ext_resource type="Script" uid="uid://brcimd12tx3dm" path="res://Scripts/edge_detection_compositor.gd" id="7_4xv0h"]
|
||||
@@ -17,39 +17,23 @@
|
||||
[ext_resource type="Script" uid="uid://bhdoxc2oak88u" path="res://Scripts/palette_manager.gd" id="8_gffi5"]
|
||||
[ext_resource type="Material" uid="uid://biaudrjlfoflm" path="res://Materials/House.tres" id="9_bedag"]
|
||||
[ext_resource type="Script" uid="uid://cagpbu4pg5s1y" path="res://Scripts/Binari.gd" id="9_isbua"]
|
||||
[ext_resource type="PackedScene" uid="uid://botm0dqtr5whb" path="res://Scenes/Chunk_Scene/Chunk/Campagna/chunk_c_e_1.tscn" id="9_u10x4"]
|
||||
[ext_resource type="PackedScene" uid="uid://birttctl11th8" path="res://Scenes/Chunk_Scene/Chunk/Campagna/chunk_c_l_1.tscn" id="10_l1dl0"]
|
||||
[ext_resource type="PackedScene" uid="uid://dvk3bytqn3m5s" path="res://Scenes/Test/Main_Train.tscn" id="10_ur7m6"]
|
||||
[ext_resource type="PackedScene" uid="uid://bbrsmc2vxdcwq" path="res://Scenes/Test/fuoco_d'artificio_root.tscn" id="11_gwrkm"]
|
||||
[ext_resource type="PackedScene" uid="uid://badmwcxptjfvo" path="res://Scenes/Chunk_Scene/Chunk/Campagna/chunk_c_r_1.tscn" id="12_kjb07"]
|
||||
[ext_resource type="PackedScene" uid="uid://qyml1s00773u" path="res://Scenes/Test/Rotaie_Blockout.tscn" id="12_nonqo"]
|
||||
[ext_resource type="Shader" uid="uid://co2jw3fnyc6aa" path="res://Shaders/tree_leaves.gdshader" id="13_kwbnj"]
|
||||
[ext_resource type="PackedScene" uid="uid://r7gp3qvjpehw" path="res://Scenes/Chunk_Scene/Chunk/Campagna/chunk_c_t_1_1.tscn" id="13_on20a"]
|
||||
[ext_resource type="PackedScene" uid="uid://b3l7mu5ompcb6" path="res://Scenes/Chunk_Scene/Chunk/Campagna/chunk_c_t_3_1.tscn" id="14_6k3cw"]
|
||||
[ext_resource type="Texture2D" uid="uid://bsabg0b27m7uw" path="res://Assets/Textures/Fuji.png" id="14_7j5hj"]
|
||||
[ext_resource type="PackedScene" uid="uid://cor3j8w3wewl5" path="res://Scenes/Chunk_Scene/Chunk/Campagna/chunk_c_t_3_2.tscn" id="15_16mw0"]
|
||||
[ext_resource type="Texture2D" uid="uid://m06lpixnkjdd" path="res://Assets/Textures/Fuji_1.png" id="15_u10x4"]
|
||||
[ext_resource type="Texture2D" uid="uid://bl08clorvfthf" path="res://Assets/Textures/Fuji_2.png" id="16_l1dl0"]
|
||||
[ext_resource type="PackedScene" uid="uid://bqc1txstk8y5v" path="res://Scenes/Chunk_Scene/Chunk/Campagna/chunk_c_t_3_3.tscn" id="16_qdxup"]
|
||||
[ext_resource type="ArrayMesh" uid="uid://dp5c3nqdvnsv0" path="res://Assets/Test/Demo/flower.res" id="17_kjb07"]
|
||||
[ext_resource type="PackedScene" uid="uid://deoglbhviiria" path="res://Scenes/Chunk_Scene/Chunk/Campagna/chunk_c_x_1.tscn" id="17_tbvi6"]
|
||||
[ext_resource type="PackedScene" uid="uid://bi12g5nj421jv" path="res://Scenes/Chunk_Scene/Chunk/Foresta/chunk_F_e_1.tscn" id="18_4udcq"]
|
||||
[ext_resource type="PackedScene" uid="uid://d12t04rs47jq3" path="res://Scenes/Test/Tree_V1.tscn" id="18_on20a"]
|
||||
[ext_resource type="Shader" uid="uid://cglb64vpwpgpu" path="res://Shaders/Water2.gdshader" id="19_6k3cw"]
|
||||
[ext_resource type="PackedScene" uid="uid://uc4lteo7ebjb" path="res://Scenes/Chunk_Scene/Chunk/Foresta/chunk_F_l_1.tscn" id="19_vj0n5"]
|
||||
[ext_resource type="PackedScene" uid="uid://cpebna545ihfh" path="res://Scenes/Chunk_Scene/Chunk/Foresta/Chunk_F_L_2.tscn" id="20_00nhk"]
|
||||
[ext_resource type="PackedScene" uid="uid://bp5gnv0noxcpc" path="res://Scenes/Test/Scogliera_Blockout.tscn" id="20_16mw0"]
|
||||
[ext_resource type="PackedScene" uid="uid://dk85mk0hapngf" path="res://Assets/Test/rock2.glb" id="21_qdxup"]
|
||||
[ext_resource type="PackedScene" uid="uid://51n0mv0hpnu0" path="res://Scenes/Chunk_Scene/Chunk/Foresta/chunk_F_r_1.tscn" id="21_vpybn"]
|
||||
[ext_resource type="PackedScene" uid="uid://c0trecscea4xr" path="res://Scenes/Chunk_Scene/Chunk/Foresta/chunk_F_t_1_1.tscn" id="22_5lko7"]
|
||||
[ext_resource type="Shader" uid="uid://c0dy1aqj1b4q3" path="res://Shaders/trunk_shader.gdshader" id="22_tbvi6"]
|
||||
[ext_resource type="Texture2D" uid="uid://8sdgkykyg5l5" path="res://Assets/Textures/rock_color.png" id="23_4udcq"]
|
||||
[ext_resource type="PackedScene" uid="uid://bkgfmga5y03wo" path="res://Scenes/Chunk_Scene/Chunk/Foresta/chunk_F_t_3_1.tscn" id="23_j2rq4"]
|
||||
[ext_resource type="PackedScene" uid="uid://doa52qwel85w3" path="res://Scenes/Chunk_Scene/Chunk/Foresta/chunk_F_t_3_2.tscn" id="24_eyx0r"]
|
||||
[ext_resource type="PackedScene" uid="uid://jj15telqu3rp" path="res://Scenes/Test/Grass_Test.tscn" id="24_vj0n5"]
|
||||
[ext_resource type="PackedScene" uid="uid://bioksfn7mydfa" path="res://Assets/Test/Demo/Tree_V2.glb" id="25_00nhk"]
|
||||
[ext_resource type="PackedScene" uid="uid://d16askvk5gdjy" path="res://Scenes/Chunk_Scene/Chunk/Foresta/chunk_F_t_3_3.tscn" id="25_vmtna"]
|
||||
[ext_resource type="PackedScene" uid="uid://c7tntbuu6xauu" path="res://Scenes/Chunk_Scene/Chunk/Foresta/chunk_F_x_1.tscn" id="26_am4st"]
|
||||
[ext_resource type="Texture2D" uid="uid://cy7kh4dvdd34v" path="res://Assets/Textures/tree_bark.png" id="26_vpybn"]
|
||||
[ext_resource type="Material" uid="uid://b6hcjwe0eglcm" path="res://Materials/leaves_mat.tres" id="27_5lko7"]
|
||||
[ext_resource type="PackedScene" uid="uid://h63qncgtdqpi" path="res://Scenes/Test/Casetta_Blockout.tscn" id="28_j2rq4"]
|
||||
@@ -230,9 +214,6 @@ material = SubResource("ShaderMaterial_gpe07")
|
||||
subdivide_depth = 3
|
||||
orientation = 1
|
||||
|
||||
[sub_resource type="PlaneMesh" id="PlaneMesh_vpybn"]
|
||||
size = Vector2(2, 10)
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_qqnw7"]
|
||||
particle_flag_align_y = true
|
||||
emission_shape_scale = Vector3(70, 70, 70)
|
||||
@@ -690,6 +671,12 @@ fulmini_min = 2
|
||||
fulmini_max = 4
|
||||
scala_min_fulmine = 2.0
|
||||
scala_max_fulmine = 5.0
|
||||
godray_scene = ExtResource("5_gwrkm")
|
||||
max_rain_godrays = 60
|
||||
godray_spawn_radius = 100.0
|
||||
godray_spawn_offset = Vector3(20, 80, 20)
|
||||
godray_rotation_degrees = Vector3(50, 30, 0)
|
||||
godray_scale = Vector3(2, 25, 50)
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="." unique_id=427161585]
|
||||
|
||||
@@ -758,8 +745,8 @@ surface_material_override/0 = ExtResource("4_00nhk")
|
||||
[node name="GeneratoreBioma" type="Node3D" parent="SubViewportContainer/SubViewport/World" unique_id=757461529 node_paths=PackedStringArray("path_treno")]
|
||||
script = ExtResource("8_7j5hj")
|
||||
path_treno = NodePath("../Path3D")
|
||||
bioma_campagna = Array[PackedScene]([ExtResource("9_u10x4"), ExtResource("10_l1dl0"), ExtResource("35_n33lw"), ExtResource("12_kjb07"), ExtResource("13_on20a"), ExtResource("14_6k3cw"), ExtResource("15_16mw0"), ExtResource("16_qdxup"), ExtResource("17_tbvi6")])
|
||||
bioma_foresta = Array[PackedScene]([ExtResource("18_4udcq"), ExtResource("19_vj0n5"), ExtResource("20_00nhk"), ExtResource("21_vpybn"), ExtResource("22_5lko7"), ExtResource("23_j2rq4"), ExtResource("24_eyx0r"), ExtResource("25_vmtna"), ExtResource("26_am4st")])
|
||||
bioma_campagna = Array[PackedScene]([ExtResource("35_n33lw")])
|
||||
bioma_foresta = Array[PackedScene]([ExtResource("20_00nhk")])
|
||||
scala_distretti = 0.08
|
||||
|
||||
[node name="MainMap" parent="SubViewportContainer/SubViewport/World" unique_id=1895741703 instance=ExtResource("8_bedag")]
|
||||
@@ -791,12 +778,8 @@ draw_pass_1 = SubResource("QuadMesh_twefy")
|
||||
|
||||
[node name="Camere" type="Node3D" parent="SubViewportContainer/SubViewport/World" unique_id=1348180511]
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World/Camere" unique_id=70247470]
|
||||
transform = Transform3D(2.9879434, -2.3589852, 4.245042, -2.4571407, -1.9655121e-07, 5.760314, -1.0171789, -6.929473, -1.4451305, 18.895258, 25.821028, 0)
|
||||
[node name="Node3D" parent="SubViewportContainer/SubViewport/World/Camere" unique_id=1364530594 instance=ExtResource("5_gwrkm")]
|
||||
visible = false
|
||||
mesh = SubResource("PlaneMesh_vpybn")
|
||||
skeleton = NodePath("../SpriteFulmine")
|
||||
surface_material_override/0 = ExtResource("2_vpybn")
|
||||
|
||||
[node name="SpriteFulmine" type="Sprite3D" parent="SubViewportContainer/SubViewport/World/Camere" unique_id=1820121693]
|
||||
transform = Transform3D(4, 0, 0, 0, 7.32, 0, 0, 0, 7.3, 0, 17.324, 30.411049)
|
||||
@@ -888,49 +871,25 @@ skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = ExtResource("2_4xv0h")
|
||||
|
||||
[node name="MeshInstance3D20" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World/Fog" unique_id=1575620825]
|
||||
transform = Transform3D(0.043454673, -0.010095915, 5.972679e-05, -0.0010768108, -0.1055714, -0.09403253, 0.0018440381, 0.1762621, -0.05631697, -0.313622, 0.027557772, -0.14765048)
|
||||
mesh = SubResource("PlaneMesh_gsfny")
|
||||
skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = ExtResource("2_4xv0h")
|
||||
|
||||
[node name="MeshInstance3D22" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World/Fog" unique_id=1897543279]
|
||||
transform = Transform3D(-4.683309e-08, -0.37123537, 6.900085e-09, 0, -1.6227208e-08, -0.15785554, 1.0714161, -1.6227261e-08, 3.0160853e-16, -0.1758312, 0.027557772, 4.076659)
|
||||
mesh = SubResource("PlaneMesh_gsfny")
|
||||
skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = ExtResource("2_4xv0h")
|
||||
|
||||
[node name="MeshInstance3D24" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World/Fog" unique_id=1013039618]
|
||||
transform = Transform3D(-0.0005423392, -0.37123534, 6.900085e-09, -5.620008e-23, -1.6227206e-08, -0.15785554, 1.0714161, -0.00018791536, 3.4927482e-12, -0.11607209, 0.027557772, 2.2087526)
|
||||
mesh = SubResource("PlaneMesh_gsfny")
|
||||
skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = ExtResource("2_4xv0h")
|
||||
|
||||
[node name="MeshInstance3D25" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World/Fog" unique_id=401092751]
|
||||
transform = Transform3D(0.040370595, -0.030550359, 6.8828014e-09, 2.9938556e-23, -1.338751e-09, -0.15785554, -0.56932855, -0.002166302, 4.880533e-10, -0.1365823, 0.027557824, 1.0812811)
|
||||
mesh = SubResource("PlaneMesh_gsfny")
|
||||
skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = ExtResource("2_4xv0h")
|
||||
|
||||
[node name="MeshInstance3D26" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World/Fog" unique_id=1373764872]
|
||||
transform = Transform3D(0.054542374, -0.02380248, 5.3307776e-09, 2.0053278e-17, -1.3467298e-09, -0.15785556, -0.06636552, -0.019562026, 4.3810915e-09, -0.056829393, 0.02755782, 0.54299366)
|
||||
transform = Transform3D(0.043454673, -0.010095915, 5.972678e-05, -0.0010768108, -0.1055714, -0.09403253, 0.0018440381, 0.1762621, -0.05631697, -0.21667156, 0.027557772, 2.835077)
|
||||
mesh = SubResource("PlaneMesh_gsfny")
|
||||
skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = ExtResource("2_4xv0h")
|
||||
|
||||
[node name="MeshInstance3D27" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World/Fog" unique_id=757807178]
|
||||
transform = Transform3D(0.023630448, 0.105280176, -6.8980293e-09, 2.182254e-16, -4.603308e-09, -0.15785556, 0.96897835, -0.0025674512, 1.6822002e-10, 0.011065975, 0.02755782, 1.3067662)
|
||||
transform = Transform3D(0.023630448, 0.105280176, -6.8980284e-09, 2.182254e-16, -4.603308e-09, -0.15785556, 0.9689784, -0.0025674512, 1.6822005e-10, -0.0900625, 0.02755782, 1.7380874)
|
||||
mesh = SubResource("PlaneMesh_gsfny")
|
||||
skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = ExtResource("2_4xv0h")
|
||||
|
||||
[node name="MeshInstance3D28" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World/Fog" unique_id=1978978515]
|
||||
transform = Transform3D(-0.0035864632, 0.105310775, -6.900033e-09, 1.6347773e-16, -4.603309e-09, -0.15785556, 0.96925986, 0.00038968676, -2.5533683e-11, 0.027688473, 0.02755782, 2.9139419)
|
||||
transform = Transform3D(-0.0035864627, 0.105310775, -6.900032e-09, 1.6347773e-16, -4.603309e-09, -0.15785556, 0.96925986, 0.00038968681, -2.5533683e-11, -0.07344, 0.02755782, 3.345263)
|
||||
mesh = SubResource("PlaneMesh_gsfny")
|
||||
skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = ExtResource("2_4xv0h")
|
||||
|
||||
[node name="MeshInstance3D29" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World/Fog" unique_id=1686710496]
|
||||
transform = Transform3D(-0.044475347, 0.109151766, -6.8844277e-09, 1.1142897e-16, -4.7820206e-09, -0.15785556, 0.6591685, 0.007364694, -4.6450768e-10, -0.009697363, 0.02755782, 4.184753)
|
||||
transform = Transform3D(-0.04447534, 0.109151766, -6.8844277e-09, 1.1142897e-16, -4.7820206e-09, -0.15785556, 0.6591685, 0.007364694, -4.6450768e-10, -0.11082584, 0.02755782, 4.6160746)
|
||||
mesh = SubResource("PlaneMesh_gsfny")
|
||||
skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = ExtResource("2_4xv0h")
|
||||
@@ -942,7 +901,7 @@ skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = ExtResource("2_4xv0h")
|
||||
|
||||
[node name="MeshInstance3D23" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World/Fog" unique_id=1093148548]
|
||||
transform = Transform3D(0.028270675, -0.3711061, 6.897683e-09, -5.5245266e-17, -1.6227208e-08, -0.15785556, 1.0710434, 0.009795522, -1.8206756e-10, -0.36126035, 0.0052291974, 2.0960937)
|
||||
transform = Transform3D(0.028270675, -0.3711061, 6.897683e-09, -5.5245266e-17, -1.6227208e-08, -0.15785556, 1.0710434, 0.009795523, -1.8206756e-10, -0.36126035, -0.022093408, 1.9300786)
|
||||
mesh = SubResource("PlaneMesh_gsfny")
|
||||
skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = ExtResource("2_4xv0h")
|
||||
@@ -959,12 +918,6 @@ mesh = SubResource("PlaneMesh_gsfny")
|
||||
skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = ExtResource("2_4xv0h")
|
||||
|
||||
[node name="MeshInstance3D21" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World/Fog" unique_id=444533733]
|
||||
transform = Transform3D(-0.0016394549, 0.5418779, -0.001133247, 0.00079157925, -0.0020432756, -0.30051196, -2.1971636, -0.00040508603, -0.00010742098, 0.004052371, -0.0031133778, 2.8505063)
|
||||
mesh = SubResource("PlaneMesh_gsfny")
|
||||
skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = ExtResource("2_4xv0h")
|
||||
|
||||
[node name="MeshInstance3D15" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World/Fog" unique_id=1964726645]
|
||||
transform = Transform3D(0.16890842, 0.24045627, -0.0005966671, -6.780159e-05, -0.0020561107, -0.3004088, 0.08298969, -0.489401, 0.0009689623, -0.10889866, 0.13782798, 10.074109)
|
||||
mesh = SubResource("PlaneMesh_gsfny")
|
||||
@@ -1036,79 +989,43 @@ skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = SubResource("ShaderMaterial_xjipq")
|
||||
|
||||
[node name="MeshInstance3D13" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World/Fondali" unique_id=616021345]
|
||||
transform = Transform3D(-0.13799974, 0, 0.85117775, 0, 0.08176458, 0, -0.22378989, 0, -0.5248777, -0.5169594, -0.34356955, 0.63507587)
|
||||
transform = Transform3D(-0.09507391, 0, 0.9771742, 0, 0.08176458, 0, -0.12734716, 0, -0.72953165, -0.41438007, -0.36002123, 0.579409)
|
||||
mesh = SubResource("QuadMesh_jfpsf")
|
||||
skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = SubResource("ShaderMaterial_xjipq")
|
||||
|
||||
[node name="MeshInstance3D16" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World/Fondali" unique_id=357888742]
|
||||
transform = Transform3D(-0.03727403, 0.012348853, 0.9783105, -0.0035826864, 0.08077536, -0.15448463, -0.26023775, -0.0028807682, -0.13799739, -0.5932654, -0.34356955, 0.39825928)
|
||||
transform = Transform3D(0.08114449, 0.0123587595, 1.0837933, -0.0026634638, 0.08354299, -0.18645942, -0.17780094, 0.0043887906, 0.49741283, -0.5437374, -0.34356955, 0.36981982)
|
||||
mesh = SubResource("QuadMesh_jfpsf")
|
||||
skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = SubResource("ShaderMaterial_xjipq")
|
||||
|
||||
[node name="MeshInstance3D25" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World/Fondali" unique_id=778715299]
|
||||
transform = Transform3D(0.23385109, 0.0067507722, 0.4495233, -0.0035826867, 0.080775365, -0.15448464, -0.1201113, 0.010734064, 0.87980896, -0.5300503, -0.34356955, 0.23068687)
|
||||
transform = Transform3D(0.13611734, 0.0022021658, 0.07928619, -0.0018634882, 0.07731771, -0.13293788, -0.013042056, 0.01193618, 0.84648985, -0.44087553, -0.34356955, 0.3021291)
|
||||
mesh = SubResource("QuadMesh_jfpsf")
|
||||
skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = SubResource("ShaderMaterial_xjipq")
|
||||
|
||||
[node name="MeshInstance3D26" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World/Fondali" unique_id=1412220944]
|
||||
transform = Transform3D(0.16075234, -0.009322591, -0.78305227, -0.003582686, 0.08077537, -0.15448466, 0.20801869, 0.008595484, 0.60246515, -0.34326243, -0.34356952, 0.26565123)
|
||||
transform = Transform3D(0.087180555, -0.011552672, -0.9327844, -0.0035826832, 0.08077537, -0.15448467, 0.2480174, 0.0052277013, 0.3256512, -0.3361349, -0.34356952, 0.416931)
|
||||
mesh = SubResource("QuadMesh_jfpsf")
|
||||
skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = SubResource("ShaderMaterial_xjipq")
|
||||
|
||||
[node name="MeshInstance3D27" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World/Fondali" unique_id=1494524637]
|
||||
transform = Transform3D(-0.045677815, -0.0126316715, -0.9725999, -0.0035826892, 0.08077537, -0.15448466, 0.2588951, -0.0011108485, -0.17373715, -0.2889233, -0.34356952, 0.5475807)
|
||||
mesh = SubResource("QuadMesh_jfpsf")
|
||||
skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = SubResource("ShaderMaterial_xjipq")
|
||||
|
||||
[node name="MeshInstance3D17" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World/Fondali" unique_id=969086818]
|
||||
transform = Transform3D(-0.01834004, 0, 1.0015494, 0, 0.08176457, 0, -0.27238372, 0, -0.067435935, 0.08823083, -0.34356952, 0.57443184)
|
||||
transform = Transform3D(0.26267588, 0.0016141435, 0.038116224, -0.0035826885, 0.080775365, -0.15448464, -0.010702037, 0.0125772655, 0.98726016, -0.22054955, -0.34356952, 0.6679051)
|
||||
mesh = SubResource("QuadMesh_jfpsf")
|
||||
skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = SubResource("ShaderMaterial_xjipq")
|
||||
|
||||
[node name="MeshInstance3D18" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World/Fondali" unique_id=1090412117]
|
||||
transform = Transform3D(-0.042076424, 0, 0.98711115, 0, 0.08176458, 0, -0.25952932, 0, -0.16003633, 0.030102232, -0.34356952, 0.8362099)
|
||||
mesh = SubResource("QuadMesh_jfpsf")
|
||||
skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = SubResource("ShaderMaterial_xjipq")
|
||||
|
||||
[node name="MeshInstance3D19" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World/Fondali" unique_id=1333469856]
|
||||
transform = Transform3D(-0.26256934, 0, -0.051482014, 0, 0.08176458, 0, 0.013535524, 0, -0.998674, 0.17872526, -0.34356952, 0.9654339)
|
||||
mesh = SubResource("QuadMesh_jfpsf")
|
||||
skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = SubResource("ShaderMaterial_xjipq")
|
||||
|
||||
[node name="MeshInstance3D20" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World/Fondali" unique_id=1486322614]
|
||||
transform = Transform3D(-0.17675701, 0, -0.74028903, 0, 0.08176458, 0, 0.19463517, 0, -0.67228913, 0.40079242, -0.34356952, 0.8625885)
|
||||
transform = Transform3D(-0.26278958, 0, 0.03125363, 0, 0.08176457, 0, -0.008217153, 0, -0.9995117, -0.124415405, -0.34356952, 0.97896427)
|
||||
mesh = SubResource("QuadMesh_jfpsf")
|
||||
skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = SubResource("ShaderMaterial_xjipq")
|
||||
|
||||
[node name="MeshInstance3D21" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World/Fondali" unique_id=989608041]
|
||||
transform = Transform3D(-0.015258381, 0, -0.99831504, 0, 0.081764586, 0, 0.26247498, 0, -0.058034096, 0.4964643, -0.34356952, 0.6347427)
|
||||
mesh = SubResource("QuadMesh_jfpsf")
|
||||
skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = SubResource("ShaderMaterial_xjipq")
|
||||
|
||||
[node name="MeshInstance3D22" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World/Fondali" unique_id=1598002389]
|
||||
transform = Transform3D(0.07209944, 0, -0.9616653, 0, 0.08176459, 0, 0.2528392, 0, 0.27422825, 0.467239, -0.34356952, 0.38215792)
|
||||
mesh = SubResource("QuadMesh_jfpsf")
|
||||
skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = SubResource("ShaderMaterial_xjipq")
|
||||
|
||||
[node name="MeshInstance3D23" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World/Fondali" unique_id=1911956756]
|
||||
transform = Transform3D(0.26289696, 0, 0.012723468, 0, 0.08176459, 0, -0.0033450995, 0, 0.9999199, 0.29866382, -0.3441152, 0.2540748)
|
||||
mesh = SubResource("QuadMesh_jfpsf")
|
||||
skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = SubResource("ShaderMaterial_xjipq")
|
||||
|
||||
[node name="MeshInstance3D24" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World/Fondali" unique_id=43616988]
|
||||
transform = Transform3D(0.18421313, 0, 0.7135083, 0, 0.08176459, 0, -0.18759415, 0, 0.70064837, 0.08231081, -0.34311438, 0.3474079)
|
||||
transform = Transform3D(-0.015258381, 0, -0.99831504, 0, 0.081764586, 0, 0.26247498, 0, -0.058034096, 0.22450101, -0.34356952, 0.7123806)
|
||||
mesh = SubResource("QuadMesh_jfpsf")
|
||||
skeleton = NodePath("../../../../..")
|
||||
surface_material_override/0 = SubResource("ShaderMaterial_xjipq")
|
||||
|
||||
11
Scenes/Godrays_Scene.tscn
Normal file
11
Scenes/Godrays_Scene.tscn
Normal file
@@ -0,0 +1,11 @@
|
||||
[gd_scene format=3 uid="uid://bvynwhkogurml"]
|
||||
|
||||
[ext_resource type="PlaneMesh" uid="uid://djremrthsiasg" path="res://Assets/Meshes/Godrays.tres" id="1_ua621"]
|
||||
[ext_resource type="Script" uid="uid://duu1t8cjm12oi" path="res://GodrayBurst.gd" id="1_viats"]
|
||||
[ext_resource type="Material" uid="uid://cwbxvmtih5wsc" path="res://Materials/GodRays.tres" id="2_ua621"]
|
||||
|
||||
[node name="Node3D" type="MeshInstance3D" unique_id=1364530594]
|
||||
transform = Transform3D(3.395, 0, 0, 0, -3.1996737e-07, 13.035, 0, -7.32, -5.6977797e-07, 0, 0, 0)
|
||||
mesh = ExtResource("1_ua621")
|
||||
surface_material_override/0 = ExtResource("2_ua621")
|
||||
script = ExtResource("1_viats")
|
||||
@@ -1,7 +1,5 @@
|
||||
extends Node3D
|
||||
|
||||
|
||||
|
||||
@export_group("Luce Direzionale e Ambiente")
|
||||
@export var color_mattina: Color = Color(1.0, 0.9, 0.8, 1.0)
|
||||
@export var color_pomeriggio: Color = Color(1.0, 0.6, 0.2, 1.0)
|
||||
@@ -23,10 +21,8 @@ extends Node3D
|
||||
@export_range(0.0, 1.0) var energia_luce_notte: float = 0.3
|
||||
|
||||
@export_group("Materiali Extra")
|
||||
|
||||
@export var materiale_nebbia: ShaderMaterial
|
||||
@export var materiale_pioggia_gocce: StandardMaterial3D
|
||||
# --- NUOVA VARIABILE PER LE NUVOLE ---
|
||||
@export var materiale_nuvole: ShaderMaterial
|
||||
|
||||
@export_group("Meteo (Pioggia & Fulmini)")
|
||||
@@ -39,9 +35,27 @@ extends Node3D
|
||||
@export var scala_min_fulmine: float = 1.0
|
||||
@export var scala_max_fulmine: float = 3.0
|
||||
|
||||
# --- NUOVI PARAMETRI CINEMATIC MODE ---
|
||||
@export_group("Cinematic Mode Ambiente")
|
||||
@export var intervallo_eventi_meteo: float = 8.0 # Ogni quanti secondi cambia qualcosa da solo
|
||||
@export var intervallo_eventi_meteo: float = 8.0
|
||||
|
||||
# --- NUOVO: PARAMETRI GOD RAYS ---
|
||||
@export_group("God Rays")
|
||||
@export var godray_scene: PackedScene
|
||||
@export var max_rain_godrays: int = 8
|
||||
@export var godray_spawn_radius: float = 15.0
|
||||
|
||||
# --- NUOVE VARIABILI PER L'ISOMETRICA ---
|
||||
# Sposta il centro in cui nascono i raggi (es. più a destra e più in alto)
|
||||
@export var godray_spawn_offset: Vector3 = Vector3(15.0, 5.0, -15.0)
|
||||
# Incliniamo i raggi per farli spiovere dall'alto a destra.
|
||||
# (X negativa li inclina in avanti, Z li fa "stendere" diagonalmente sullo schermo)
|
||||
@export var godray_rotation_degrees: Vector3 = Vector3(-45.0, 45.0, -30.0)
|
||||
|
||||
# Quanto in alto rispetto al suolo/treno devono nascere
|
||||
@export var godray_spawn_height: float = 5.0
|
||||
|
||||
# Quanto devono essere lunghi i raggi (scala Y) e larghi (scala X)
|
||||
@export var godray_scale: Vector3 = Vector3(2.0, 6.0, 2.0)
|
||||
|
||||
@onready var sole: DirectionalLight3D = $DirectionalLight3D
|
||||
@onready var ambiente: WorldEnvironment = $WorldEnvironment
|
||||
@@ -49,7 +63,9 @@ extends Node3D
|
||||
@onready var bottone_pioggia: CheckButton = $CanvasLayer/CheckButtonPioggia
|
||||
@onready var particelle_pioggia: GPUParticles3D = $SubViewportContainer/SubViewport/World/Camere/PioggiaCadente
|
||||
|
||||
# --- NODI FULMINE ---
|
||||
# --- NUOVO: RIFERIMENTO AL NODO DELLE CAMERE PER FARLI MUOVERE COL TRENO ---
|
||||
@onready var nodo_camere: Node3D = $SubViewportContainer/SubViewport/World/Camere
|
||||
|
||||
@onready var luce_lampo: DirectionalLight3D = $LuceLampo
|
||||
@onready var sprite_fulmine: Sprite3D = $SubViewportContainer/SubViewport/World/Camere/SpriteFulmine
|
||||
|
||||
@@ -58,10 +74,9 @@ var is_raining: bool = false
|
||||
var intensita_pioggia: float = 0.0
|
||||
var timer_prossimo_fulmine: float = 0.0
|
||||
|
||||
# Variabili Cinematic Mode
|
||||
var is_cinematic_mode: bool = false
|
||||
var timer_cinematic_env: float = 0.0
|
||||
var sto_cambiando_in_cinematic: bool = false # Serve per non disattivare la modalità quando lo script clicca i bottoni da solo
|
||||
var sto_cambiando_in_cinematic: bool = false
|
||||
|
||||
func _ready() -> void:
|
||||
if menu_giornata:
|
||||
@@ -80,28 +95,23 @@ func _ready() -> void:
|
||||
|
||||
_resetta_timer_fulmine()
|
||||
|
||||
# --- ASCOLTO TASTIERA PER CINEMATIC MODE ---
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event is InputEventKey and event.pressed and not event.echo:
|
||||
|
||||
# Attiva/Disattiva con C
|
||||
if event.keycode == KEY_C:
|
||||
is_cinematic_mode = !is_cinematic_mode
|
||||
if is_cinematic_mode:
|
||||
timer_cinematic_env = intervallo_eventi_meteo # Fa scattare un evento quasi subito
|
||||
timer_cinematic_env = intervallo_eventi_meteo
|
||||
print("Ambiente Cinematic: ATTIVATA")
|
||||
else:
|
||||
print("Ambiente Cinematic: DISATTIVATA")
|
||||
return
|
||||
|
||||
# Se premi le camere, si ferma la cinematic mode
|
||||
if event.keycode in [KEY_1, KEY_2, KEY_3, KEY_4, KEY_5]:
|
||||
if is_cinematic_mode:
|
||||
is_cinematic_mode = false
|
||||
print("Ambiente Cinematic: DISATTIVATA (Cambio camera manuale)")
|
||||
|
||||
func _on_giornata_selezionata(index: int) -> void:
|
||||
# Se l'utente clicca la tendina a mano, spegni la cinematic mode
|
||||
if not sto_cambiando_in_cinematic and is_cinematic_mode:
|
||||
is_cinematic_mode = false
|
||||
print("Ambiente Cinematic: DISATTIVATA (Orario cambiato manualmente)")
|
||||
@@ -113,32 +123,33 @@ func _on_giornata_selezionata(index: int) -> void:
|
||||
tween_giorno.set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_IN_OUT)
|
||||
tween_giorno.tween_property(self, "tempo_giorno", target_tempo, durata_transizione)
|
||||
|
||||
|
||||
|
||||
|
||||
# --- NUOVO: SE E' MATTINA (Index 0), SPAWNA IL GODRAY ---
|
||||
if index == 0:
|
||||
trigger_morning()
|
||||
|
||||
func _on_pioggia_toggled(toggled_on: bool) -> void:
|
||||
# Se l'utente clicca il bottone della pioggia a mano, spegni la cinematic mode
|
||||
if not sto_cambiando_in_cinematic and is_cinematic_mode:
|
||||
is_cinematic_mode = false
|
||||
print("Ambiente Cinematic: DISATTIVATA (Pioggia cambiata manualmente)")
|
||||
|
||||
# --- NUOVO: SALVIAMO LO STATO PRECEDENTE PER CAPIRE SE HA SMESSO ---
|
||||
var stava_piovendo = is_raining
|
||||
|
||||
is_raining = toggled_on
|
||||
if particelle_pioggia:
|
||||
particelle_pioggia.emitting = is_raining
|
||||
|
||||
|
||||
|
||||
# --- NUOVO: SE STAVA PIOVENDO E ORA NON PIOVE PIÙ, SPAWNA TANTI GODRAYS ---
|
||||
if stava_piovendo and not is_raining:
|
||||
trigger_after_rain()
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
# --- LOGICA EVENTI CASUALI CINEMATIC MODE ---
|
||||
if is_cinematic_mode:
|
||||
timer_cinematic_env -= delta
|
||||
if timer_cinematic_env <= 0.0:
|
||||
_genera_evento_meteo_casuale()
|
||||
timer_cinematic_env = randf_range(intervallo_eventi_meteo * 0.8, intervallo_eventi_meteo * 1.5)
|
||||
|
||||
# --- LOGICA NORMALE AMBIENTE ---
|
||||
var base_tint: Color
|
||||
var base_sky_top: Color
|
||||
var base_sky_horizon: Color
|
||||
@@ -153,9 +164,7 @@ func _process(delta: float) -> void:
|
||||
else:
|
||||
intensita_pioggia = move_toward(intensita_pioggia, 0.0, delta * 0.5)
|
||||
|
||||
# --- LOGICA NUVOLE: SI ADDENSANO CON LA PIOGGIA ---
|
||||
if materiale_nuvole:
|
||||
# lerp fa una transizione fluida tra 0.4 (limpido) e 1.0 (coperto) in base all'intensità della pioggia
|
||||
var densita_attuale = lerp(0.4, 1.0, intensita_pioggia)
|
||||
materiale_nuvole.set_shader_parameter("cloud_density", densita_attuale)
|
||||
var sharpness_attuale = lerp(0.14, 0.0, intensita_pioggia)
|
||||
@@ -204,7 +213,6 @@ func _process(delta: float) -> void:
|
||||
materiale_nebbia.set_shader_parameter("night_intensity", night_val)
|
||||
materiale_nebbia.set_shader_parameter("sun_color", final_tint)
|
||||
|
||||
# --- FUNZIONE GENERATORE CASUALE ---
|
||||
func _genera_evento_meteo_casuale() -> void:
|
||||
sto_cambiando_in_cinematic = true
|
||||
|
||||
@@ -231,11 +239,9 @@ func _genera_evento_meteo_casuale() -> void:
|
||||
|
||||
sto_cambiando_in_cinematic = false
|
||||
|
||||
# --- FUNZIONI FULMINI ---
|
||||
func _resetta_timer_fulmine() -> void:
|
||||
timer_prossimo_fulmine = randf_range(tempo_min_fulmine, tempo_max_fulmine)
|
||||
|
||||
# --- FUNZIONI FULMINI ---
|
||||
func _scatena_fulmine() -> void:
|
||||
if luce_lampo:
|
||||
var tween_luce = create_tween()
|
||||
@@ -254,11 +260,8 @@ func _scatena_fulmine() -> void:
|
||||
var angolo_casuale = randf() * TAU
|
||||
var distanza = randf_range(10.0, 40.0)
|
||||
|
||||
# Ho abbassato la Y da 20.0 a 10.0. Se non lo vedi ancora, abbassala a 5.0!
|
||||
sprite_fulmine.position = Vector3(cos(angolo_casuale) * distanza, 10.0, sin(angolo_casuale) * distanza)
|
||||
|
||||
# VIA LA RIGA LOOK_AT! Ci pensa il Billboard dell'Inspector ora.
|
||||
|
||||
sprite_fulmine.modulate = colore_fulmine
|
||||
sprite_fulmine.modulate.a = 1.0
|
||||
|
||||
@@ -266,11 +269,53 @@ func _scatena_fulmine() -> void:
|
||||
sprite_fulmine.scale = Vector3(s, s, s)
|
||||
|
||||
var tween_sprite = create_tween()
|
||||
# Ora rimane visibile al 100% per 0.2 secondi (il doppio)
|
||||
tween_sprite.tween_interval(0.2)
|
||||
# Ora ci mette 0.4 secondi a svanire dolcemente (il doppio)
|
||||
tween_sprite.tween_property(sprite_fulmine, "modulate:a", 0.0, 0.4)
|
||||
|
||||
if numero_scariche > 1:
|
||||
await get_tree().create_timer(randf_range(0.05, 0.15)).timeout
|
||||
# --- FUNZIONI GOD RAYS ---
|
||||
|
||||
# ==========================================
|
||||
# --- FUNZIONI GOD RAYS INTEGRATE ---
|
||||
# ==========================================
|
||||
|
||||
func trigger_morning() -> void:
|
||||
# Quando è mattina spara un solo godray vicino al treno
|
||||
spawn_single_godray()
|
||||
|
||||
func trigger_after_rain() -> void:
|
||||
# Evitiamo di farli spawnare se piove di notte (tempo_giorno >= 2.5)
|
||||
if tempo_giorno < 2.5:
|
||||
for i in range(max_rain_godrays):
|
||||
spawn_single_godray()
|
||||
|
||||
func spawn_single_godray() -> void:
|
||||
if godray_scene == null:
|
||||
print("Attenzione: Manca la scena del Godray nell'Inspector!")
|
||||
return
|
||||
if nodo_camere == null:
|
||||
print("Attenzione: Non trovo il nodo Camere per agganciare il Godray!")
|
||||
return
|
||||
|
||||
var ray = godray_scene.instantiate()
|
||||
|
||||
# --- LA MAGIA È QUI ---
|
||||
# Invece di aggiungerli a "nodo_camere" (che si muove),
|
||||
# li aggiungiamo al genitore delle camere (il nodo "World"), che è fermo!
|
||||
var nodo_mondo = nodo_camere.get_parent()
|
||||
nodo_mondo.add_child(ray)
|
||||
|
||||
# Calcoliamo una posizione casuale
|
||||
var random_x = randf_range(-godray_spawn_radius, godray_spawn_radius)
|
||||
var random_z = randf_range(-godray_spawn_radius, godray_spawn_radius)
|
||||
|
||||
# Usiamo la GLOBAL_POSITION: Il raggio prende le coordinate globali di dov'è la
|
||||
# telecamera in QUESTO preciso millisecondo, e ci aggiunge il suo offset casuale.
|
||||
# Da questo momento in poi, essendo figlio del Mondo, resterà immobile lì.
|
||||
ray.global_position = nodo_camere.global_position + Vector3(random_x, godray_spawn_height, random_z)
|
||||
|
||||
# Li incliniamo tutti uguali per farli piovere dall'angolo
|
||||
ray.rotation_degrees = godray_rotation_degrees
|
||||
|
||||
# Li allunghiamo per farli sembrare veri fasci di luce
|
||||
ray.scale = godray_scale
|
||||
|
||||
Reference in New Issue
Block a user