mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 00:14:00 +00:00
0603452264
Goal._build_visuals() built 10 MeshInstance3D nodes across 4 materials (1 pocket + 1 net + 4 bezel-ring + 4 rim-ring boxes) per goal. Replaced with a single MeshInstance3D wrapping one ArrayMesh with 4 SurfaceTool- committed surfaces (pocket, net, bezel, rim), one material per surface via surface_set_material — 10 nodes down to 1, same 4 materials. Kept 4 surfaces rather than collapsing further: the rim is a tuned team-tinted emitter, the net carries its own discard shader, and the pocket/bezel differ in albedo/metallic/roughness. Merging those into a shared material would be a visible regression, not a free win. Added a local box-to-SurfaceTool helper (6 quads via arena_boundary.gd's _add_quad/_add_tri winding-correction trick, copied in rather than shared since that file's geometry is collision-adjacent). The pocket's old cull_mode = CULL_FRONT trick is replaced by emitting its geometry with inverted winding; the net's cull_front stays material-driven since goal_net.gdshader's own render_mode depends on that winding convention. Verified in the editor: both team-tinted goals render an intact pocket, net, bezel and glowing rim with no backface/winding artifacts, and the headless free_play smoke test still runs clean.