[Bf-blender-cvs] [6b53b4a] master: Avoid redundant normal calculation in heat-weight

Campbell Barton noreply at git.blender.org
Thu Aug 20 07:15:46 CEST 2015


Commit: 6b53b4afb9cb2f334ca4503f05b02e7acc5f68e5
Author: Campbell Barton
Date:   Thu Aug 20 15:09:25 2015 +1000
Branches: master
https://developer.blender.org/rB6b53b4afb9cb2f334ca4503f05b02e7acc5f68e5

Avoid redundant normal calculation in heat-weight

===================================================================

M	source/blender/blenkernel/intern/particle_distribute.c
M	source/blender/editors/armature/meshlaplacian.c

===================================================================

diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c
index 5063446..87bc355 100644
--- a/source/blender/blenkernel/intern/particle_distribute.c
+++ b/source/blender/blenkernel/intern/particle_distribute.c
@@ -545,7 +545,7 @@ static void distribute_from_volume_exec(ParticleTask *thread, ParticleData *pa,
 		v2=mvert[mface->v2].co;
 		v3=mvert[mface->v3].co;
 		
-		if (isect_ray_tri_v3(co, nor, v2, v3, v1, &cur_d, 0)) {
+		if (isect_ray_tri_v3(co, nor, v2, v3, v1, &cur_d, NULL)) {
 			if (cur_d<min_d) {
 				min_d=cur_d;
 				pa->foffset=cur_d*0.5f; /* to the middle of volume */
@@ -555,7 +555,7 @@ static void distribute_from_volume_exec(ParticleTask *thread, ParticleData *pa,
 		if (mface->v4) {
 			v4=mvert[mface->v4].co;
 			
-			if (isect_ray_tri_v3(co, nor, v4, v1, v3, &cur_d, 0)) {
+			if (isect_ray_tri_v3(co, nor, v4, v1, v3, &cur_d, NULL)) {
 				if (cur_d<min_d) {
 					min_d=cur_d;
 					pa->foffset=cur_d*0.5f; /* to the middle of volume */
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index 543874b..da53d0a 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;
+			}
 		}
 	}
 }




More information about the Bf-blender-cvs mailing list