[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55009] trunk/blender/source/blender/ editors: code cleanup: view3d_clipping_test was making a vector copy for no reason.

Campbell Barton ideasman42 at gmail.com
Mon Mar 4 08:15:09 CET 2013


Revision: 55009
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55009
Author:   campbellbarton
Date:     2013-03-04 07:15:09 +0000 (Mon, 04 Mar 2013)
Log Message:
-----------
code cleanup: view3d_clipping_test was making a vector copy for no reason.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/include/ED_view3d.h
    trunk/blender/source/blender/editors/space_view3d/view3d_draw.c
    trunk/blender/source/blender/editors/transform/transform_constraints.c

Modified: trunk/blender/source/blender/editors/include/ED_view3d.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_view3d.h	2013-03-04 07:11:42 UTC (rev 55008)
+++ trunk/blender/source/blender/editors/include/ED_view3d.h	2013-03-04 07:15:09 UTC (rev 55009)
@@ -219,7 +219,7 @@
 
 void ED_view3d_clipping_calc(struct BoundBox *bb, float planes[4][4], struct bglMats *mats, const struct rcti *rect);
 void ED_view3d_clipping_local(struct RegionView3D *rv3d, float mat[4][4]);
-int  ED_view3d_clipping_test(struct RegionView3D *rv3d, const float vec[3], const int is_local);
+int  ED_view3d_clipping_test(struct RegionView3D *rv3d, const float co[3], const bool is_local);
 void ED_view3d_clipping_set(struct RegionView3D *rv3d);
 void ED_view3d_clipping_enable(void);
 void ED_view3d_clipping_disable(void);

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_draw.c	2013-03-04 07:11:42 UTC (rev 55008)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_draw.c	2013-03-04 07:15:09 UTC (rev 55009)
@@ -219,15 +219,12 @@
 	}
 }
 
-static int view3d_clipping_test(const float vec[3], float clip[6][4])
+static int view3d_clipping_test(const float co[3], float clip[6][4])
 {
-	float view[3];
-	copy_v3_v3(view, vec);
-
-	if (0.0f < clip[0][3] + dot_v3v3(view, clip[0]))
-		if (0.0f < clip[1][3] + dot_v3v3(view, clip[1]))
-			if (0.0f < clip[2][3] + dot_v3v3(view, clip[2]))
-				if (0.0f < clip[3][3] + dot_v3v3(view, clip[3]))
+	if (0.0f < clip[0][3] + dot_v3v3(co, clip[0]))
+		if (0.0f < clip[1][3] + dot_v3v3(co, clip[1]))
+			if (0.0f < clip[2][3] + dot_v3v3(co, clip[2]))
+				if (0.0f < clip[3][3] + dot_v3v3(co, clip[3]))
 					return 0;
 
 	return 1;
@@ -235,9 +232,9 @@
 
 /* for 'local' ED_view3d_clipping_local must run first
  * then all comparisons can be done in localspace */
-int ED_view3d_clipping_test(RegionView3D *rv3d, const float vec[3], const int is_local)
+int ED_view3d_clipping_test(RegionView3D *rv3d, const float co[3], const bool is_local)
 {
-	return view3d_clipping_test(vec, is_local ? rv3d->clip_local : rv3d->clip);
+	return view3d_clipping_test(co, is_local ? rv3d->clip_local : rv3d->clip);
 }
 
 /* ********* end custom clipping *********** */

Modified: trunk/blender/source/blender/editors/transform/transform_constraints.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_constraints.c	2013-03-04 07:11:42 UTC (rev 55008)
+++ trunk/blender/source/blender/editors/transform/transform_constraints.c	2013-03-04 07:15:09 UTC (rev 55009)
@@ -29,19 +29,17 @@
  *  \ingroup edtransform
  */
 
-
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <math.h>
 
 #ifndef WIN32
-#include <unistd.h>
+#  include <unistd.h>
 #else
-#include <io.h>
+#  include <io.h>
 #endif
 
-
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_screen_types.h"
@@ -53,13 +51,13 @@
 
 #include "BKE_context.h"
 
-#include "ED_image.h"
-#include "ED_view3d.h"
-
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
 #include "BLI_string.h"
 
+#include "ED_image.h"
+#include "ED_view3d.h"
+
 #include "BLF_translation.h"
 
 #include "UI_resources.h"




More information about the Bf-blender-cvs mailing list