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:
authorCampbell Barton <ideasman42@gmail.com>2015-08-21 10:05:48 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-08-21 10:09:18 +0300
commitc727fc59abe2b7e525bdc6594bbd7ec3285936e0 (patch)
treedfcadf23e28c2464655f4c06a5f94621721fe0c2 /source/blender/editors/mesh/editmesh_knife.c
parenta98b02ff941edb1d92892f520641433582754f0d (diff)
BVH-raycast: ensure input direction is unit-length
This was already the case for most users of ray-cast. Doing this avoids 2x normalize calls per ray-cast in many places.
Diffstat (limited to 'source/blender/editors/mesh/editmesh_knife.c')
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index caafaf06e9e..787b79f0d6e 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -1809,13 +1809,14 @@ static BMFace *knife_find_closest_face(KnifeTool_OpData *kcd, float co[3], float
float dist = KMAXDIST;
float origin[3];
float origin_ofs[3];
- float ray[3];
+ float ray[3], ray_normal[3];
/* unproject to find view ray */
knife_input_ray_segment(kcd, kcd->curr.mval, 1.0f, origin, origin_ofs);
sub_v3_v3v3(ray, origin_ofs, origin);
+ normalize_v3_v3(ray_normal, ray);
- f = BKE_bmbvh_ray_cast(kcd->bmbvh, origin, ray, 0.0f, NULL, co, cageco);
+ f = BKE_bmbvh_ray_cast(kcd->bmbvh, origin, ray_normal, 0.0f, NULL, co, cageco);
if (f && kcd->only_select && BM_elem_flag_test(f, BM_ELEM_SELECT) == 0) {
f = NULL;