Search across packages, versions, files, declarations, and comments. Use multiple terms to narrow results (AND), and add @vertex, @fragment, or @compute to filter by shader stage.
1import bevy_sprite_render::mesh2d::vertex_output::VertexOutput;
3/// Pipeline-overridable constant: number of discrete color steps.
4/// This value is substituted at pipeline compilation time by Bevy's pipeline cache
5/// when the material's `specialize` method pushes it into `descriptor.constants`.
6override LEVELS: f32 = 4.0;
8@fragment
9fn fragment(in: VertexOutput) -> @location(0) vec4<f32> {
10 // Quantize UV.x to LEVELS discrete steps, then derive color from it.
11 // This ensures exactly LEVELS distinct colors appear across the gradient.
12 let t = floor(in.uv.x * LEVELS) / LEVELS;
13 return vec4(t, t * 0.4, 1.0 - t, 1.0);
Contents