1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-19 17:49:47 +00:00
Pixelorama/src/UI/UI.gd
Variable f7e866e9cb
Shader vision - Grayscale view (#646)
* ShaderVision Funcionality

* reference to ShaderVision

* Greyscale shader

* A minor code improvement

* decided on a checkbox

* decided on a checkbox

i foresaw the earlier implementation isn't required so i decided on a checkbox

* removed unneeded code

* reverted a mistake commit

* Update TopMenuContainer.gd

* Precieved Brightness
2022-02-12 00:47:26 +02:00

31 lines
948 B
GDScript

extends Panel
onready var main_canvas_container = Global.main_canvas_container
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
update_transparent_shader()
#Set anchors for ShaderVision
Global.greyscale_vision.visible = false
Global.greyscale_vision.anchor_left = ANCHOR_BEGIN
Global.greyscale_vision.anchor_top = ANCHOR_BEGIN
Global.greyscale_vision.anchor_right = ANCHOR_END
Global.greyscale_vision.anchor_bottom = ANCHOR_END
func _on_main_canvas_item_rect_changed() -> void:
update_transparent_shader()
func _on_main_canvas_visibility_changed() -> void:
update_transparent_shader()
func update_transparent_shader():
# works independently of the transparency frature
material.set("shader_param/screen_resolution", get_viewport().size)
material.set("shader_param/position", main_canvas_container.rect_global_position)
material.set("shader_param/size", main_canvas_container.rect_size)