2import bevy_core_pipeline::tonemapping; 4import bevy_render::color_operations::linear_to_srgb; 6import bevy_render::color_operations::linear_rgb_to_oklab; 9 maths::affine3_to_square, 13import package::render::sprite_view_bindings::view; 16 @builtin(vertex_index) index: u32, 19 @location(0) i_model_transpose_col0: vec4<f32>, 21 @location(1) i_model_transpose_col1: vec4<f32>, 23 @location(2) i_model_transpose_col2: vec4<f32>, 24 @location(3) i_color: vec4<f32>, 25 @location(4) i_uv_offset_scale: vec4<f32>, 29 @builtin(position) clip_position: vec4<f32>, 30 @location(0) uv: vec2<f32>, 31 @location(1) @interpolate(flat) color: vec4<f32>, 35fn vertex(in: VertexInput) -> VertexOutput { 36 var out: VertexOutput; 38 let vertex_position = vec3<f32>( 40 f32((in.index & 0x2u) >> 1u), 44 out.clip_position = view.clip_from_world * affine3_to_square(mat3x4<f32>( 45 in.i_model_transpose_col0, 46 in.i_model_transpose_col1, 47 in.i_model_transpose_col2, 48 )) * vec4<f32>(vertex_position, 1.0); 49 out.uv = vec2<f32>(vertex_position.xy) * in.i_uv_offset_scale.zw + in.i_uv_offset_scale.xy; 50 out.color = in.i_color; 55@group(1) @binding(0) var sprite_texture: texture_2d<f32>; 56@group(1) @binding(1) var sprite_sampler: sampler; 59fn fragment(in: VertexOutput) -> @location(0) vec4<f32> { 60 var color = in.color * textureSample(sprite_texture, sprite_sampler, in.uv); 63 color = tonemapping::tone_mapping(color, view.color_grading); 66 color = vec4(linear_to_srgb(color.rgb), color.a); 69 color = vec4(linear_rgb_to_oklab(color.rgb), color.a);