14 return col1 + t * col2;
19 return col1 * (color(1.0 - t) + t * col2);
26 return color(1.0) - (color(tm) + t * (color(1.0) - col2)) * (color(1.0) - col1);
35 if (outcol[0] < 0.5) {
36 outcol[0] *= tm + 2.0 * t * col2[0];
39 outcol[0] = 1.0 - (tm + 2.0 * t * (1.0 - col2[0])) * (1.0 - outcol[0]);
42 if (outcol[1] < 0.5) {
43 outcol[1] *= tm + 2.0 * t * col2[1];
46 outcol[1] = 1.0 - (tm + 2.0 * t * (1.0 - col2[1])) * (1.0 - outcol[1]);
49 if (outcol[2] < 0.5) {
50 outcol[2] *= tm + 2.0 * t * col2[2];
53 outcol[2] = 1.0 - (tm + 2.0 * t * (1.0 - col2[2])) * (1.0 - outcol[2]);
61 return col1 - t * col2;
71 outcol[0] = tm * outcol[0] + t * outcol[0] / col2[0];
74 outcol[1] = tm * outcol[1] + t * outcol[1] / col2[1];
77 outcol[2] = tm * outcol[2] + t * outcol[2] / col2[2];
85 return mix(col1,
abs(col1 - col2), t);
90 return max(
mix(col1, col1 + col2 - 2.0 * col1 * col2, t), 0.0);
95 return mix(col1,
min(col1, col2), t);
100 return mix(col1,
max(col1, col2), t);
107 if (outcol[0] != 0.0) {
108 float tmp = 1.0 - t * col2[0];
112 else if ((tmp = outcol[0] / tmp) > 1.0) {
119 if (outcol[1] != 0.0) {
120 float tmp = 1.0 - t * col2[1];
124 else if ((tmp = outcol[1] / tmp) > 1.0) {
131 if (outcol[2] != 0.0) {
132 float tmp = 1.0 - t * col2[2];
136 else if ((tmp = outcol[2] / tmp) > 1.0) {
149 float tmp, tm = 1.0 - t;
153 tmp = tm + t * col2[0];
157 else if ((tmp = (1.0 - (1.0 - outcol[0]) / tmp)) < 0.0) {
160 else if (tmp > 1.0) {
167 tmp = tm + t * col2[1];
171 else if ((tmp = (1.0 - (1.0 - outcol[1]) / tmp)) < 0.0) {
174 else if (tmp > 1.0) {
181 tmp = tm + t * col2[2];
185 else if ((tmp = (1.0 - (1.0 - outcol[2]) / tmp)) < 0.0) {
188 else if (tmp > 1.0) {
203 if (hsv2[1] != 0.0) {
208 outcol =
mix(outcol, tmp, t);
225 hsv[1] = tm * hsv[1] + t * hsv2[1];
239 hsv[2] = tm * hsv[2] + t * hsv2[2];
249 if (hsv2[1] != 0.0) {
255 outcol =
mix(outcol, tmp, t);
265 color one = color(1.0);
266 color scr = one - (one - col2) * (one - col1);
268 return tm * col1 + t * ((one - col1) * col2 * col1 + col1 * scr);
276 outcol[0] = col1[0] + t * (2.0 * (col2[0] - 0.5));
279 outcol[0] = col1[0] + t * (2.0 * (col2[0]) - 1.0);
283 outcol[1] = col1[1] + t * (2.0 * (col2[1] - 0.5));
286 outcol[1] = col1[1] + t * (2.0 * (col2[1]) - 1.0);
290 outcol[2] = col1[2] + t * (2.0 * (col2[2] - 0.5));
293 outcol[2] = col1[2] + t * (2.0 * (col2[2]) - 1.0);
303 outcol[0] =
clamp(col[0], 0.0, 1.0);
304 outcol[1] =
clamp(col[1], 0.0, 1.0);
305 outcol[2] =
clamp(col[2], 0.0, 1.0);
void rgb_to_hsv(float4 rgb, float4 &outcol)
void hsv_to_rgb(float4 hsv, float4 &outcol)
constexpr T clamp(T, U, U) RET
void node_mix_linear(float fac, float4 col1, float4 col2, float4 &outcol)
void node_mix_light(float fac, float4 col1, float4 col2, float4 &outcol)
void node_mix_color(float fac, float4 col1, float4 col2, float4 &outcol)
void node_mix_hue(float fac, float4 col1, float4 col2, float4 &outcol)
void node_mix_overlay(float fac, float4 col1, float4 col2, float4 &outcol)
void node_mix_val(float fac, float4 col1, float4 col2, float4 &outcol)
void node_mix_burn(float fac, float4 col1, float4 col2, float4 &outcol)
void node_mix_sat(float fac, float4 col1, float4 col2, float4 &outcol)
void node_mix_sub(float fac, float4 col1, float4 col2, float4 &outcol)
void node_mix_soft(float fac, float4 col1, float4 col2, float4 &outcol)
void node_mix_add(float fac, float4 col1, float4 col2, float4 &outcol)
void node_mix_dark(float fac, float4 col1, float4 col2, float4 &outcol)
void node_mix_screen(float fac, float4 col1, float4 col2, float4 &outcol)
void node_mix_exclusion(float fac, float4 col1, float4 col2, float4 &outcol)
void node_mix_blend(float fac, float4 col1, float4 col2, float4 &outcol)
void node_mix_diff(float fac, float4 col1, float4 col2, float4 &outcol)
void node_mix_dodge(float fac, float4 col1, float4 col2, float4 &outcol)
float endvalue_preserving_mix(float a, float b, float t)
color node_mix_clamp(color col)
color node_mix_div(float t, color col1, color col2)
color node_mix_mul(float t, color col1, color col2)