[Bf-blender-cvs] [8cc475c] master: Fix T43696: Baking tearing normals

Campbell Barton noreply at git.blender.org
Mon Apr 6 07:58:42 CEST 2015


Commit: 8cc475c40b8e0b316430b536dac7ca0251994124
Author: Campbell Barton
Date:   Mon Apr 6 15:53:06 2015 +1000
Branches: master
https://developer.blender.org/rB8cc475c40b8e0b316430b536dac7ca0251994124

Fix T43696: Baking tearing normals

Patch D1207 by @chrisr

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

M	source/blender/render/intern/source/zbuf.c

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

diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c
index 7e8f0e3..be2927d 100644
--- a/source/blender/render/intern/source/zbuf.c
+++ b/source/blender/render/intern/source/zbuf.c
@@ -1513,7 +1513,7 @@ void zspan_scanconvert(ZSpan *zspan, void *handle, float *v1, float *v2, float *
 	float x0, y0, x1, y1, x2, y2, z0, z1, z2;
 	float u, v, uxd, uyd, vxd, vyd, uy0, vy0, xx1;
 	const float *span1, *span2;
-	int x, y, sn1, sn2, rectx= zspan->rectx, my0, my2;
+	int i, j, x, y, sn1, sn2, rectx = zspan->rectx, my0, my2;
 	
 	/* init */
 	zbuf_init_span(zspan);
@@ -1574,7 +1574,7 @@ void zspan_scanconvert(ZSpan *zspan, void *handle, float *v1, float *v2, float *
 		span2= zspan->span1+my2;
 	}
 	
-	for (y=my2; y>=my0; y--, span1--, span2--) {
+	for (i = 0, y = my2; y >= my0; i++, y--, span1--, span2--) {
 		
 		sn1= floor(*span1);
 		sn2= floor(*span2);
@@ -1583,14 +1583,12 @@ void zspan_scanconvert(ZSpan *zspan, void *handle, float *v1, float *v2, float *
 		if (sn2>=rectx) sn2= rectx-1;
 		if (sn1<0) sn1= 0;
 		
-		u= (double)sn1*uxd + uy0;
-		v= (double)sn1*vxd + vy0;
-		
-		for (x= sn1; x<=sn2; x++, u+=uxd, v+=vxd)
-			func(handle, x, y, u, v);
+		u = (((double)sn1 * uxd) + uy0) - (i * uyd);
+		v = (((double)sn1 * vxd) + vy0) - (i * vyd);
 		
-		uy0 -= uyd;
-		vy0 -= vyd;
+		for (j = 0, x = sn1; x <= sn2; j++, x++) {
+			func(handle, x, y, u + (j * uxd), v + (j * vxd));
+		}
 	}
 }




More information about the Bf-blender-cvs mailing list