6 forward_io::{Vertex, VertexOutput}, 7 view_transformations::position_world_to_clip, 11fn morph_vertex(vertex_in: Vertex) -> Vertex { 12 var vertex = vertex_in; 13 let first_vertex = mesh[vertex.instance_index].first_vertex_index; 14 let vertex_index = vertex.index - first_vertex; 16 let weight_count = bevy_pbr::morph::layer_count(); 17 for (var i: u32 = 0u; i < weight_count; i ++) { 18 let weight = bevy_pbr::morph::weight_at(i); 22 vertex.position += weight * morph(vertex_index, bevy_pbr::morph::position_offset, i); 24 vertex.normal += weight * morph(vertex_index, bevy_pbr::morph::normal_offset, i); 27 vertex.tangent += vec4(weight * morph(vertex_index, bevy_pbr::morph::tangent_offset, i), 0.0); 35fn vertex(vertex_no_morph: Vertex) -> VertexOutput { 36 var out: VertexOutput; 39 var vertex = morph_vertex(vertex_no_morph); 41 var vertex = vertex_no_morph; 45 var world_from_local = skinning::skin_model(vertex.joint_indices, vertex.joint_weights); 49 var world_from_local = mesh_functions::get_world_from_local(vertex_no_morph.instance_index); 54 out.world_normal = skinning::skin_normals(world_from_local, vertex.normal); 56 out.world_normal = mesh_functions::mesh_normal_local_to_world( 60 vertex_no_morph.instance_index 65#ifdef VERTEX_POSITIONS 66 out.world_position = mesh_functions::mesh_position_local_to_world(world_from_local, vec4<f32>(vertex.position, 1.0)); 67 out.position = position_world_to_clip(out.world_position.xyz); 74 out.uv_b = vertex.uv_b; 78 out.world_tangent = mesh_functions::mesh_tangent_local_to_world( 83 vertex_no_morph.instance_index 88 out.color = vertex.color; 91#ifdef VERTEX_OUTPUT_INSTANCE_INDEX 94 out.instance_index = vertex_no_morph.instance_index; 97#ifdef VISIBILITY_RANGE_DITHER 98 out.visibility_range_dither = mesh_functions::get_visibility_range_dither_level( 99 vertex_no_morph.instance_index, world_from_local[3]); 108) -> @location(0) vec4<f32> { 112 return vec4<f32>(1.0, 0.0, 1.0, 1.0);