RhythmGame/singletons/Video.gd

19 lines
567 B
GDScript3
Raw Permalink Normal View History

extends Node
# Video decoding is relatively expensive for Godot so we only want to do it once at a time.
var video := VideoPlayer.new()
var texture: Texture setget , get_texture
func get_texture() -> Texture:
return video.get_video_texture()
func _ready():
video.expand = false
add_child(video) # Needs to be in scene tree to make the textures
video.visible = false # Luckily this is enough to make the textures without rendering
video.volume = 0.0
func _process(delta: float) -> void:
get_tree().call_group('VideoTexRects', 'set_texture', self.texture)