Environment adapter uses portal group
This commit is contained in:
parent
cbb4b51a94
commit
b67f0d9263
@ -63,6 +63,9 @@ var _exit_camera:Camera3D
|
||||
# The number of seconds until the viewport updates its size
|
||||
var _seconds_until_resize:float
|
||||
|
||||
func _enter_tree() -> void:
|
||||
add_to_group("portals")
|
||||
|
||||
func _ready() -> void:
|
||||
if not is_inside_tree():
|
||||
push_error("The portal \"%s\" is not inside a SceneTree." % name)
|
||||
|
@ -101,7 +101,6 @@ light_color = Color(0.887552, 0.489512, 0.22965, 1)
|
||||
light_energy = 3.0
|
||||
omni_range = 4.0
|
||||
|
||||
[node name="PortalEnvironmentAdapter" type="Node" parent="." node_paths=PackedStringArray("base", "portals")]
|
||||
[node name="PortalEnvironmentAdapter" type="Node" parent="." node_paths=PackedStringArray("base")]
|
||||
script = ExtResource("7_2gewm")
|
||||
base = NodePath("../WorldEnvironment")
|
||||
portals = [NodePath("../Portal_red"), NodePath("../Portal_orange")]
|
||||
|
@ -6,12 +6,14 @@ extends Node
|
||||
## tonemapping (linear with exposure 1).
|
||||
|
||||
@export var base: WorldEnvironment
|
||||
@export var portals: Array[Portal] = []
|
||||
|
||||
func _ready() -> void:
|
||||
var adapted_env: Environment = base.environment.duplicate(false)
|
||||
adapted_env.tonemap_mode = Environment.TONE_MAPPER_LINEAR
|
||||
# exposure is the only thing the linear tonemapper takes into account
|
||||
adapted_env.tonemap_exposure = 1
|
||||
|
||||
for p in portals:
|
||||
p.exit_environment = adapted_env
|
||||
for p in get_tree().get_nodes_in_group("portals"):
|
||||
print(p.name)
|
||||
if p is Portal:
|
||||
p.exit_environment = adapted_env
|
||||
|
Loading…
Reference in New Issue
Block a user