[Bf-blender-cvs] [8c6a1d8f954] master: Mesh Remap: Face Data: Do not use large epsilon values to create bvhtree.

Germano noreply at git.blender.org
Fri May 4 13:29:09 CEST 2018


Commit: 8c6a1d8f954e91bb676d97c8f0f7f162b41db4c3
Author: Germano
Date:   Fri May 4 08:29:00 2018 -0300
Branches: master
https://developer.blender.org/rB8c6a1d8f954e91bb676d97c8f0f7f162b41db4c3

Mesh Remap: Face Data: Do not use large epsilon values to create bvhtree.

If you need the approximation, use raycast radius.

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

M	source/blender/blenkernel/intern/mesh_remap.c

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

diff --git a/source/blender/blenkernel/intern/mesh_remap.c b/source/blender/blenkernel/intern/mesh_remap.c
index 84994e80784..8e93be14f6b 100644
--- a/source/blender/blenkernel/intern/mesh_remap.c
+++ b/source/blender/blenkernel/intern/mesh_remap.c
@@ -2013,13 +2013,7 @@ void BKE_mesh_remap_calc_polys_from_dm(
 		BVHTreeRayHit rayhit = {0};
 		float hit_dist;
 
-		if (mode & MREMAP_USE_NORPROJ) {
-			bvhtree_from_mesh_looptri(
-			        &treedata, dm_src, MREMAP_RAYCAST_APPROXIMATE_BVHEPSILON(ray_radius), 2, 6);
-		}
-		else {
-			bvhtree_from_mesh_get(&treedata, dm_src, BVHTREE_FROM_LOOPTRI, 2);
-		}
+		bvhtree_from_mesh_get(&treedata, dm_src, BVHTREE_FROM_LOOPTRI, 2);
 
 		if (mode == MREMAP_MODE_POLY_NEAREST) {
 			nearest.index = -1;
@@ -2062,6 +2056,7 @@ void BKE_mesh_remap_calc_polys_from_dm(
 					BLI_space_transform_apply_normal(space_transform, tmp_no);
 				}
 
+				treedata.sphere_radius = ray_radius;
 				if (mesh_remap_bvhtree_query_raycast(
 				        &treedata, &rayhit, tmp_co, tmp_no, ray_radius, max_dist, &hit_dist))
 				{
@@ -2211,8 +2206,9 @@ void BKE_mesh_remap_calc_polys_from_dm(
 
 						/* At this point, tmp_co is a point on our poly surface, in mesh_src space! */
 						while (n--) {
+							treedata.sphere_radius = ray_radius / w;
 							if (mesh_remap_bvhtree_query_raycast(
-							        &treedata, &rayhit, tmp_co, tmp_no, ray_radius / w, max_dist, &hit_dist))
+							        &treedata, &rayhit, tmp_co, tmp_no, treedata.sphere_radius, max_dist, &hit_dist))
 							{
 								const MLoopTri *lt = &treedata.looptri[rayhit.index];



More information about the Bf-blender-cvs mailing list