From 6b53b4afb9cb2f334ca4503f05b02e7acc5f68e5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 20 Aug 2015 15:09:25 +1000 Subject: Avoid redundant normal calculation in heat-weight --- source/blender/editors/armature/meshlaplacian.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'source/blender/editors/armature') diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index 543874b44d0..da53d0a1005 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -386,18 +386,21 @@ static void bvh_callback(void *userdata, int index, const BVHTreeRay *UNUSED(ray const MLoop *mloop = data->sys->heat.mloop; float (*verts)[3] = data->sys->heat.verts; const float *vtri_co[3]; - float lambda, uv[2], n[3], dir[3]; + float lambda, dir[3]; mul_v3_v3fl(dir, data->vec, hit->dist); vtri_co[0] = verts[mloop[lt->tri[0]].v]; vtri_co[1] = verts[mloop[lt->tri[1]].v]; vtri_co[2] = verts[mloop[lt->tri[2]].v]; - if (isect_ray_tri_v3(data->start, dir, UNPACK3(vtri_co), &lambda, uv)) { - normal_tri_v3(n, UNPACK3(vtri_co)); - if (lambda < 1.0f && dot_v3v3(n, data->vec) < -1e-5f) { - hit->index = index; - hit->dist *= lambda; + if (isect_ray_tri_v3(data->start, dir, UNPACK3(vtri_co), &lambda, NULL)) { + if (lambda < 1.0f) { + float n[3]; + normal_tri_v3(n, UNPACK3(vtri_co)); + if (dot_v3v3(n, data->vec) < -1e-5f) { + hit->index = index; + hit->dist *= lambda; + } } } } -- cgit v1.2.3