15 return interp(col1, col2, t);
20 return interp(col1, col1 + col2, t);
25 return interp(col1, col1 * col2, t);
30 const float tm = 1.0f - t;
34 return one - (tm3 + t * (one - col2)) * (one - col1);
39 const float tm = 1.0f - t;
43 if (outcol.
x < 0.5f) {
44 outcol.
x *= tm + 2.0f * t * col2.
x;
47 outcol.
x = 1.0f - (tm + 2.0f * t * (1.0f - col2.
x)) * (1.0f - outcol.
x);
50 if (outcol.
y < 0.5f) {
51 outcol.
y *= tm + 2.0f * t * col2.
y;
54 outcol.
y = 1.0f - (tm + 2.0f * t * (1.0f - col2.
y)) * (1.0f - outcol.
y);
57 if (outcol.
z < 0.5f) {
58 outcol.
z *= tm + 2.0f * t * col2.
z;
61 outcol.
z = 1.0f - (tm + 2.0f * t * (1.0f - col2.
z)) * (1.0f - outcol.
z);
69 return interp(col1, col1 - col2, t);
74 const float tm = 1.0f - t;
79 outcol.
x = tm * outcol.
x + t * outcol.
x / col2.
x;
82 outcol.
y = tm * outcol.
y + t * outcol.
y / col2.
y;
85 outcol.
z = tm * outcol.
z + t * outcol.
z / col2.
z;
115 if (outcol.
x != 0.0f) {
116 float tmp = 1.0f - t * col2.
x;
121 tmp = outcol.
x / tmp;
130 if (outcol.
y != 0.0f) {
131 float tmp = 1.0f - t * col2.
y;
136 tmp = outcol.
y / tmp;
145 if (outcol.
z != 0.0f) {
146 float tmp = 1.0f - t * col2.
z;
151 tmp = outcol.
z / tmp;
167 const float tm = 1.0f - t;
171 tmp = tm + t * col2.
x;
176 tmp = (1.0f - (1.0f - outcol.
x) / tmp);
180 else if (tmp > 1.0f) {
188 tmp = tm + t * col2.
y;
193 tmp = (1.0f - (1.0f - outcol.
y) / tmp);
197 else if (tmp > 1.0f) {
205 tmp = tm + t * col2.
z;
210 tmp = (1.0f - (1.0f - outcol.
z) / tmp);
214 else if (tmp > 1.0f) {
231 if (hsv2.
y != 0.0f) {
236 outcol =
interp(outcol, tmp, t);
244 const float tm = 1.0f - t;
253 hsv.
y = tm * hsv.
y + t * hsv2.
y;
262 const float tm = 1.0f - t;
267 hsv.
z = tm * hsv.
z + t * hsv2.
z;
277 if (hsv2.
y != 0.0f) {
283 outcol =
interp(outcol, tmp, t);
291 const float tm = 1.0f - t;
294 const float3 scr = one - (one - col2) * (one - col1);
296 return tm * col1 + t * ((one - col1) * col2 * col1 + col1 * scr);
301 return col1 + t * (2.0f * col2 +
make_float3(-1.0f, -1.0f, -1.0f));
366 return svm_mix(type, fac, c1, c2);
370 const float brightness,
371 const float contrast)
373 const float a = 1.0f + contrast;
374 const float b = brightness - contrast * 0.5f;
376 color.
x =
max(a * color.
x +
b, 0.0f);
377 color.
y =
max(a * color.
y +
b, 0.0f);
378 color.
z =
max(a * color.
z +
b, 0.0f);
void rgb_to_hsl(float r, float g, float b, float *r_h, float *r_s, float *r_l)
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)
void hsl_to_rgb(float h, float s, float l, float *r_r, float *r_g, float *r_b)
ccl_device float3 svm_mix_color(const float t, const float3 col1, const float3 col2)
ccl_device float3 svm_mix_light(const float t, const float3 col1, const float3 col2)
ccl_device float3 svm_separate_color(NodeCombSepColorType type, const float3 color)
ccl_device float3 svm_mix_div(const float t, const float3 col1, const float3 col2)
ccl_device float3 svm_mix_clamp(const float3 col)
ccl_device float3 svm_mix_sub(const float t, const float3 col1, const float3 col2)
ccl_device_noinline_cpu float3 svm_mix(NodeMix type, const float t, const float3 c1, const float3 c2)
ccl_device float3 svm_mix_add(const float t, const float3 col1, const float3 col2)
CCL_NAMESPACE_BEGIN ccl_device float3 svm_mix_blend(const float t, const float3 col1, const float3 col2)
ccl_device float3 svm_mix_sat(const float t, const float3 col1, const float3 col2)
ccl_device float3 svm_mix_exclusion(const float t, const float3 col1, const float3 col2)
ccl_device float3 svm_combine_color(NodeCombSepColorType type, const float3 color)
ccl_device_noinline_cpu float3 svm_mix_clamped_factor(NodeMix type, const float t, const float3 c1, const float3 c2)
ccl_device float3 svm_mix_hue(const float t, const float3 col1, const float3 col2)
ccl_device_inline float3 svm_brightness_contrast(float3 color, const float brightness, const float contrast)
ccl_device float3 svm_mix_diff(const float t, const float3 col1, const float3 col2)
ccl_device float3 svm_mix_mul(const float t, const float3 col1, const float3 col2)
ccl_device float3 svm_mix_linear(const float t, const float3 col1, const float3 col2)
ccl_device float3 svm_mix_burn(const float t, const float3 col1, const float3 col2)
ccl_device float3 svm_mix_dodge(const float t, const float3 col1, const float3 col2)
ccl_device float3 svm_mix_val(const float t, const float3 col1, const float3 col2)
ccl_device float3 svm_mix_dark(const float t, const float3 col1, const float3 col2)
ccl_device float3 svm_mix_overlay(const float t, const float3 col1, const float3 col2)
ccl_device float3 svm_mix_soft(const float t, const float3 col1, const float3 col2)
ccl_device float3 svm_mix_screen(const float t, const float3 col1, const float3 col2)
#define ccl_device_noinline_cpu
#define ccl_device_inline
#define CCL_NAMESPACE_END
ccl_device_inline float interp(const float a, const float b, const float t)
ccl_device_inline float2 fabs(const float2 a)
CCL_NAMESPACE_BEGIN ccl_device_inline float3 zero_float3()