3struct UncompressedVertex { 4 @builtin(instance_index) instance_index: u32, 5 @location(0) position: vec3<f32>, 8 @location(1) uv: vec2<f32>, 11 @location(2) uv_b: vec2<f32>, 13 @if(NORMAL_PREPASS_OR_DEFERRED_PREPASS && VERTEX_NORMALS) 14 @location(3) normal: vec3<f32>, 15 @if(NORMAL_PREPASS_OR_DEFERRED_PREPASS && VERTEX_TANGENTS) 16 @location(4) tangent: vec4<f32>, 19 @location(5) joint_indices: vec4<u32>, 21 @location(6) joint_weights: vec4<f32>, 24 @location(7) color: vec4<f32>, 27 @builtin(vertex_index) index: u32, 31 @builtin(instance_index) instance_index: u32, 32 @if(VERTEX_POSITIONS_COMPRESSED) 33 @location(0) compressed_position: vec4<f32>, 35 @location(0) position: vec3<f32>, 36 @if(VERTEX_UVS_A && VERTEX_UVS_A_COMPRESSED) 37 @location(1) compressed_uv: vec2<f32>, 38 @if(VERTEX_UVS_A && !VERTEX_UVS_A_COMPRESSED) 39 @location(1) uv: vec2<f32>, 40 @if(VERTEX_UVS_B && VERTEX_UVS_B_COMPRESSED) 41 @location(2) compressed_uv_b: vec2<f32>, 42 @if(VERTEX_UVS_B && !VERTEX_UVS_B_COMPRESSED) 43 @location(2) uv_b: vec2<f32>, 45 @if(NORMAL_PREPASS_OR_DEFERRED_PREPASS && VERTEX_NORMALS && VERTEX_NORMALS_COMPRESSED) 46 @location(3) compressed_normal: vec2<f32>, 47 @if(NORMAL_PREPASS_OR_DEFERRED_PREPASS && VERTEX_NORMALS && !VERTEX_NORMALS_COMPRESSED) 48 @location(3) normal: vec3<f32>, 49 @if(NORMAL_PREPASS_OR_DEFERRED_PREPASS && VERTEX_TANGENTS && VERTEX_TANGENTS_COMPRESSED) 50 @location(4) compressed_tangent: vec2<f32>, 51 @if(NORMAL_PREPASS_OR_DEFERRED_PREPASS && VERTEX_TANGENTS && !VERTEX_TANGENTS_COMPRESSED) 52 @location(4) tangent: vec4<f32>, 55 @location(5) joint_indices: vec4<u32>, 57 @location(6) joint_weights: vec4<f32>, 60 @location(7) color: vec4<f32>, 63 @builtin(vertex_index) index: u32, 68fn decompress_vertex(vertex_in: Vertex, instance_index: u32) -> UncompressedVertex { 69 let mesh_metadata = package::render::mesh_functions::get_metadata(instance_index); 70 var uncompressed_vertex: UncompressedVertex; 71 uncompressed_vertex.instance_index = instance_index; 72@if(VERTEX_POSITIONS_COMPRESSED) 73 uncompressed_vertex.position = bevy_render::utils::decompress_vertex_position(vertex_in.compressed_position, mesh_metadata.aabb_center, mesh_metadata.aabb_half_extents); 75 uncompressed_vertex.position = vertex_in.position; 76@if(NORMAL_PREPASS_OR_DEFERRED_PREPASS && VERTEX_NORMALS && VERTEX_NORMALS_COMPRESSED) 77 uncompressed_vertex.normal = bevy_render::utils::decompress_vertex_normal(vertex_in.compressed_normal); 78@if(NORMAL_PREPASS_OR_DEFERRED_PREPASS && VERTEX_NORMALS && !VERTEX_NORMALS_COMPRESSED) 79 uncompressed_vertex.normal = vertex_in.normal; 80@if(NORMAL_PREPASS_OR_DEFERRED_PREPASS && VERTEX_TANGENTS && VERTEX_TANGENTS_COMPRESSED) 81 uncompressed_vertex.tangent = bevy_render::utils::decompress_vertex_tangent(vertex_in.compressed_tangent); 82@if(NORMAL_PREPASS_OR_DEFERRED_PREPASS && VERTEX_TANGENTS && !VERTEX_TANGENTS_COMPRESSED) 83 uncompressed_vertex.tangent = vertex_in.tangent; 84@if(VERTEX_UVS_A && VERTEX_UVS_A_COMPRESSED) { 85 let uv_min_and_extents_a = mesh_metadata.uv_channels_min_and_extents[0]; 86 uncompressed_vertex.uv = bevy_render::utils::decompress_vertex_uv(vertex_in.compressed_uv, uv_min_and_extents_a); 88@if(VERTEX_UVS_A && !VERTEX_UVS_A_COMPRESSED) 89 uncompressed_vertex.uv = vertex_in.uv; 90@if(VERTEX_UVS_B && VERTEX_UVS_B_COMPRESSED) { 91 let uv_min_and_extents_b = mesh_metadata.uv_channels_min_and_extents[1]; 92 uncompressed_vertex.uv_b = bevy_render::utils::decompress_vertex_uv(vertex_in.compressed_uv_b, uv_min_and_extents_b); 94@if(VERTEX_UVS_B && !VERTEX_UVS_B_COMPRESSED) 95 uncompressed_vertex.uv_b = vertex_in.uv_b; 97 uncompressed_vertex.color = vertex_in.color; 99 uncompressed_vertex.joint_indices = vertex_in.joint_indices; 100 uncompressed_vertex.joint_weights = vertex_in.joint_weights; 103 uncompressed_vertex.index = vertex_in.index; 104 return uncompressed_vertex; 110 @builtin(position) position: vec4<f32>, 113 @location(0) uv: vec2<f32>, 116 @location(1) uv_b: vec2<f32>, 118 @if(NORMAL_PREPASS_OR_DEFERRED_PREPASS) 119 @location(2) world_normal: vec3<f32>, 120 @if(NORMAL_PREPASS_OR_DEFERRED_PREPASS && VERTEX_TANGENTS) 121 @location(3) world_tangent: vec4<f32>, 123 @location(4) world_position: vec4<f32>, 124 @if(MOTION_VECTOR_PREPASS) 125 @location(5) previous_world_position: vec4<f32>, 127 @if(UNCLIPPED_DEPTH_ORTHO_EMULATION) 128 @location(6) unclipped_depth: f32, 129 @if(VERTEX_OUTPUT_INSTANCE_INDEX) 130 @location(7) @interpolate(flat) instance_index: u32, 133 @location(8) color: vec4<f32>, 135 @if(VISIBILITY_RANGE_DITHER) 136 @location(9) @interpolate(flat) visibility_range_dither: i32, 140struct FragmentOutput { 142 @location(0) normal: vec4<f32>, 144 @if(MOTION_VECTOR_PREPASS) 145 @location(1) motion_vector: vec2<f32>, 147 @if(DEFERRED_PREPASS) 148 @location(2) deferred: vec4<u32>, 149 @if(DEFERRED_PREPASS) 150 @location(3) deferred_lighting_pass_id: u32, 152 @if(UNCLIPPED_DEPTH_ORTHO_EMULATION) 153 @builtin(frag_depth) frag_depth: f32,