diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2018-07-08 13:47:26 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2018-10-01 15:47:03 +0300 |
commit | e38a0b3748683a35601c256053f716ad8b57002f (patch) | |
tree | 940e008c1259316cf58921538b96b208fce84da0 /source/blender/blenkernel/intern/shrinkwrap.c | |
parent | be0e58d980d963c60869c412ada86641baaa2e48 (diff) |
Shrinkwrap Constraint: implement projection features from the modifier.
Allow raycasting in two directions and culling front or back faces.
Also implement a new Invert Cull option in both constraint and
modifier that can be used to aim for faces aligned with the project
axis direction when raycasting both ways.
Reviewers: mont29
Differential Revision: https://developer.blender.org/D3737
Diffstat (limited to 'source/blender/blenkernel/intern/shrinkwrap.c')
-rw-r--r-- | source/blender/blenkernel/intern/shrinkwrap.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c index 21b21d6ddd8..5408c07adf1 100644 --- a/source/blender/blenkernel/intern/shrinkwrap.c +++ b/source/blender/blenkernel/intern/shrinkwrap.c @@ -240,7 +240,7 @@ bool BKE_shrinkwrap_project_normal( BLI_space_transform_invert_normal(transf, hit_tmp.no); } - if (options & (MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE | MOD_SHRINKWRAP_CULL_TARGET_BACKFACE)) { + if (options & MOD_SHRINKWRAP_CULL_TARGET_MASK) { /* apply backface */ const float dot = dot_v3v3(dir, hit_tmp.no); if (((options & MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE) && dot <= 0.0f) || @@ -341,6 +341,12 @@ static void shrinkwrap_calc_normal_projection_cb_ex( float inv_no[3]; negate_v3_v3(inv_no, tmp_no); + char options = calc->smd->shrinkOpts; + + if ((options & MOD_SHRINKWRAP_INVERT_CULL_TARGET) && (options & MOD_SHRINKWRAP_CULL_TARGET_MASK)) { + options ^= MOD_SHRINKWRAP_CULL_TARGET_MASK; + } + if (aux_tree) { BKE_shrinkwrap_project_normal( 0, tmp_co, inv_no, 0.0, @@ -349,7 +355,7 @@ static void shrinkwrap_calc_normal_projection_cb_ex( } BKE_shrinkwrap_project_normal( - calc->smd->shrinkOpts, tmp_co, inv_no, 0.0, + options, tmp_co, inv_no, 0.0, &calc->local2target, targ_tree, hit, targ_callback, treeData); } |