2025-08-31 10:48:46 +00:00
|
|
|
#import bevy_sprite::mesh2d_vertex_output::VertexOutput
|
2025-08-31 09:39:39 +00:00
|
|
|
|
2025-08-31 10:48:46 +00:00
|
|
|
@group(2) @binding(0) var<uniform> u_time: f32;
|
|
|
|
|
@group(2) @binding(1) var<uniform> u_resolution: vec2<f32>;
|
2025-08-31 17:22:17 +00:00
|
|
|
@group(2) @binding(2) var<uniform> u_mouse_position: vec2<f32>;
|
2025-08-31 09:39:39 +00:00
|
|
|
|
|
|
|
|
@fragment
|
2025-08-31 10:48:46 +00:00
|
|
|
fn fragment(mesh: VertexOutput) -> @location(0) vec4<f32> {
|
2025-08-31 13:32:27 +00:00
|
|
|
var uv = mesh.uv * 2 - 1;
|
|
|
|
|
uv.x = uv.x * (u_resolution.x / u_resolution.y);
|
2025-08-31 09:39:39 +00:00
|
|
|
|
2025-08-31 13:32:27 +00:00
|
|
|
let red = vec3<f32>(1, 0, 0);
|
|
|
|
|
let blue = vec3<f32>(0, 0, 1.0);
|
|
|
|
|
|
2025-08-31 17:22:17 +00:00
|
|
|
let t = step(0.2 + u_mouse_position.x / u_resolution.x, length(uv));
|
2025-08-31 13:32:27 +00:00
|
|
|
|
|
|
|
|
let color = mix(red, blue, t);
|
|
|
|
|
return vec4<f32>(color, 1);
|
2025-08-31 09:39:39 +00:00
|
|
|
}
|