diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-02-10 10:02:53 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-02-10 10:06:56 +0400 |
commit | 2f01be2b2fe563f634c9f653260940b2a9a78d6d (patch) | |
tree | a97e7b7146fdbee9da50a84324de2785cd6d9324 /source/blender/blenlib/intern/math_vector.c | |
parent | 311883fc3b397ccd40a88dc48da3bc094b3a093a (diff) |
UI: panel tabs, use simple color interpolation that ignores alpha
Diffstat (limited to 'source/blender/blenlib/intern/math_vector.c')
-rw-r--r-- | source/blender/blenlib/intern/math_vector.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index 367166578ae..54615a5264d 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -109,6 +109,33 @@ void interp_v3_v3v3v3_uv(float p[3], const float v1[3], const float v2[3], const p[2] = v1[2] + ((v2[2] - v1[2]) * uv[0]) + ((v3[2] - v1[2]) * uv[1]); } +void interp_v3_v3v3_uchar(char unsigned target[3], const unsigned char a[3], const unsigned char b[3], const float t) +{ + float s = 1.0f - t; + + target[0] = (char)floorf(s * a[0] + t * b[0]); + target[1] = (char)floorf(s * a[1] + t * b[1]); + target[2] = (char)floorf(s * a[2] + t * b[2]); +} +void interp_v3_v3v3_char(char target[3], const char a[3], const char b[3], const float t) +{ + interp_v3_v3v3_char((char *)target, (const char *)a, (const char *)b, t); +} + +void interp_v4_v4v4_uchar(char unsigned target[4], const unsigned char a[4], const unsigned char b[4], const float t) +{ + float s = 1.0f - t; + + target[0] = (char)floorf(s * a[0] + t * b[0]); + target[1] = (char)floorf(s * a[1] + t * b[1]); + target[2] = (char)floorf(s * a[2] + t * b[2]); + target[3] = (char)floorf(s * a[3] + t * b[3]); +} +void interp_v4_v4v4_char(char target[4], const char a[4], const char b[4], const float t) +{ + interp_v4_v4v4_char((char *)target, (const char *)a, (const char *)b, t); +} + void mid_v3_v3v3(float v[3], const float v1[3], const float v2[3]) { v[0] = 0.5f * (v1[0] + v2[0]); |