From 2b9c97d20366c5a22a81fb54fec56927fdf0987f Mon Sep 17 00:00:00 2001 From: davier Date: Wed, 13 Dec 2023 21:26:17 +0100 Subject: [PATCH] Fix Mesh2d normals on webgl (#10967) # Objective A workaround for a webgl issue was introduced in #9383 but one function for mesh2d was missed. ## Solution Applied the migration guide from #9383 in `mesh2d_normal_local_to_world() Note: I'm not using normals so I have not tested the bug & fix --- crates/bevy_sprite/src/mesh2d/mesh2d_functions.wgsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_sprite/src/mesh2d/mesh2d_functions.wgsl b/crates/bevy_sprite/src/mesh2d/mesh2d_functions.wgsl index b2bc92a00b..5ab21e1ef8 100644 --- a/crates/bevy_sprite/src/mesh2d/mesh2d_functions.wgsl +++ b/crates/bevy_sprite/src/mesh2d/mesh2d_functions.wgsl @@ -31,8 +31,8 @@ fn mesh2d_position_local_to_clip(model: mat4x4, vertex_position: vec4) fn mesh2d_normal_local_to_world(vertex_normal: vec3, instance_index: u32) -> vec3 { return mat2x4_f32_to_mat3x3_unpack( - mesh[instance_index].inverse_transpose_model_a, - mesh[instance_index].inverse_transpose_model_b, + mesh[get_instance_index(instance_index)].inverse_transpose_model_a, + mesh[get_instance_index(instance_index)].inverse_transpose_model_b, ) * vertex_normal; }