restore full world effects outside portmaster
This commit is contained in:
parent
4fda6e97f6
commit
41b4f86ddf
15 changed files with 398 additions and 122 deletions
|
|
@ -138,6 +138,7 @@ var _biome_assignments: Dictionary[Vector2i, StringName] = {}
|
|||
var _water_recovery_triangles_by_coordinate: Dictionary[Vector2i, Array] = {}
|
||||
var _home_accessible_elevations_by_coordinate: Dictionary[Vector2i, Array] = {}
|
||||
var _foliage_wind_enabled: bool = false
|
||||
var _foliage_wind_strength_multiplier: float = 1.0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
|
@ -218,6 +219,24 @@ func set_light_performance_profile(enabled: bool) -> void:
|
|||
_light_performance_profile = enabled
|
||||
_set_foliage_wind_enabled(not enabled)
|
||||
_apply_water_materials()
|
||||
var surface_motion := _get_ocean_surface_motion()
|
||||
if surface_motion != null:
|
||||
surface_motion.set_motion_enabled(not enabled)
|
||||
|
||||
|
||||
func set_foliage_wind_strength_multiplier(multiplier: float) -> void:
|
||||
_foliage_wind_strength_multiplier = maxf(multiplier, 0.0)
|
||||
_set_foliage_wind_enabled(_foliage_wind_enabled)
|
||||
|
||||
|
||||
func set_water_motion_strength_multiplier(multiplier: float) -> void:
|
||||
var surface_motion := _get_ocean_surface_motion()
|
||||
if surface_motion != null:
|
||||
surface_motion.set_motion_strength_multiplier(multiplier)
|
||||
|
||||
|
||||
func _get_ocean_surface_motion() -> WaterSurfaceMotion:
|
||||
return _ocean.get_node_or_null(^"VisualWater") as WaterSurfaceMotion
|
||||
|
||||
|
||||
func get_spawn_surface_triangles(
|
||||
|
|
@ -611,13 +630,29 @@ func _apply_foliage_wind_to_mesh(mesh_instance: MeshInstance3D) -> void:
|
|||
(mesh_global_scale.x + mesh_global_scale.z) * 0.5,
|
||||
0.001,
|
||||
)
|
||||
var local_strength: float = foliage_wind_strength / horizontal_scale
|
||||
var local_strength: float = (
|
||||
foliage_wind_strength * _foliage_wind_strength_multiplier
|
||||
/ horizontal_scale
|
||||
)
|
||||
var phase: float = fposmod(
|
||||
mesh_instance.global_position.x * 0.73
|
||||
+ mesh_instance.global_position.z * 0.41,
|
||||
TAU,
|
||||
)
|
||||
for surface_index: int in mesh_instance.mesh.get_surface_count():
|
||||
var override_material: Material = (
|
||||
mesh_instance.get_surface_override_material(surface_index)
|
||||
)
|
||||
var existing_wind := override_material as ShaderMaterial
|
||||
if (
|
||||
existing_wind != null
|
||||
and existing_wind.shader == FOLIAGE_WIND_SHADER
|
||||
):
|
||||
existing_wind.set_shader_parameter(
|
||||
"local_wind_strength",
|
||||
local_strength,
|
||||
)
|
||||
continue
|
||||
var source_material: Material = mesh_instance.get_active_material(
|
||||
surface_index
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=16 format=3]
|
||||
[gd_scene load_steps=17 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://world/generation/generated_world_region.gd" id="1_region"]
|
||||
[ext_resource type="Script" path="res://world/generation/terrain_chunk_generator.gd" id="2_generator"]
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
[ext_resource type="Resource" path="res://world/generation/biomes/terrain_biome_catalog.tres" id="13_biome_catalog"]
|
||||
[ext_resource type="PackedScene" path="res://world/interactables/decor_shop_world.tscn" id="14_decor_shop"]
|
||||
[ext_resource type="PackedScene" path="res://world/interactables/rv_upgrade_shop_world.tscn" id="15_rv_upgrade"]
|
||||
[ext_resource type="Script" path="res://world/water_surface_motion.gd" id="16_water_motion"]
|
||||
|
||||
[node name="GeneratedWorldRegion" type="Node3D"]
|
||||
script = ExtResource("1_region")
|
||||
|
|
@ -60,6 +61,9 @@ fish_pool = ExtResource("10_ocean_pool")
|
|||
water_type = 1
|
||||
location_tags = Array[StringName]([&"coast", &"ocean", &"generated_ocean"])
|
||||
|
||||
[node name="VisualWater" parent="WaterBodies/OceanWater" index="0"]
|
||||
script = ExtResource("16_water_motion")
|
||||
|
||||
[node name="FreshWaterBodies" type="Node3D" parent="WaterBodies"]
|
||||
unique_name_in_owner = true
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue