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.
2import bevy_ui_render::ui_vertex_output::UiVertexOutput;
3import bevy_render::color_operations::{
4 srgb_to_linear_rgb,
5 hsl_to_linear_rgb,
6 okhsl_to_linear_rgb,
7};
9struct ColorPlaneUniform {
10 fixed_channel: f32,
11@if(SIXTEEN_BYTE_ALIGNMENT)
12 _webgl2_padding_12b: vec3<f32>,
15@group(1) @binding(0) var<uniform> uniform_data: ColorPlaneUniform;
17@fragment
18fn fragment(in: UiVertexOutput) -> @location(0) vec4<f32> {
19 let uv = in.uv;
20@if(PLANE_RG)
21 return vec4(srgb_to_linear_rgb(vec3(uv.x, 1.0 - uv.y, uniform_data.fixed_channel)), 1.0);
22@elif(PLANE_RB)
23 return vec4(srgb_to_linear_rgb(vec3(uv.x, uniform_data.fixed_channel, 1.0 - uv.y)), 1.0);
24@elif(PLANE_GB)
25 return vec4(srgb_to_linear_rgb(vec3(uniform_data.fixed_channel, uv.x, 1.0 - uv.y)), 1.0);
26@elif(PLANE_HS)
27 return vec4(hsl_to_linear_rgb(vec3(uv.x, 1.0 - uv.y, uniform_data.fixed_channel)), 1.0);
28@elif(PLANE_HL)
29 return vec4(hsl_to_linear_rgb(vec3(uv.x, uniform_data.fixed_channel, 1.0 - uv.y)), 1.0);
30@elif(PLANE_OKHS)
31 return vec4(okhsl_to_linear_rgb(vec3(uv.x, 1.0 - uv.y, uniform_data.fixed_channel)), 1.0);
32@elif(PLANE_OKHL)
33 return vec4(okhsl_to_linear_rgb(vec3(uv.x, uniform_data.fixed_channel, 1.0 - uv.y)), 1.0);
34@else
35 // Error color
36 return vec4(1.0, 0.0, 1.0, 1.0);
Contents