diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_shrinkwrap.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh_remap.c | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/shrinkwrap.c | 14 |
4 files changed, 17 insertions, 19 deletions
diff --git a/source/blender/blenkernel/BKE_shrinkwrap.h b/source/blender/blenkernel/BKE_shrinkwrap.h index d2ab4f3164c..31b4b5cecc5 100644 --- a/source/blender/blenkernel/BKE_shrinkwrap.h +++ b/source/blender/blenkernel/BKE_shrinkwrap.h @@ -90,7 +90,7 @@ void shrinkwrapModifier_deform(struct ShrinkwrapModifierData *smd, struct Object * (where each tree was built on its own coords space) */ bool BKE_shrinkwrap_project_normal( - char options, const float vert[3], const float dir[3], + char options, const float vert[3], const float dir[3], const float ray_radius, const struct SpaceTransform *transf, BVHTree *tree, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata); diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index b192cb7cef2..c2c72e290eb 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -3485,15 +3485,15 @@ static void shrinkwrap_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstrai break; } - bvhtree_from_mesh_looptri(&treeData, target, scon->dist, 4, 6); + bvhtree_from_mesh_get(&treeData, target, BVHTREE_FROM_LOOPTRI, 4); if (treeData.tree == NULL) { fail = true; break; } - - if (BKE_shrinkwrap_project_normal(0, co, no, &transform, treeData.tree, &hit, - treeData.raycast_callback, &treeData) == false) + treeData.sphere_radius = scon->dist; + if (BKE_shrinkwrap_project_normal(0, co, no, treeData.sphere_radius, &transform, treeData.tree, + &hit, treeData.raycast_callback, &treeData) == false) { fail = true; break; diff --git a/source/blender/blenkernel/intern/mesh_remap.c b/source/blender/blenkernel/intern/mesh_remap.c index 8dc812463db..84994e80784 100644 --- a/source/blender/blenkernel/intern/mesh_remap.c +++ b/source/blender/blenkernel/intern/mesh_remap.c @@ -543,15 +543,13 @@ void BKE_mesh_remap_calc_verts_from_dm( float *weights = MEM_mallocN(sizeof(*weights) * tmp_buff_size, __func__); dm_src->getVertCos(dm_src, vcos_src); - if (mode & MREMAP_USE_NORPROJ) { - bvhtree_from_mesh_looptri( - &treedata, dm_src, 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_VERT_POLYINTERP_VNORPROJ) { + if (mode & MREMAP_USE_NORPROJ) { + treedata.sphere_radius = ray_radius; + } for (i = 0; i < numverts_dst; i++) { copy_v3_v3(tmp_co, verts_dst[i].co); normal_short_to_float_v3(tmp_no, verts_dst[i].no); diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c index ced836181a5..bf22b106cf8 100644 --- a/source/blender/blenkernel/intern/shrinkwrap.c +++ b/source/blender/blenkernel/intern/shrinkwrap.c @@ -191,8 +191,8 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc) * MOD_SHRINKWRAP_CULL_TARGET_BACKFACE (back faces hits are ignored) */ bool BKE_shrinkwrap_project_normal( - char options, const float vert[3], - const float dir[3], const SpaceTransform *transf, + char options, const float vert[3], const float dir[3], + const float ray_radius, const SpaceTransform *transf, BVHTree *tree, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata) { @@ -229,7 +229,7 @@ bool BKE_shrinkwrap_project_normal( hit_tmp.index = -1; - BLI_bvhtree_ray_cast(tree, co, no, 0.0f, &hit_tmp, callback, userdata); + BLI_bvhtree_ray_cast(tree, co, no, ray_radius, &hit_tmp, callback, userdata); if (hit_tmp.index != -1) { /* invert the normal first so face culling works on rotated objects */ @@ -322,13 +322,13 @@ static void shrinkwrap_calc_normal_projection_cb_ex( if (calc->smd->shrinkOpts & MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR) { if (aux_tree) { BKE_shrinkwrap_project_normal( - 0, tmp_co, tmp_no, + 0, tmp_co, tmp_no, 0.0, local2aux, aux_tree, hit, aux_callback, auxData); } BKE_shrinkwrap_project_normal( - calc->smd->shrinkOpts, tmp_co, tmp_no, + calc->smd->shrinkOpts, tmp_co, tmp_no, 0.0, &calc->local2target, targ_tree, hit, targ_callback, treeData); } @@ -340,13 +340,13 @@ static void shrinkwrap_calc_normal_projection_cb_ex( if (aux_tree) { BKE_shrinkwrap_project_normal( - 0, tmp_co, inv_no, + 0, tmp_co, inv_no, 0.0, local2aux, aux_tree, hit, aux_callback, auxData); } BKE_shrinkwrap_project_normal( - calc->smd->shrinkOpts, tmp_co, inv_no, + calc->smd->shrinkOpts, tmp_co, inv_no, 0.0, &calc->local2target, targ_tree, hit, targ_callback, treeData); } |