Files
CodenameEngine/assets/shaders/engine/colorPicker.frag
T
NeeEoo f2624c5e5c Fixed TopMenu, Less Laggy Blur
Crash Handler should hopefully catch more now
Close Button in metadata screen
Improved System Info
2023-05-29 20:25:31 +02:00

20 lines
462 B
GLSL

#pragma header
vec3 hsvToRgb(vec3 c) { //hsv.x = hue, hsv.y = saturation, hsv.z = value
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
uniform float hue;
void main()
{
vec2 uv = openfl_TextureCoordv.xy;
vec4 col = texture2D(bitmap, uv);
if (col.a > 0.0)
col = vec4(hsvToRgb(vec3(hue, uv.x, 1.0-uv.y)), 0.0);
gl_FragColor = col;
}