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 the color plane in various color spaces.
2#import bevy_ui::ui_vertex_output::UiVertexOutput
3#import bevy_ui_render::color_space::{
4 srgb_to_linear_rgb,
5 hsl_to_linear_rgb,
6}
8@group(1) @binding(0) var<uniform> fixed_channel: f32;
10@fragment
11fn fragment(in: UiVertexOutput) -> @location(0) vec4<f32> {
12 let uv = in.uv;
13#ifdef PLANE_RG
14 return vec4(srgb_to_linear_rgb(vec3(uv.x, uv.y, fixed_channel)), 1.0);
15#else ifdef PLANE_RB
16 return vec4(srgb_to_linear_rgb(vec3(uv.x, fixed_channel, uv.y)), 1.0);
17#else ifdef PLANE_GB
18 return vec4(srgb_to_linear_rgb(vec3(fixed_channel, uv.x, uv.y)), 1.0);
19#else ifdef PLANE_HS
20 return vec4(hsl_to_linear_rgb(vec3(uv.x, 1.0 - uv.y, fixed_channel)), 1.0);
21#else ifdef PLANE_HL
22 return vec4(hsl_to_linear_rgb(vec3(uv.x, fixed_channel, 1.0 - uv.y)), 1.0);
23#else
24 // Error color
25 return vec4(1.0, 0.0, 1.0, 1.0);
26#endif
Contents