diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-04-06 08:53:06 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-04-06 08:56:33 +0300 |
commit | 8cc475c40b8e0b316430b536dac7ca0251994124 (patch) | |
tree | eda342047951698d4224683ab24f0ed9175ea073 /source/blender/render/intern | |
parent | 986972701ea01667c97fe0831ac90a27ef15d881 (diff) |
Fix T43696: Baking tearing normals
Patch D1207 by @chrisr
Diffstat (limited to 'source/blender/render/intern')
-rw-r--r-- | source/blender/render/intern/source/zbuf.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index 7e8f0e3e9fc..be2927db9b0 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)); + } } } |