[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60891] trunk/blender/source/blender: add copy_v4_fl4, replace QUATSET macro.

Campbell Barton ideasman42 at gmail.com
Tue Oct 22 05:31:24 CEST 2013


Revision: 60891
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60891
Author:   campbellbarton
Date:     2013-10-22 03:31:21 +0000 (Tue, 22 Oct 2013)
Log Message:
-----------
add copy_v4_fl4, replace QUATSET macro.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/font.c
    trunk/blender/source/blender/blenlib/BLI_math_vector.h
    trunk/blender/source/blender/blenlib/intern/math_vector_inline.c
    trunk/blender/source/blender/editors/space_view3d/view3d_view.c

Modified: trunk/blender/source/blender/blenkernel/intern/font.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/font.c	2013-10-22 03:03:56 UTC (rev 60890)
+++ trunk/blender/source/blender/blenkernel/intern/font.c	2013-10-22 03:31:21 UTC (rev 60891)
@@ -315,25 +315,13 @@
 		MEM_freeN(nu2);
 		return;
 	}
-	nu2->bp = bp;
 
-	nu2->bp[0].vec[0] = x1;
-	nu2->bp[0].vec[1] = y1;
-	nu2->bp[0].vec[2] = 0;
-	nu2->bp[0].vec[3] = 1.0f;
-	nu2->bp[1].vec[0] = x2;
-	nu2->bp[1].vec[1] = y1;
-	nu2->bp[1].vec[2] = 0;
-	nu2->bp[1].vec[3] = 1.0f;
-	nu2->bp[2].vec[0] = x2;
-	nu2->bp[2].vec[1] = y2;
-	nu2->bp[2].vec[2] = 0;
-	nu2->bp[2].vec[3] = 1.0f;
-	nu2->bp[3].vec[0] = x1;
-	nu2->bp[3].vec[1] = y2;
-	nu2->bp[3].vec[2] = 0;
-	nu2->bp[3].vec[3] = 1.0f;
-	
+	copy_v4_fl4(bp[0].vec, x1, y1, 0.0f, 1.0f);
+	copy_v4_fl4(bp[1].vec, x2, y1, 0.0f, 1.0f);
+	copy_v4_fl4(bp[2].vec, x2, y2, 0.0f, 1.0f);
+	copy_v4_fl4(bp[3].vec, x1, y2, 0.0f, 1.0f);
+
+	nu2->bp = bp;
 	BLI_addtail(&(cu->nurb), nu2);
 
 }

Modified: trunk/blender/source/blender/blenlib/BLI_math_vector.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_math_vector.h	2013-10-22 03:03:56 UTC (rev 60890)
+++ trunk/blender/source/blender/blenlib/BLI_math_vector.h	2013-10-22 03:31:21 UTC (rev 60891)
@@ -82,8 +82,9 @@
 MINLINE void copy_v2db_v2fl(double r[2], const float a[2]);
 MINLINE void copy_v3db_v3fl(double r[3], const float a[3]);
 MINLINE void copy_v4db_v4fl(double r[4], const float a[4]);
-/* 3 float -> vec */
+/* float args -> vec */
 MINLINE void copy_v3_fl3(float v[3], float x, float y, float z);
+MINLINE void copy_v4_fl4(float v[4], float x, float y, float z, float w);
 
 /********************************* Arithmetic ********************************/
 

Modified: trunk/blender/source/blender/blenlib/intern/math_vector_inline.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_vector_inline.c	2013-10-22 03:03:56 UTC (rev 60890)
+++ trunk/blender/source/blender/blenlib/intern/math_vector_inline.c	2013-10-22 03:31:21 UTC (rev 60891)
@@ -235,7 +235,7 @@
 	SWAP(float, a[3], b[3]);
 }
 
-/* 3 float -> vec */
+/* float args -> vec */
 MINLINE void copy_v3_fl3(float v[3], float x, float y, float z)
 {
 	v[0] = x;
@@ -243,6 +243,14 @@
 	v[2] = z;
 }
 
+MINLINE void copy_v4_fl4(float v[4], float x, float y, float z, float w)
+{
+	v[0] = x;
+	v[1] = y;
+	v[2] = z;
+	v[3] = w;
+}
+
 /********************************* Arithmetic ********************************/
 
 MINLINE void add_v2_fl(float r[2], float f)

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_view.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_view.c	2013-10-22 03:03:56 UTC (rev 60890)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_view.c	2013-10-22 03:31:21 UTC (rev 60891)
@@ -774,33 +774,31 @@
 	mat3_to_quat(rv3d->viewquat, tmat);
 }
 
-#define QUATSET(a, b, c, d, e) { a[0] = b; a[1] = c; a[2] = d; a[3] = e; } (void)0
-
 bool ED_view3d_lock(RegionView3D *rv3d)
 {
 	switch (rv3d->view) {
 		case RV3D_VIEW_BOTTOM:
-			QUATSET(rv3d->viewquat, 0.0, -1.0, 0.0, 0.0);
+			copy_v4_fl4(rv3d->viewquat, 0.0, -1.0, 0.0, 0.0);
 			break;
 
 		case RV3D_VIEW_BACK:
-			QUATSET(rv3d->viewquat, 0.0, 0.0, -M_SQRT1_2, -M_SQRT1_2);
+			copy_v4_fl4(rv3d->viewquat, 0.0, 0.0, -M_SQRT1_2, -M_SQRT1_2);
 			break;
 
 		case RV3D_VIEW_LEFT:
-			QUATSET(rv3d->viewquat, 0.5, -0.5, 0.5, 0.5);
+			copy_v4_fl4(rv3d->viewquat, 0.5, -0.5, 0.5, 0.5);
 			break;
 
 		case RV3D_VIEW_TOP:
-			QUATSET(rv3d->viewquat, 1.0, 0.0, 0.0, 0.0);
+			copy_v4_fl4(rv3d->viewquat, 1.0, 0.0, 0.0, 0.0);
 			break;
 
 		case RV3D_VIEW_FRONT:
-			QUATSET(rv3d->viewquat, M_SQRT1_2, -M_SQRT1_2, 0.0, 0.0);
+			copy_v4_fl4(rv3d->viewquat, M_SQRT1_2, -M_SQRT1_2, 0.0, 0.0);
 			break;
 
 		case RV3D_VIEW_RIGHT:
-			QUATSET(rv3d->viewquat, 0.5, -0.5, -0.5, -0.5);
+			copy_v4_fl4(rv3d->viewquat, 0.5, -0.5, -0.5, -0.5);
 			break;
 		default:
 			return false;




More information about the Bf-blender-cvs mailing list