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.
1// This shader draws a circle with a given input color
2#import bevy_ui::ui_vertex_output::UiVertexOutput
4@group(1) @binding(0) var<uniform> color: vec4<f32>;
5@group(1) @binding(1) var<uniform> slider: f32;
6@group(1) @binding(2) var material_color_texture: texture_2d<f32>;
7@group(1) @binding(3) var material_color_sampler: sampler;
8@group(1) @binding(4) var<uniform> border_color: vec4<f32>;
11@fragment
12fn fragment(in: UiVertexOutput) -> @location(0) vec4<f32> {
13 let r = in.uv - 0.5;
14 let b = vec2(
15 select(in.border_widths.x, in.border_widths.y, r.x < 0.),
16 select(in.border_widths.z, in.border_widths.w, r.y < 0.)
17 );
19 if any(0.5 - b < abs(r)) {
20 return border_color;
21 }
23 if in.uv.x < slider {
24 let output_color = textureSample(material_color_texture, material_color_sampler, in.uv) * color;
25 return output_color;
26 } else {
27 return vec4(0.0);
28 }
Contents