[Bf-blender-cvs] [60822ec] master: Use looptri for BVH raycast (simple cases)

Campbell Barton noreply at git.blender.org
Thu Jul 23 06:46:10 CEST 2015


Commit: 60822ec183a514f38f478ec3f3a167f59865f027
Author: Campbell Barton
Date:   Thu Jul 23 13:20:34 2015 +1000
Branches: master
https://developer.blender.org/rB60822ec183a514f38f478ec3f3a167f59865f027

Use looptri for BVH raycast (simple cases)

===================================================================

M	source/blender/blenkernel/intern/constraint.c
M	source/blender/blenkernel/intern/shrinkwrap.c
M	source/blender/editors/transform/transform_snap.c
M	source/blender/modifiers/intern/MOD_surface.c
M	source/blender/modifiers/intern/MOD_weightvgproximity.c

===================================================================

diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 4f08643..be466c2 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -3438,7 +3438,7 @@ static void shrinkwrap_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstra
 					if (scon->shrinkType == MOD_SHRINKWRAP_NEAREST_VERTEX)
 						bvhtree_from_mesh_verts(&treeData, target, 0.0, 2, 6);
 					else
-						bvhtree_from_mesh_faces(&treeData, target, 0.0, 2, 6);
+						bvhtree_from_mesh_looptri(&treeData, target, 0.0, 2, 6);
 					
 					if (treeData.tree == NULL) {
 						fail = true;
@@ -3490,7 +3490,7 @@ static void shrinkwrap_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstra
 						break;
 					}
 
-					bvhtree_from_mesh_faces(&treeData, target, scon->dist, 4, 6);
+					bvhtree_from_mesh_looptri(&treeData, target, scon->dist, 4, 6);
 					if (treeData.tree == NULL) {
 						fail = true;
 						break;
@@ -4107,7 +4107,7 @@ static void followtrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase
 
 					sub_v3_v3v3(ray_nor, ray_end, ray_start);
 
-					bvhtree_from_mesh_faces(&treeData, target, 0.0f, 4, 6);
+					bvhtree_from_mesh_looptri(&treeData, target, 0.0f, 4, 6);
 
 					hit.dist = FLT_MAX;
 					hit.index = -1;
diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c
index 2ff81cd..5ecd2fc 100644
--- a/source/blender/blenkernel/intern/shrinkwrap.c
+++ b/source/blender/blenkernel/intern/shrinkwrap.c
@@ -279,8 +279,8 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc, bool for
 	}
 
 	/* After sucessufuly build the trees, start projection vertexs */
-	if (bvhtree_from_mesh_faces(&treeData, calc->target, 0.0, 4, 6) &&
-	    (auxMesh == NULL || bvhtree_from_mesh_faces(&auxData, auxMesh, 0.0, 4, 6)))
+	if (bvhtree_from_mesh_looptri(&treeData, calc->target, 0.0, 4, 6) &&
+	    (auxMesh == NULL || bvhtree_from_mesh_looptri(&auxData, auxMesh, 0.0, 4, 6)))
 	{
 
 #ifndef __APPLE__
@@ -381,7 +381,7 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
 	BVHTreeNearest nearest  = NULL_BVHTreeNearest;
 
 	/* Create a bvh-tree of the given target */
-	bvhtree_from_mesh_faces(&treeData, calc->target, 0.0, 2, 6);
+	bvhtree_from_mesh_looptri(&treeData, calc->target, 0.0, 2, 6);
 	if (treeData.tree == NULL) {
 		OUT_OF_MEMORY();
 		return;
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index d1cd33b..3b488fd 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -1533,7 +1533,7 @@ static bool snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMes
 			len_diff = 0.0f;  /* In case BVHTree would fail for some reason... */
 
 			treeData.em_evil = em;
-			bvhtree_from_mesh_faces(&treeData, dm, 0.0f, 2, 6);
+			bvhtree_from_mesh_looptri(&treeData, dm, 0.0f, 2, 6);
 			if (treeData.tree != NULL) {
 				nearest.index = -1;
 				nearest.dist_sq = FLT_MAX;
@@ -1575,7 +1575,7 @@ static bool snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMes
 				}
 
 				treeData.em_evil = em;
-				bvhtree_from_mesh_faces(&treeData, dm, 0.0f, 4, 6);
+				bvhtree_from_mesh_looptri(&treeData, dm, 0.0f, 4, 6);
 
 				hit.index = -1;
 				hit.dist = *r_depth;
diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c
index 3d998f2..abb652c 100644
--- a/source/blender/modifiers/intern/MOD_surface.c
+++ b/source/blender/modifiers/intern/MOD_surface.c
@@ -159,7 +159,7 @@ static void deformVerts(ModifierData *md, Object *ob,
 			surmd->bvhtree = MEM_callocN(sizeof(BVHTreeFromMesh), "BVHTreeFromMesh");
 
 		if (surmd->dm->getNumTessFaces(surmd->dm))
-			bvhtree_from_mesh_faces(surmd->bvhtree, surmd->dm, 0.0, 2, 6);
+			bvhtree_from_mesh_looptri(surmd->bvhtree, surmd->dm, 0.0, 2, 6);
 		else
 			bvhtree_from_mesh_edges(surmd->bvhtree, surmd->dm, 0.0, 2, 6);
 	}
diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c
index 8d71ddf..08d7d77 100644
--- a/source/blender/modifiers/intern/MOD_weightvgproximity.c
+++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c
@@ -98,7 +98,7 @@ static void get_vert2geom_distance(int numVerts, float (*v_cos)[3],
 	}
 	if (dist_f) {
 		/* Create a bvh-tree of the given target's faces. */
-		bvhtree_from_mesh_faces(&treeData_f, target, 0.0, 2, 6);
+		bvhtree_from_mesh_looptri(&treeData_f, target, 0.0, 2, 6);
 		if (treeData_f.tree == NULL) {
 			OUT_OF_MEMORY();
 			return;




More information about the Bf-blender-cvs mailing list