Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-11-10 22:13:05 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-11-10 22:13:05 +0300
commit385875632d7953080375ef4bf74f894c1053fc4b (patch)
tree8f7d69622d67953cfc413f0d5b2e87ef013042d7 /source/blender/blenlib/BLI_math_vector.h
parentd611dd373558814ea2fc21bcd5418404f1c77a4d (diff)
Math Lib
* Fix remaining issues before conversion. * Inline various vector functions, currently enabled for all platforms. I expect this to work in GCC/MSVC at least, if other platforms don't support it, #ifdef's can be added.
Diffstat (limited to 'source/blender/blenlib/BLI_math_vector.h')
-rw-r--r--source/blender/blenlib/BLI_math_vector.h83
1 files changed, 46 insertions, 37 deletions
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index 1cb1912208e..26602353425 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -32,64 +32,73 @@
extern "C" {
#endif
+/* add platform/compiler checks here if it is not supported */
+#define BLI_MATH_INLINE
+
+#ifdef BLI_MATH_INLINE
+#ifdef _MSC_VER
+#define MINLINE static __inline
+#else
+#define MINLINE static inline
+#endif
+#include "intern/math_vector_inline.c"
+#else
#define MINLINE
-
-//#define static inline
-//#include "intern/math_vector_inline.h"
+#endif
/************************************* Init ***********************************/
-void zero_v2(float r[2]);
-void zero_v3(float r[3]);
+MINLINE void zero_v2(float r[2]);
+MINLINE void zero_v3(float r[3]);
-void copy_v2_v2(float r[2], float a[2]);
-void copy_v3_v3(float r[3], float a[3]);
+MINLINE void copy_v2_v2(float r[2], float a[2]);
+MINLINE void copy_v3_v3(float r[3], float a[3]);
/********************************* Arithmetic ********************************/
-void add_v2_v2(float r[2], float a[2]);
-void add_v2_v2v2(float r[2], float a[2], float b[2]);
-void add_v3_v3(float r[3], float a[3]);
-void add_v3_v3v3(float r[3], float a[3], float b[3]);
+MINLINE void add_v2_v2(float r[2], float a[2]);
+MINLINE void add_v2_v2v2(float r[2], float a[2], float b[2]);
+MINLINE void add_v3_v3(float r[3], float a[3]);
+MINLINE void add_v3_v3v3(float r[3], float a[3], float b[3]);
-void sub_v2_v2(float r[2], float a[2]);
-void sub_v2_v2v2(float r[2], float a[2], float b[2]);
-void sub_v3_v3(float r[3], float a[3]);
-void sub_v3_v3v3(float r[3], float a[3], float b[3]);
+MINLINE void sub_v2_v2(float r[2], float a[2]);
+MINLINE void sub_v2_v2v2(float r[2], float a[2], float b[2]);
+MINLINE void sub_v3_v3(float r[3], float a[3]);
+MINLINE void sub_v3_v3v3(float r[3], float a[3], float b[3]);
-void mul_v2_fl(float r[2], float f);
-void mul_v3_fl(float r[3], float f);
-void mul_v3_v3fl(float r[3], float a[3], float f);
-void mul_v3_v3(float r[3], float a[3]);
-void mul_v3_v3v3(float r[3], float a[3], float b[3]);
+MINLINE void mul_v2_fl(float r[2], float f);
+MINLINE void mul_v3_fl(float r[3], float f);
+MINLINE void mul_v3_v3fl(float r[3], float a[3], float f);
+MINLINE void mul_v3_v3(float r[3], float a[3]);
+MINLINE void mul_v3_v3v3(float r[3], float a[3], float b[3]);
-void negate_v3(float r[3]);
-void negate_v3_v3(float r[3], float a[3]);
+MINLINE void negate_v3(float r[3]);
+MINLINE void negate_v3_v3(float r[3], float a[3]);
-float dot_v2v2(float a[2], float b[2]);
-float dot_v3v3(float a[3], float b[3]);
+MINLINE float dot_v2v2(float a[2], float b[2]);
+MINLINE float dot_v3v3(float a[3], float b[3]);
-float cross_v2v2(float a[2], float b[2]);
-void cross_v3_v3v3(float r[3], float a[3], float b[3]);
+MINLINE float cross_v2v2(float a[2], float b[2]);
+MINLINE void cross_v3_v3v3(float r[3], float a[3], float b[3]);
-void star_m3_v3(float R[3][3],float a[3]);
+MINLINE void star_m3_v3(float R[3][3],float a[3]);
/*********************************** Length **********************************/
-float len_v2(float a[2]);
-float len_v2v2(float a[2], float b[2]);
-float len_v3(float a[3]);
-float len_v3v3(float a[3], float b[3]);
+MINLINE float len_v2(float a[2]);
+MINLINE float len_v2v2(float a[2], float b[2]);
+MINLINE float len_v3(float a[3]);
+MINLINE float len_v3v3(float a[3], float b[3]);
-float normalize_v2(float r[2]);
-float normalize_v3(float r[3]);
+MINLINE float normalize_v2(float r[2]);
+MINLINE float normalize_v3(float r[3]);
/******************************* Interpolation *******************************/
-void interp_v2_v2v2(float r[2], const float a[2], const float b[2], const float t); // TODO const
-void interp_v2_v2v2v2(float r[2], const float a[2], const float b[2], const float c[3], const float t[3]); // TODO const
-void interp_v3_v3v3(float r[3], const float a[3], const float b[3], const float t); // TODO const
-void interp_v3_v3v3v3(float p[3], const float v1[3], const float v2[3], const float v3[3], const float w[3]); // TODO const
+void interp_v2_v2v2(float r[2], float a[2], float b[2], float t);
+void interp_v2_v2v2v2(float r[2], float a[2], float b[2], float c[3], float t[3]);
+void interp_v3_v3v3(float r[3], float a[3], float b[3], float t);
+void interp_v3_v3v3v3(float p[3], float v1[3], float v2[3], float v3[3], float w[3]);
void mid_v3_v3v3(float r[3], float a[3], float b[3]);