2020-09-21 21:01:22 +00:00
|
|
|
#version 400
|
2020-09-25 17:35:58 +00:00
|
|
|
out vec4 sk_FragColor;
|
2021-01-15 20:54:02 +00:00
|
|
|
in vec4 src;
|
|
|
|
in vec4 dst;
|
2020-11-23 19:48:06 +00:00
|
|
|
vec3 _blend_set_color_saturation_helper(vec3 minMidMax, float sat) {
|
2021-02-10 17:03:42 +00:00
|
|
|
if (minMidMax.x < minMidMax.z) {
|
|
|
|
float _19_n = sat * (minMidMax.y - minMidMax.x);
|
|
|
|
float _20_d = minMidMax.z - minMidMax.x;
|
|
|
|
return vec3(0.0, _19_n / _20_d, sat);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
return vec3(0.0);
|
|
|
|
}
|
2020-11-23 19:48:06 +00:00
|
|
|
}
|
2020-10-15 14:32:04 +00:00
|
|
|
void main() {
|
2020-12-16 18:25:14 +00:00
|
|
|
float _1_alpha = dst.w * src.w;
|
|
|
|
vec3 _2_sda = src.xyz * dst.w;
|
|
|
|
vec3 _3_dsa = dst.xyz * src.w;
|
2020-12-15 23:06:29 +00:00
|
|
|
vec3 _4_blend_set_color_saturation;
|
2020-12-17 19:38:56 +00:00
|
|
|
float _5_sat = max(max(_2_sda.x, _2_sda.y), _2_sda.z) - min(min(_2_sda.x, _2_sda.y), _2_sda.z);
|
2020-12-15 20:21:03 +00:00
|
|
|
|
|
|
|
if (_3_dsa.x <= _3_dsa.y) {
|
|
|
|
if (_3_dsa.y <= _3_dsa.z) {
|
2020-12-17 19:38:56 +00:00
|
|
|
_4_blend_set_color_saturation = _blend_set_color_saturation_helper(_3_dsa, _5_sat);
|
2020-12-15 20:21:03 +00:00
|
|
|
} else if (_3_dsa.x <= _3_dsa.z) {
|
2020-12-17 19:38:56 +00:00
|
|
|
_4_blend_set_color_saturation = _blend_set_color_saturation_helper(_3_dsa.xzy, _5_sat).xzy;
|
2020-12-15 20:21:03 +00:00
|
|
|
} else {
|
2020-12-17 19:38:56 +00:00
|
|
|
_4_blend_set_color_saturation = _blend_set_color_saturation_helper(_3_dsa.zxy, _5_sat).yzx;
|
2020-10-15 14:32:04 +00:00
|
|
|
}
|
2020-12-15 20:21:03 +00:00
|
|
|
} else if (_3_dsa.x <= _3_dsa.z) {
|
2020-12-17 19:38:56 +00:00
|
|
|
_4_blend_set_color_saturation = _blend_set_color_saturation_helper(_3_dsa.yxz, _5_sat).yxz;
|
2020-12-15 20:21:03 +00:00
|
|
|
} else if (_3_dsa.y <= _3_dsa.z) {
|
2020-12-17 19:38:56 +00:00
|
|
|
_4_blend_set_color_saturation = _blend_set_color_saturation_helper(_3_dsa.yzx, _5_sat).zxy;
|
2020-12-15 20:21:03 +00:00
|
|
|
} else {
|
2020-12-17 19:38:56 +00:00
|
|
|
_4_blend_set_color_saturation = _blend_set_color_saturation_helper(_3_dsa.zyx, _5_sat).zyx;
|
2020-12-15 20:21:03 +00:00
|
|
|
}
|
2021-02-10 17:03:42 +00:00
|
|
|
vec3 _6_blend_set_color_luminance;
|
2020-12-17 19:38:56 +00:00
|
|
|
float _7_lum = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _3_dsa);
|
2020-12-15 20:21:03 +00:00
|
|
|
|
2020-12-17 19:38:56 +00:00
|
|
|
vec3 _8_result = (_7_lum - dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _4_blend_set_color_saturation)) + _4_blend_set_color_saturation;
|
2020-12-16 18:24:48 +00:00
|
|
|
|
2020-12-17 19:38:56 +00:00
|
|
|
float _9_minComp = min(min(_8_result.x, _8_result.y), _8_result.z);
|
|
|
|
float _10_maxComp = max(max(_8_result.x, _8_result.y), _8_result.z);
|
|
|
|
if (_9_minComp < 0.0 && _7_lum != _9_minComp) {
|
2021-02-10 17:03:42 +00:00
|
|
|
float _11_d = _7_lum - _9_minComp;
|
|
|
|
_8_result = _7_lum + (_8_result - _7_lum) * (_7_lum / _11_d);
|
|
|
|
|
|
|
|
}
|
|
|
|
if (_10_maxComp > _1_alpha && _10_maxComp != _7_lum) {
|
|
|
|
vec3 _12_n = (_8_result - _7_lum) * (_1_alpha - _7_lum);
|
|
|
|
float _13_d = _10_maxComp - _7_lum;
|
|
|
|
_6_blend_set_color_luminance = _7_lum + _12_n / _13_d;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
_6_blend_set_color_luminance = _8_result;
|
2020-09-21 21:01:22 +00:00
|
|
|
}
|
2021-02-10 17:03:42 +00:00
|
|
|
sk_FragColor = vec4((((_6_blend_set_color_luminance + dst.xyz) - _3_dsa) + src.xyz) - _2_sda, (src.w + dst.w) - _1_alpha);
|
2020-12-15 20:21:03 +00:00
|
|
|
|
|
|
|
|
2020-09-28 17:13:40 +00:00
|
|
|
|
2020-09-21 21:01:22 +00:00
|
|
|
}
|