Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2018-07-08 13:47:26 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2018-10-01 15:47:03 +0300
commite38a0b3748683a35601c256053f716ad8b57002f (patch)
tree940e008c1259316cf58921538b96b208fce84da0 /source/blender/blenkernel/intern/constraint.c
parentbe0e58d980d963c60869c412ada86641baaa2e48 (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/constraint.c')
-rw-r--r--source/blender/blenkernel/intern/constraint.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index b1a7c98dc9c..575f534c7ca 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -3533,8 +3533,24 @@ static void shrinkwrap_get_tarmat(struct Depsgraph *depsgraph, bConstraint *con,
break;
}
- if (BKE_shrinkwrap_project_normal(0, co, no, 0.0f, &transform, treeData.tree,
- &hit, treeData.raycast_callback, &treeData) == false)
+ char cull_mode = scon->flag & CON_SHRINKWRAP_PROJECT_CULL_MASK;
+
+ BKE_shrinkwrap_project_normal(cull_mode, co, no, 0.0f, &transform, treeData.tree,
+ &hit, treeData.raycast_callback, &treeData);
+
+ if (scon->flag & CON_SHRINKWRAP_PROJECT_OPPOSITE) {
+ float inv_no[3];
+ negate_v3_v3(inv_no, no);
+
+ if ((scon->flag & CON_SHRINKWRAP_PROJECT_INVERT_CULL) && (cull_mode != 0)) {
+ cull_mode ^= CON_SHRINKWRAP_PROJECT_CULL_MASK;
+ }
+
+ BKE_shrinkwrap_project_normal(cull_mode, co, inv_no, 0.0f, &transform, treeData.tree,
+ &hit, treeData.raycast_callback, &treeData);
+ }
+
+ if (hit.index < 0)
{
fail = true;
break;