From d4190fbd9e9e2a4cbcf7efcaf27314c7f39ab3ca Mon Sep 17 00:00:00 2001 From: Nordup Date: Tue, 16 Jul 2024 01:28:12 +0400 Subject: [PATCH] switch mobile, fix shader --- .gitignore | 5 ++++- app/project.godot | 2 +- app/scenes/menu_body/world.tscn | 2 +- app/scripts/debug-log/debug.gd | 6 +++--- app/scripts/loading/config_base.gd | 4 ++-- app/scripts/sandbox/render_result.gd | 2 +- app/shaders/render_result.gdshader | 14 +++++++++----- 7 files changed, 21 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index c120690..4eddd0f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ .DS_Store -.vscode/* \ No newline at end of file +.vscode/* + +# for ipc files (inter process communication) +app/sandbox \ No newline at end of file diff --git a/app/project.godot b/app/project.godot index 9ab2eaf..2ad2cb5 100644 --- a/app/project.godot +++ b/app/project.godot @@ -72,5 +72,5 @@ open_debug={ [rendering] textures/canvas_textures/default_texture_filter=2 +renderer/rendering_method="mobile" textures/default_filters/anisotropic_filtering_level=1 -anti_aliasing/quality/use_taa=true diff --git a/app/scenes/menu_body/world.tscn b/app/scenes/menu_body/world.tscn index c872bcf..2b54c4c 100644 --- a/app/scenes/menu_body/world.tscn +++ b/app/scenes/menu_body/world.tscn @@ -29,7 +29,7 @@ resource_local_to_scene = true shader = ExtResource("10_2auwe") shader_parameter/ext_texture_is_bgra = null -shader_parameter/fill_alpha = null +shader_parameter/show_render = null [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_bm5nj"] corner_radius_top_left = 25 diff --git a/app/scripts/debug-log/debug.gd b/app/scripts/debug-log/debug.gd index f7abb55..0d318e5 100644 --- a/app/scripts/debug-log/debug.gd +++ b/app/scripts/debug-log/debug.gd @@ -8,19 +8,19 @@ const WARN_CLR = Color.YELLOW const SILENT_CLR = Color.DIM_GRAY -func logr(msg) -> void: +func logr(msg: Variant) -> void: print_rich(str(msg)) logged.emit(str(msg)) -func logerr(msg) -> void: +func logerr(msg: Variant) -> void: printerr(str(msg)) var rich_clr = "[color=%s]%s[/color]" % [Color.RED.to_html(), str(msg)] logged.emit(rich_clr) error.emit(msg) -func logclr(msg, color: Color) -> void: +func logclr(msg: Variant, color: Color) -> void: var rich_clr = "[color=%s]%s[/color]" % [color.to_html(), str(msg)] print_rich(rich_clr) logged.emit(rich_clr) diff --git a/app/scripts/loading/config_base.gd b/app/scripts/loading/config_base.gd index 3086200..3e7efea 100644 --- a/app/scripts/loading/config_base.gd +++ b/app/scripts/loading/config_base.gd @@ -20,8 +20,8 @@ func get_string(section: String, key: String) -> String: return value -func get_value(section: String, key: String): - var value +func get_value(section: String, key: String) -> Variant: + var value: Variant if config.has_section_key(section, key): value = config.get_value(section, key) # Debug.logr(key + "=" + str(value)) diff --git a/app/scripts/sandbox/render_result.gd b/app/scripts/sandbox/render_result.gd index 300189d..dfc246a 100644 --- a/app/scripts/sandbox/render_result.gd +++ b/app/scripts/sandbox/render_result.gd @@ -70,7 +70,7 @@ func ext_texture_format(format: RenderingDevice.DataFormat) -> void: func first_frame_drawn() -> void: - set_param("fill_alpha", true) + set_param("show_render", true) func set_param(param: StringName, value: Variant) -> void: diff --git a/app/shaders/render_result.gdshader b/app/shaders/render_result.gdshader index eaa9b1a..8e3313d 100644 --- a/app/shaders/render_result.gdshader +++ b/app/shaders/render_result.gdshader @@ -1,14 +1,18 @@ shader_type canvas_item; uniform bool ext_texture_is_bgra; -uniform bool fill_alpha; +uniform bool show_render; + +const vec4 zero = vec4(0); void fragment() { + if (show_render) { + COLOR = vec4(COLOR.rgb, 1); + } else { + COLOR = zero; + } + if (ext_texture_is_bgra) { COLOR = COLOR.bgra; // Swizzle BGRA to RGBA } - - if (fill_alpha) { - COLOR = vec4(COLOR.r, COLOR.g, COLOR.b, 1); - } }