[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44541] trunk/blender/source/blender/ blenlib: Add blenlib function to initialize vectors from a single float.
Nicholas Bishop
nicholasbishop at gmail.com
Wed Feb 29 05:17:37 CET 2012
Revision: 44541
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44541
Author: nicholasbishop
Date: 2012-02-29 04:17:26 +0000 (Wed, 29 Feb 2012)
Log Message:
-----------
Add blenlib function to initialize vectors from a single float.
The new functions are copy_v2_fl, copy_v3_fl, and copy_v4_fl.
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/BLI_math_vector.h
trunk/blender/source/blender/blenlib/intern/math_vector_inline.c
Modified: trunk/blender/source/blender/blenlib/BLI_math_vector.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_math_vector.h 2012-02-29 02:44:08 UTC (rev 44540)
+++ trunk/blender/source/blender/blenlib/BLI_math_vector.h 2012-02-29 04:17:26 UTC (rev 44541)
@@ -50,6 +50,10 @@
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]);
Modified: trunk/blender/source/blender/blenlib/intern/math_vector_inline.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_vector_inline.c 2012-02-29 02:44:08 UTC (rev 44540)
+++ trunk/blender/source/blender/blenlib/intern/math_vector_inline.c 2012-02-29 04:17:26 UTC (rev 44541)
@@ -77,6 +77,27 @@
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])
{
More information about the Bf-blender-cvs
mailing list