1#define_import_path bevy_pbr::skinning 3#import bevy_pbr::mesh_types::SkinnedMesh 4#import bevy_pbr::mesh_bindings::mesh 8#ifdef SKINS_USE_UNIFORM_BUFFERS 9@group(1) @binding(1) var<uniform> joint_matrices: SkinnedMesh; 10#else // SKINS_USE_UNIFORM_BUFFERS 11@group(1) @binding(1) var<storage> joint_matrices: array<mat4x4<f32>>; 12#endif // SKINS_USE_UNIFORM_BUFFERS 20#ifdef SKINS_USE_UNIFORM_BUFFERS 21@group(1) @binding(6) var<uniform> prev_joint_matrices: SkinnedMesh; 22#else // SKINS_USE_UNIFORM_BUFFERS 23@group(1) @binding(6) var<storage> prev_joint_matrices: array<mat4x4<f32>>; 24#endif // SKINS_USE_UNIFORM_BUFFERS 31#ifdef SKINS_USE_UNIFORM_BUFFERS 32 return weights.x * joint_matrices.data[indexes.x] 33 + weights.y * joint_matrices.data[indexes.y] 34 + weights.z * joint_matrices.data[indexes.z] 35 + weights.w * joint_matrices.data[indexes.w]; 36#else // SKINS_USE_UNIFORM_BUFFERS 37 var skin_index = mesh[instance_index].current_skin_index; 38 return weights.x * joint_matrices[skin_index + indexes.x] 39 + weights.y * joint_matrices[skin_index + indexes.y] 40 + weights.z * joint_matrices[skin_index + indexes.z] 41 + weights.w * joint_matrices[skin_index + indexes.w]; 42#endif // SKINS_USE_UNIFORM_BUFFERS 54#ifdef SKINS_USE_UNIFORM_BUFFERS 55 return weights.x * prev_joint_matrices.data[indexes.x] 56 + weights.y * prev_joint_matrices.data[indexes.y] 57 + weights.z * prev_joint_matrices.data[indexes.z] 58 + weights.w * prev_joint_matrices.data[indexes.w]; 59#else // SKINS_USE_UNIFORM_BUFFERS 60 let skin_index = mesh[instance_index].current_skin_index; 61 return weights.x * prev_joint_matrices[skin_index + indexes.x] 62 + weights.y * prev_joint_matrices[skin_index + indexes.y] 63 + weights.z * prev_joint_matrices[skin_index + indexes.z] 64 + weights.w * prev_joint_matrices[skin_index + indexes.w]; 65#endif // SKINS_USE_UNIFORM_BUFFERS 68fn inverse_transpose_3x3m(in: mat3x3<f32>) -> mat3x3<f32> { 69 let x = cross(in[1], in[2]); 70 let y = cross(in[2], in[0]); 71 let z = cross(in[0], in[1]); 72 let det = dot(in[2], z); 81 world_from_local: mat4x4<f32>, 85 inverse_transpose_3x3m( 87 world_from_local[0].xyz, 88 world_from_local[1].xyz, 89 world_from_local[2].xyz