diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-02-29 08:17:26 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-02-29 08:17:26 +0400 |
commit | b18794c3b67e75fc4eedcfed45686cc1efa279e8 (patch) | |
tree | 603acae5caea9cf0f38a33e6bfd9ba687eff0863 /source/blender/blenlib | |
parent | 8600c8df43dbc94b89f7d456b927a0fe2b9be723 (diff) |
Add blenlib function to initialize vectors from a single float.
The new functions are copy_v2_fl, copy_v3_fl, and copy_v4_fl.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_math_vector.h | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_vector_inline.c | 21 |
2 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index af8b52a7edf..7a39fc8b8ce 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -50,6 +50,10 @@ MINLINE void copy_v2_v2(float r[2], const float a[2]); MINLINE void copy_v3_v3(float r[3], const float a[3]); MINLINE void copy_v4_v4(float r[4], const float a[4]); +MINLINE void copy_v2_fl(float r[2], float f); +MINLINE void copy_v3_fl(float r[3], float f); +MINLINE void copy_v4_fl(float r[4], float f); + MINLINE void swap_v2_v2(float a[2], float b[2]); MINLINE void swap_v3_v3(float a[3], float b[3]); MINLINE void swap_v4_v4(float a[4], float b[4]); diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index 854494763af..12e11714a13 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -77,6 +77,27 @@ MINLINE void copy_v4_v4(float r[4], const float a[4]) r[3]= a[3]; } +MINLINE void copy_v2_fl(float r[2], float f) +{ + r[0]= f; + r[1]= f; +} + +MINLINE void copy_v3_fl(float r[3], float f) +{ + r[0]= f; + r[1]= f; + r[2]= f; +} + +MINLINE void copy_v4_fl(float r[4], float f) +{ + r[0]= f; + r[1]= f; + r[2]= f; + r[3]= f; +} + /* short */ MINLINE void copy_v2_v2_char(char r[2], const char a[2]) { |