updated viewport clearing

This change is needed in order to make use of the new introduced
set_clear_mode() function (I think the choosen enum value is ok since
its needed only once).
Updated in the following demos:
- 2D_in_3D
- 3D_in_2D
- screen_capture
This commit is contained in:
Michele Valente
2017-10-01 00:46:24 +02:00
parent cdbb53c1c2
commit 5326331666
3 changed files with 3 additions and 3 deletions

View File

@@ -3,7 +3,7 @@ extends Spatial
func _ready():
# Get the viewport and clear it
var viewport = get_node("Viewport")
viewport.clear()
viewport.set_clear_mode(Viewport.CLEAR_MODE_ONLY_NEXT_FRAME)
# Let two frames pass to make sure the vieport's is captured
yield(get_tree(), "idle_frame")
yield(get_tree(), "idle_frame")

View File

@@ -16,7 +16,7 @@ func _ready():
viewport_sprite = get_node("Viewport_Sprite")
# Assign the sprite's texture to the viewport texture
viewport.clear()
viewport.set_clear_mode(Viewport.CLEAR_MODE_ONLY_NEXT_FRAME)
# Let two frames pass to make sure the screen was captured
yield(get_tree(), "idle_frame")
yield(get_tree(), "idle_frame")

View File

@@ -7,7 +7,7 @@ func _ready():
func _on_button_pressed():
get_viewport().clear()
get_viewport().set_clear_mode(Viewport.CLEAR_MODE_ONLY_NEXT_FRAME)
# Let two frames pass to make sure the screen was captured
yield(get_tree(), "idle_frame")
yield(get_tree(), "idle_frame")