Parameters
Name | Type | Description |
---|---|---|
p | f32 | First HSL conversion parameter. |
q | f32 | Second HSL conversion parameter. |
t | f32 | Hue value (adjusted). |
Returns
f32component value.
WGSL Code
fn hueToRgb(p: f32, q: f32, t: f32) -> f32 {var t_adj = t;if (t_adj < 0.0) { t_adj += 1.0; }if (t_adj > 1.0) { t_adj -= 1.0; }if (t_adj < 1.0 / 6.0) { return p + (q - p) * 6.0 * t_adj; }if (t_adj < 1.0 / 2.0) { return q; }if (t_adj < 2.0 / 3.0) { return p + (q - p) * (2.0 / 3.0 - t_adj) * 6.0; }return p;}