diff options
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_math_vector.h | 1 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_vector_inline.c | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index dc9432fef64..3a34a199ba8 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -321,6 +321,7 @@ void print_vn(const char *str, const float v[], const int n); #define print_v4_id(v) print_v4(STRINGIFY(v), v) #define print_vn_id(v, n) print_vn(STRINGIFY(v), v, n) +MINLINE void normal_float_to_short_v2(short r[2], const float n[2]); MINLINE void normal_short_to_float_v3(float r[3], const short n[3]); MINLINE void normal_float_to_short_v3(short r[3], const float n[3]); diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index 4389cd29034..75bbfda3f5b 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -960,6 +960,12 @@ MINLINE float normalize_v3(float n[3]) return normalize_v3_v3(n, n); } +MINLINE void normal_float_to_short_v2(short out[2], const float in[2]) +{ + out[0] = (short) (in[0] * 32767.0f); + out[1] = (short) (in[1] * 32767.0f); +} + MINLINE void normal_short_to_float_v3(float out[3], const short in[3]) { out[0] = in[0] * (1.0f / 32767.0f); |