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:
authorBastien Montagne <montagne29@wanadoo.fr>2019-01-20 18:22:55 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2019-01-20 18:27:06 +0300
commit482c4d099ae88bea018712b92b2990617ef006f8 (patch)
treecdc6dd9d345da7a6edb2106ecb63d314d14b7a61 /source/blender/blenlib/intern/math_vector_inline.c
parentb0dee09a6d5531fb3bc7bbb00069c75e18dfbd1d (diff)
Cleanup: remove all BLI_utiledefines' ugly vectorial macros.
Not only were those often making doublons with already existing BLI_math's stuff, but they were also used to hide implicit type conversions... As usual this adds some more exotic inlined vector functions (one of the rare cases where I really miss C++ and its templates... ;) ).
Diffstat (limited to 'source/blender/blenlib/intern/math_vector_inline.c')
-rw-r--r--source/blender/blenlib/intern/math_vector_inline.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c
index 78b3a5420ed..511b2a98259 100644
--- a/source/blender/blenlib/intern/math_vector_inline.c
+++ b/source/blender/blenlib/intern/math_vector_inline.c
@@ -68,6 +68,13 @@ MINLINE void copy_v3_v3(float r[3], const float a[3])
r[2] = a[2];
}
+MINLINE void copy_v3fl_v3s(float r[3], const short a[3])
+{
+ r[0] = (float)a[0];
+ r[1] = (float)a[1];
+ r[2] = (float)a[2];
+}
+
MINLINE void copy_v4_v4(float r[4], const float a[4])
{
r[0] = a[0];
@@ -378,6 +385,20 @@ MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
r[2] = a[2] + b[2];
}
+MINLINE void add_v3fl_v3fl_v3i(float r[3], const float a[3], const int b[3])
+{
+ r[0] = a[0] + (float)b[0];
+ r[1] = a[1] + (float)b[1];
+ r[2] = a[2] + (float)b[2];
+}
+
+MINLINE void add_v3fl_v3fl_v3s(float r[3], const float a[3], const short b[3])
+{
+ r[0] = a[0] + (float)b[0];
+ r[1] = a[1] + (float)b[1];
+ r[2] = a[2] + (float)b[2];
+}
+
MINLINE void add_v4_v4(float r[4], const float a[4])
{
r[0] += a[0];
@@ -426,6 +447,20 @@ MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
r[2] = a[2] - b[2];
}
+MINLINE void sub_v3_v3v3_int(int r[3], const int a[3], const int b[3])
+{
+ r[0] = a[0] - b[0];
+ r[1] = a[1] - b[1];
+ r[2] = a[2] - b[2];
+}
+
+MINLINE void sub_v3db_v3fl_v3fl(double r[3], const float a[3], const float b[3])
+{
+ r[0] = (double)a[0] - (double)b[0];
+ r[1] = (double)a[1] - (double)b[1];
+ r[2] = (double)a[2] - (double)b[2];
+}
+
MINLINE void sub_v4_v4(float r[4], const float a[4])
{
r[0] -= a[0];
@@ -622,6 +657,13 @@ MINLINE void madd_v3_v3v3v3(float r[3], const float a[3], const float b[3], cons
r[2] = a[2] + b[2] * c[2];
}
+MINLINE void madd_v3fl_v3fl_v3fl_v3i(float r[3], const float a[3], const float b[3], const int c[3])
+{
+ r[0] = a[0] + b[0] * (float)c[0];
+ r[1] = a[1] + b[1] * (float)c[1];
+ r[2] = a[2] + b[2] * (float)c[2];
+}
+
MINLINE void madd_v4_v4fl(float r[4], const float a[4], float f)
{
r[0] += a[0] * f;