2020-10-12 16:33:27 +00:00
|
|
|
|
|
|
|
out vec4 sk_FragColor;
|
|
|
|
vec3 _blend_set_color_luminance(vec3 hueSatColor, float alpha, vec3 lumColor) {
|
2020-12-16 18:24:48 +00:00
|
|
|
float _11_blend_color_luminance;
|
|
|
|
_11_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), lumColor);
|
|
|
|
float lum = _11_blend_color_luminance;
|
|
|
|
|
|
|
|
float _12_blend_color_luminance;
|
|
|
|
_12_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), hueSatColor);
|
|
|
|
vec3 result = (lum - _12_blend_color_luminance) + hueSatColor;
|
2020-10-12 16:33:27 +00:00
|
|
|
|
|
|
|
float minComp = min(min(result.x, result.y), result.z);
|
|
|
|
float maxComp = max(max(result.x, result.y), result.z);
|
|
|
|
if (minComp < 0.0 && lum != minComp) {
|
|
|
|
result = lum + ((result - lum) * lum) / (lum - minComp);
|
|
|
|
}
|
|
|
|
return maxComp > alpha && maxComp != lum ? lum + ((result - lum) * (alpha - lum)) / (maxComp - lum) : result;
|
|
|
|
}
|
2020-11-23 19:48:06 +00:00
|
|
|
vec3 _blend_set_color_saturation_helper(vec3 minMidMax, float sat) {
|
|
|
|
return minMidMax.x < minMidMax.z ? vec3(0.0, (sat * (minMidMax.y - minMidMax.x)) / (minMidMax.z - minMidMax.x), sat) : vec3(0.0);
|
|
|
|
}
|
2020-10-12 16:33:27 +00:00
|
|
|
vec3 _blend_set_color_saturation(vec3 hueLumColor, vec3 satColor) {
|
2020-12-16 18:24:48 +00:00
|
|
|
float _13_blend_color_saturation;
|
|
|
|
_13_blend_color_saturation = max(max(satColor.x, satColor.y), satColor.z) - min(min(satColor.x, satColor.y), satColor.z);
|
|
|
|
float sat = _13_blend_color_saturation;
|
2020-10-12 16:33:27 +00:00
|
|
|
|
|
|
|
if (hueLumColor.x <= hueLumColor.y) {
|
|
|
|
if (hueLumColor.y <= hueLumColor.z) {
|
2020-11-24 03:19:04 +00:00
|
|
|
return _blend_set_color_saturation_helper(hueLumColor, sat);
|
2020-10-12 16:33:27 +00:00
|
|
|
} else if (hueLumColor.x <= hueLumColor.z) {
|
2020-11-24 03:19:04 +00:00
|
|
|
return _blend_set_color_saturation_helper(hueLumColor.xzy, sat).xzy;
|
2020-10-12 16:33:27 +00:00
|
|
|
} else {
|
2020-11-24 03:19:04 +00:00
|
|
|
return _blend_set_color_saturation_helper(hueLumColor.zxy, sat).yzx;
|
2020-10-12 16:33:27 +00:00
|
|
|
}
|
|
|
|
} else if (hueLumColor.x <= hueLumColor.z) {
|
2020-11-24 03:19:04 +00:00
|
|
|
return _blend_set_color_saturation_helper(hueLumColor.yxz, sat).yxz;
|
2020-10-12 16:33:27 +00:00
|
|
|
} else if (hueLumColor.y <= hueLumColor.z) {
|
2020-11-24 03:19:04 +00:00
|
|
|
return _blend_set_color_saturation_helper(hueLumColor.yzx, sat).zxy;
|
2020-10-12 16:33:27 +00:00
|
|
|
} else {
|
2020-11-24 03:19:04 +00:00
|
|
|
return _blend_set_color_saturation_helper(hueLumColor.zyx, sat).zyx;
|
2020-10-12 16:33:27 +00:00
|
|
|
}
|
|
|
|
}
|
2020-11-23 19:48:06 +00:00
|
|
|
vec4 blend_hue(vec4 src, vec4 dst) {
|
|
|
|
float alpha = dst.w * src.w;
|
|
|
|
vec3 sda = src.xyz * dst.w;
|
|
|
|
vec3 dsa = dst.xyz * src.w;
|
|
|
|
return vec4((((_blend_set_color_luminance(_blend_set_color_saturation(sda, dsa), alpha, dsa) + dst.xyz) - dsa) + src.xyz) - sda, (src.w + dst.w) - alpha);
|
|
|
|
}
|
2020-11-18 20:38:39 +00:00
|
|
|
uniform vec4 color;
|
2020-10-12 16:33:27 +00:00
|
|
|
void main() {
|
2020-12-16 18:24:48 +00:00
|
|
|
float _1_fma;
|
2020-12-16 18:30:54 +00:00
|
|
|
float _2_mul;
|
|
|
|
_2_mul = color.x * color.y;
|
2020-12-16 18:24:48 +00:00
|
|
|
float _7_add;
|
2020-12-16 18:30:54 +00:00
|
|
|
float _8_c = _2_mul + color.z;
|
2020-12-16 18:24:48 +00:00
|
|
|
_7_add = _8_c;
|
|
|
|
_1_fma = _7_add;
|
2020-12-15 20:21:03 +00:00
|
|
|
|
2020-10-12 16:33:27 +00:00
|
|
|
|
2020-12-16 18:24:48 +00:00
|
|
|
sk_FragColor = vec4(_1_fma);
|
|
|
|
|
2020-10-12 16:33:27 +00:00
|
|
|
sk_FragColor *= 1.25;
|
|
|
|
|
2020-12-16 18:24:48 +00:00
|
|
|
vec4 _4_blend_src_in;
|
|
|
|
_4_blend_src_in = color.xxyy * color.w;
|
|
|
|
sk_FragColor *= _4_blend_src_in;
|
|
|
|
|
|
|
|
vec4 _5_blend_dst_in;
|
2020-12-16 18:30:54 +00:00
|
|
|
vec4 _6_blend_src_in;
|
|
|
|
_6_blend_src_in = color.zzww * color.y;
|
|
|
|
_5_blend_dst_in = _6_blend_src_in;
|
2020-12-16 18:24:48 +00:00
|
|
|
|
|
|
|
sk_FragColor *= _5_blend_dst_in;
|
2020-10-12 16:33:27 +00:00
|
|
|
|
2020-11-23 19:48:06 +00:00
|
|
|
sk_FragColor *= blend_hue(color, color.wwww);
|
|
|
|
sk_FragColor *= blend_hue(color, color.wzyx);
|
2020-10-12 16:33:27 +00:00
|
|
|
}
|