7 return mix(col1, col2, t);
12 return mix(col1, col1 + col2, t);
17 return mix(col1, col1 * col2, t);
24 return color(1.0) - (color(tm) + t * (color(1.0) - col2)) * (color(1.0) - col1);
33 if (outcol[0] < 0.5) {
34 outcol[0] *= tm + 2.0 * t * col2[0];
37 outcol[0] = 1.0 - (tm + 2.0 * t * (1.0 - col2[0])) * (1.0 - outcol[0]);
40 if (outcol[1] < 0.5) {
41 outcol[1] *= tm + 2.0 * t * col2[1];
44 outcol[1] = 1.0 - (tm + 2.0 * t * (1.0 - col2[1])) * (1.0 - outcol[1]);
47 if (outcol[2] < 0.5) {
48 outcol[2] *= tm + 2.0 * t * col2[2];
51 outcol[2] = 1.0 - (tm + 2.0 * t * (1.0 - col2[2])) * (1.0 - outcol[2]);
59 return mix(col1, col1 - col2, t);
69 outcol[0] = tm * outcol[0] + t * outcol[0] / col2[0];
72 outcol[1] = tm * outcol[1] + t * outcol[1] / col2[1];
75 outcol[2] = tm * outcol[2] + t * outcol[2] / col2[2];
83 return mix(col1,
abs(col1 - col2), t);
88 return max(
mix(col1, col1 + col2 - 2.0 * col1 * col2, t), 0.0);
93 return mix(col1,
min(col1, col2), t);
98 return mix(col1,
max(col1, col2), t);
105 if (outcol[0] != 0.0) {
106 float tmp = 1.0 - t * col2[0];
110 else if ((tmp = outcol[0] / tmp) > 1.0) {
117 if (outcol[1] != 0.0) {
118 float tmp = 1.0 - t * col2[1];
122 else if ((tmp = outcol[1] / tmp) > 1.0) {
129 if (outcol[2] != 0.0) {
130 float tmp = 1.0 - t * col2[2];
134 else if ((tmp = outcol[2] / tmp) > 1.0) {
147 float tmp, tm = 1.0 - t;
151 tmp = tm + t * col2[0];
155 else if ((tmp = (1.0 - (1.0 - outcol[0]) / tmp)) < 0.0) {
158 else if (tmp > 1.0) {
165 tmp = tm + t * col2[1];
169 else if ((tmp = (1.0 - (1.0 - outcol[1]) / tmp)) < 0.0) {
172 else if (tmp > 1.0) {
179 tmp = tm + t * col2[2];
183 else if ((tmp = (1.0 - (1.0 - outcol[2]) / tmp)) < 0.0) {
186 else if (tmp > 1.0) {
201 if (hsv2[1] != 0.0) {
206 outcol =
mix(outcol, tmp, t);
223 hsv[1] = tm * hsv[1] + t * hsv2[1];
237 hsv[2] = tm * hsv[2] + t * hsv2[2];
247 if (hsv2[1] != 0.0) {
253 outcol =
mix(outcol, tmp, t);
263 color one = color(1.0);
264 color scr = one - (one - col2) * (one - col1);
266 return tm * col1 + t * ((one - col1) * col2 * col1 + col1 * scr);
274 outcol[0] = col1[0] + t * (2.0 * (col2[0] - 0.5));
277 outcol[0] = col1[0] + t * (2.0 * (col2[0]) - 1.0);
281 outcol[1] = col1[1] + t * (2.0 * (col2[1] - 0.5));
284 outcol[1] = col1[1] + t * (2.0 * (col2[1]) - 1.0);
288 outcol[2] = col1[2] + t * (2.0 * (col2[2] - 0.5));
291 outcol[2] = col1[2] + t * (2.0 * (col2[2]) - 1.0);
301 outcol[0] =
clamp(
col[0], 0.0, 1.0);
302 outcol[1] =
clamp(
col[1], 0.0, 1.0);
303 outcol[2] =
clamp(
col[2], 0.0, 1.0);
void rgb_to_hsv(float r, float g, float b, float *r_h, float *r_s, float *r_v)
void hsv_to_rgb(float h, float s, float v, float *r_r, float *r_g, float *r_b)
constexpr T clamp(T, U, U) RET
color node_mix_add(float t, color col1, color col2)
color node_mix_dark(float t, color col1, color col2)
color node_mix_clamp(color col)
color node_mix_div(float t, color col1, color col2)
color node_mix_sat(float t, color col1, color col2)
color node_mix_linear(float t, color col1, color col2)
color node_mix_hue(float t, color col1, color col2)
color node_mix_exclusion(float t, color col1, color col2)
color node_mix_color(float t, color col1, color col2)
color node_mix_screen(float t, color col1, color col2)
color node_mix_soft(float t, color col1, color col2)
color node_mix_val(float t, color col1, color col2)
color node_mix_light(float t, color col1, color col2)
color node_mix_overlay(float t, color col1, color col2)
color node_mix_mul(float t, color col1, color col2)
color node_mix_burn(float t, color col1, color col2)
color node_mix_sub(float t, color col1, color col2)
color node_mix_dodge(float t, color col1, color col2)
color node_mix_diff(float t, color col1, color col2)
color node_mix_blend(float t, color col1, color col2)