[Bf-blender-cvs] [0c987aa7ac3] blender2.8: BLI: Math: Add normal_float_to_short_v4

Clément Foucault noreply at git.blender.org
Sat Nov 17 14:56:26 CET 2018


Commit: 0c987aa7ac3a62aafbaaeb55c6e096b043d0b8cd
Author: Clément Foucault
Date:   Sat Nov 17 14:45:59 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB0c987aa7ac3a62aafbaaeb55c6e096b043d0b8cd

BLI: Math: Add normal_float_to_short_v4

===================================================================

M	source/blender/blenlib/BLI_math_vector.h
M	source/blender/blenlib/intern/math_vector_inline.c

===================================================================

diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index 9613847f28f..a663d08b074 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -338,6 +338,7 @@ void print_vn(const char *str, const float v[], const int 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]);
+MINLINE void normal_float_to_short_v4(short r[4], const float n[4]);
 
 void minmax_v3v3_v3(float min[3], float max[3], const float vec[3]);
 void minmax_v2v2_v2(float min[2], float max[2], const float vec[2]);
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c
index dbb2339461f..fc3f11fd1be 100644
--- a/source/blender/blenlib/intern/math_vector_inline.c
+++ b/source/blender/blenlib/intern/math_vector_inline.c
@@ -1025,6 +1025,15 @@ MINLINE void normal_float_to_short_v3(short out[3], const float in[3])
 	out[2] = (short) (in[2] * 32767.0f);
 }
 
+MINLINE void normal_float_to_short_v4(short out[4], const float in[4])
+{
+	out[0] = (short) (in[0] * 32767.0f);
+	out[1] = (short) (in[1] * 32767.0f);
+	out[2] = (short) (in[2] * 32767.0f);
+	out[3] = (short) (in[3] * 32767.0f);
+}
+
+
 /********************************* Comparison ********************************/



More information about the Bf-blender-cvs mailing list