mobile support tweaks

This commit is contained in:
2026-08-23 20:32:52 +03:00
parent 008650a87e
commit ccc92f201f
15 changed files with 380 additions and 0 deletions
+66
View File
@@ -0,0 +1,66 @@
extends SceneTree
## Repro harness for the "bull + matador invisible on phone" bug. Loads the shell with the
## arena level, waits for spawn, prints vis/pos for the skinned characters and dumps a real
## screenshot so the Compatibility (mobile/web) render path can be compared to Forward+.
## godot --rendering-method gl_compatibility --script tests/mobile_render_repro.gd
## godot --rendering-method forward_plus --script tests/mobile_render_repro.gd
func _init() -> void:
_run.call_deferred()
func _report(nodes: Array, label: String) -> void:
if nodes.is_empty():
print(" ", label, ": NONE")
return
var n := nodes[0] as Node3D
print(" ", label, ": vis=", n.is_visible_in_tree(), " pos=", str(n.global_position.round()))
# Walk to the skinned MeshInstance3D and report its state + AABB.
_dump_meshes(n, " ")
func _dump_meshes(node: Node, indent: String) -> void:
if node is MeshInstance3D:
var mi := node as MeshInstance3D
var aabb := mi.get_aabb()
var lod_count := 0
var surf := 0
if mi.mesh != null:
surf = mi.mesh.get_surface_count()
print(indent, "MeshInstance3D '", mi.name, "' vis=", mi.visible,
" skin=", mi.skin != null, " gscale=", str(mi.global_transform.basis.get_scale()),
"\n", indent, " aabb_pos=", aabb.position, " aabb_size=", aabb.size,
" custom_aabb=", mi.custom_aabb.size, " surfaces=", surf)
for c: Node in node.get_children():
_dump_meshes(c, indent)
func _run() -> void:
# Compatibility (OpenGL) has no RenderingDevice; Forward+/Mobile do. This reflects the
# renderer actually chosen by --rendering-method, unlike the static project setting.
var method := "gl_compatibility" if RenderingServer.get_rendering_device() == null else "forward_plus"
print("=== RENDER REPRO method=", method, " gpu=", RenderingServer.get_video_adapter_name(), " ===")
var run: Node = root.get_node("Run")
run.ensure_run()
run.debug_level_override = run.get_level(&"arena")
var scene: Node = load("res://scene.tscn").instantiate()
root.add_child(scene)
current_scene = scene
await create_timer(1.2).timeout
print("bull + matador state:")
_report(get_nodes_in_group(&"player"), "bull")
_report(get_nodes_in_group(&"matador"), "matador")
# Force a couple more draw frames, then grab the framebuffer.
for i in 4:
await process_frame
var img := root.get_viewport().get_texture().get_image()
var out := "tests/output/render_%s.png" % method
DirAccess.make_dir_recursive_absolute("res://tests/output")
img.save_png("res://" + out)
print("screenshot -> ", out, " (", img.get_width(), "x", img.get_height(), ")")
quit()
+1
View File
@@ -0,0 +1 @@
uid://dvkw2a6cf7848
+32
View File
@@ -0,0 +1,32 @@
extends Node3D
## Minimal skinned-mesh probe for the web/mobile invisibility repro. Boots straight to a
## single bull (Skeleton3D-skinned) framed by a camera + light, no menus, no autoload deps.
## Set as main_scene, exported to web, and screenshotted in a browser to test whether the
## skinned mesh draws under a given engine build.
func _ready() -> void:
var bull := (load("res://Assets/bull.fbx") as PackedScene).instantiate() as Node3D
bull.scale = Vector3(100.0, 100.0, 100.0)
add_child(bull)
var key := DirectionalLight3D.new()
key.rotation_degrees = Vector3(-50.0, -40.0, 0.0)
key.light_energy = 1.5
add_child(key)
var we := WorldEnvironment.new()
var env := Environment.new()
env.background_mode = Environment.BG_COLOR
env.background_color = Color(0.15, 0.35, 0.65)
env.ambient_light_source = Environment.AMBIENT_SOURCE_COLOR
env.ambient_light_color = Color(0.6, 0.6, 0.6)
env.ambient_light_energy = 1.0
we.environment = env
add_child(we)
var cam := Camera3D.new()
cam.position = Vector3(0.0, 2.0, 6.0)
cam.fov = 55.0
add_child(cam)
cam.look_at(Vector3(0.0, 1.2, 0.0), Vector3.UP)
cam.current = true
+1
View File
@@ -0,0 +1 @@
uid://dhu2og7i2gdfa
+6
View File
@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://cwebprobe0001"]
[ext_resource type="Script" path="res://tests/web_probe.gd" id="1"]
[node name="WebProbe" type="Node3D"]
script = ExtResource("1")