switch mobile, fix shader

This commit is contained in:
Nordup 2024-07-16 01:28:12 +04:00
parent 6d009d0fc1
commit d4190fbd9e
7 changed files with 21 additions and 14 deletions

3
.gitignore vendored
View file

@ -1,2 +1,5 @@
.DS_Store .DS_Store
.vscode/* .vscode/*
# for ipc files (inter process communication)
app/sandbox

View file

@ -72,5 +72,5 @@ open_debug={
[rendering] [rendering]
textures/canvas_textures/default_texture_filter=2 textures/canvas_textures/default_texture_filter=2
renderer/rendering_method="mobile"
textures/default_filters/anisotropic_filtering_level=1 textures/default_filters/anisotropic_filtering_level=1
anti_aliasing/quality/use_taa=true

View file

@ -29,7 +29,7 @@
resource_local_to_scene = true resource_local_to_scene = true
shader = ExtResource("10_2auwe") shader = ExtResource("10_2auwe")
shader_parameter/ext_texture_is_bgra = null shader_parameter/ext_texture_is_bgra = null
shader_parameter/fill_alpha = null shader_parameter/show_render = null
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_bm5nj"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_bm5nj"]
corner_radius_top_left = 25 corner_radius_top_left = 25

View file

@ -8,19 +8,19 @@ const WARN_CLR = Color.YELLOW
const SILENT_CLR = Color.DIM_GRAY const SILENT_CLR = Color.DIM_GRAY
func logr(msg) -> void: func logr(msg: Variant) -> void:
print_rich(str(msg)) print_rich(str(msg))
logged.emit(str(msg)) logged.emit(str(msg))
func logerr(msg) -> void: func logerr(msg: Variant) -> void:
printerr(str(msg)) printerr(str(msg))
var rich_clr = "[color=%s]%s[/color]" % [Color.RED.to_html(), str(msg)] var rich_clr = "[color=%s]%s[/color]" % [Color.RED.to_html(), str(msg)]
logged.emit(rich_clr) logged.emit(rich_clr)
error.emit(msg) 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)] var rich_clr = "[color=%s]%s[/color]" % [color.to_html(), str(msg)]
print_rich(rich_clr) print_rich(rich_clr)
logged.emit(rich_clr) logged.emit(rich_clr)

View file

@ -20,8 +20,8 @@ func get_string(section: String, key: String) -> String:
return value return value
func get_value(section: String, key: String): func get_value(section: String, key: String) -> Variant:
var value var value: Variant
if config.has_section_key(section, key): if config.has_section_key(section, key):
value = config.get_value(section, key) value = config.get_value(section, key)
# Debug.logr(key + "=" + str(value)) # Debug.logr(key + "=" + str(value))

View file

@ -70,7 +70,7 @@ func ext_texture_format(format: RenderingDevice.DataFormat) -> void:
func first_frame_drawn() -> void: func first_frame_drawn() -> void:
set_param("fill_alpha", true) set_param("show_render", true)
func set_param(param: StringName, value: Variant) -> void: func set_param(param: StringName, value: Variant) -> void:

View file

@ -1,14 +1,18 @@
shader_type canvas_item; shader_type canvas_item;
uniform bool ext_texture_is_bgra; uniform bool ext_texture_is_bgra;
uniform bool fill_alpha; uniform bool show_render;
const vec4 zero = vec4(0);
void fragment() { void fragment() {
if (show_render) {
COLOR = vec4(COLOR.rgb, 1);
} else {
COLOR = zero;
}
if (ext_texture_is_bgra) { if (ext_texture_is_bgra) {
COLOR = COLOR.bgra; // Swizzle BGRA to RGBA COLOR = COLOR.bgra; // Swizzle BGRA to RGBA
} }
if (fill_alpha) {
COLOR = vec4(COLOR.r, COLOR.g, COLOR.b, 1);
}
} }