feat(environment): add painterly skies and living meadows
This commit is contained in:
+36
-10
@@ -32,6 +32,7 @@ static var _viewport_scale_states: Dictionary = {}
|
||||
var _active_presentation_quality := -1
|
||||
var _authored_presentation_captured := false
|
||||
var _authored_render_scale := 1.0
|
||||
var _authored_msaa: int = Viewport.MSAA_DISABLED
|
||||
var _authored_glow_enabled := false
|
||||
var _authored_volumetric_fog_enabled := HIGH_VOLUMETRIC_FOG_ENABLED
|
||||
var _authored_adjustment_enabled := false
|
||||
@@ -45,6 +46,7 @@ var _authored_grass_interactors := 1
|
||||
var _authored_grass_update_interval := 0.1
|
||||
var _authored_grass_controller_enabled := true
|
||||
var _last_applied_render_scale := -1.0
|
||||
var _last_applied_msaa := -1
|
||||
var _viewport_instance_id := 0
|
||||
|
||||
|
||||
@@ -78,7 +80,8 @@ func apply_presentation_quality(quality: int) -> bool:
|
||||
_authored_volumetric_fog_enabled,
|
||||
_authored_adjustment_enabled,
|
||||
_authored_shadow_distance,
|
||||
_authored_shadow_mode
|
||||
_authored_shadow_mode,
|
||||
_authored_msaa
|
||||
)
|
||||
_apply_grass_quality(
|
||||
_authored_grass_visible,
|
||||
@@ -96,7 +99,8 @@ func apply_presentation_quality(quality: int) -> bool:
|
||||
false,
|
||||
_authored_adjustment_enabled,
|
||||
minf(_authored_shadow_distance, BALANCED_SHADOW_DISTANCE),
|
||||
DirectionalLight3D.SHADOW_PARALLEL_2_SPLITS
|
||||
DirectionalLight3D.SHADOW_PARALLEL_2_SPLITS,
|
||||
mini(_authored_msaa, Viewport.MSAA_2X)
|
||||
)
|
||||
_apply_grass_quality(
|
||||
_authored_grass_visible,
|
||||
@@ -114,7 +118,8 @@ func apply_presentation_quality(quality: int) -> bool:
|
||||
false,
|
||||
false,
|
||||
minf(_authored_shadow_distance, LOW_SHADOW_DISTANCE),
|
||||
DirectionalLight3D.SHADOW_ORTHOGONAL
|
||||
DirectionalLight3D.SHADOW_ORTHOGONAL,
|
||||
Viewport.MSAA_DISABLED
|
||||
)
|
||||
_apply_grass_quality(
|
||||
false,
|
||||
@@ -126,6 +131,9 @@ func apply_presentation_quality(quality: int) -> bool:
|
||||
false
|
||||
)
|
||||
|
||||
var meadow := get_node_or_null("PainterlyMeadow")
|
||||
if meadow != null:
|
||||
meadow.call("apply_presentation_quality", quality)
|
||||
_active_presentation_quality = quality
|
||||
return true
|
||||
|
||||
@@ -223,11 +231,14 @@ func _apply_environment_quality(
|
||||
volumetric_fog_enabled: bool,
|
||||
adjustment_enabled: bool,
|
||||
shadow_distance: float,
|
||||
shadow_mode: int
|
||||
shadow_mode: int,
|
||||
msaa: int
|
||||
) -> void:
|
||||
_claim_viewport_scale_owner()
|
||||
get_viewport().scaling_3d_scale = render_scale
|
||||
get_viewport().msaa_3d = msaa
|
||||
_last_applied_render_scale = render_scale
|
||||
_last_applied_msaa = msaa
|
||||
var environment := _environment()
|
||||
if environment != null:
|
||||
environment.glow_enabled = glow_enabled
|
||||
@@ -285,8 +296,13 @@ func _register_viewport_scale_owner() -> void:
|
||||
_viewport_instance_id = viewport.get_instance_id()
|
||||
var state: Dictionary = _viewport_scale_states.get(_viewport_instance_id, {})
|
||||
if state.is_empty():
|
||||
state = {"base_scale": viewport.scaling_3d_scale, "owners": []}
|
||||
state = {
|
||||
"base_scale": viewport.scaling_3d_scale,
|
||||
"base_msaa": viewport.msaa_3d,
|
||||
"owners": [],
|
||||
}
|
||||
_authored_render_scale = float(state["base_scale"])
|
||||
_authored_msaa = int(state["base_msaa"])
|
||||
_viewport_scale_states[_viewport_instance_id] = state
|
||||
_claim_viewport_scale_owner()
|
||||
|
||||
@@ -324,13 +340,20 @@ func _release_viewport_scale_owner() -> void:
|
||||
if not owners.is_empty():
|
||||
state["owners"] = owners
|
||||
_viewport_scale_states[_viewport_instance_id] = state
|
||||
if (
|
||||
was_active_owner
|
||||
and is_equal_approx(viewport.scaling_3d_scale, _last_applied_render_scale)
|
||||
):
|
||||
if was_active_owner:
|
||||
var previous_owner := (owners[-1] as WeakRef).get_ref() as JajceWorld
|
||||
if previous_owner != null and previous_owner._last_applied_render_scale >= 0.0:
|
||||
if (
|
||||
previous_owner != null
|
||||
and previous_owner._last_applied_render_scale >= 0.0
|
||||
and is_equal_approx(viewport.scaling_3d_scale, _last_applied_render_scale)
|
||||
):
|
||||
viewport.scaling_3d_scale = previous_owner._last_applied_render_scale
|
||||
if (
|
||||
previous_owner != null
|
||||
and previous_owner._last_applied_msaa >= 0
|
||||
and viewport.msaa_3d == _last_applied_msaa
|
||||
):
|
||||
viewport.msaa_3d = previous_owner._last_applied_msaa
|
||||
else:
|
||||
_viewport_scale_states.erase(_viewport_instance_id)
|
||||
if (
|
||||
@@ -338,8 +361,11 @@ func _release_viewport_scale_owner() -> void:
|
||||
and is_equal_approx(viewport.scaling_3d_scale, _last_applied_render_scale)
|
||||
):
|
||||
viewport.scaling_3d_scale = float(state["base_scale"])
|
||||
if was_active_owner and viewport.msaa_3d == _last_applied_msaa:
|
||||
viewport.msaa_3d = int(state["base_msaa"])
|
||||
_viewport_instance_id = 0
|
||||
_last_applied_render_scale = -1.0
|
||||
_last_applied_msaa = -1
|
||||
|
||||
|
||||
func _initialize_world_presentation() -> void:
|
||||
|
||||
Reference in New Issue
Block a user