diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-02-03 01:46:11 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-02-03 01:46:11 +0400 |
commit | 5c9ad8653a99d8a0aa247e63ba25d0291328535e (patch) | |
tree | e8f527c55ef190e4d04123be7f9c0b0b365cb989 | |
parent | e3958015db99927329604044094be1e6d3453e2d (diff) |
Fix #29921: render rasterization error in a corner case, only happened on 32bit
builds because of extended float precision, slightly tweaked code to avoid that,
so that it works the same as on 64bit.
-rw-r--r-- | source/blender/render/intern/source/zbuf.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index a46b3791693..0d5aed7dadb 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -212,9 +212,9 @@ void fillrect(int *rect, int x, int y, int val) } /* based on Liang&Barsky, for clipping of pyramidical volume */ -static short cliptestf(float p, float q, float *u1, float *u2) +static short cliptestf(float a, float b, float c, float d, float *u1, float *u2) { - float r; + float p= a + b, q= c + d, r; if(p<0.0f) { if(q<p) return 0; @@ -854,20 +854,20 @@ static int clipline(float v1[4], float v2[4]) /* return 0: do not draw */ filled in with zbufwire correctly when rendering in parts. otherwise you see line endings at edges... */ - if(cliptestf(-dz-dw, v1[3]+v1[2], &u1,&u2)) { - if(cliptestf(dz-dw, v1[3]-v1[2], &u1,&u2)) { + if(cliptestf(-dz, -dw, v1[3], v1[2], &u1,&u2)) { + if(cliptestf(dz, -dw, v1[3], -v1[2], &u1,&u2)) { dx= v2[0]-v1[0]; dz= 1.01f*(v2[3]-v1[3]); v13= 1.01f*v1[3]; - if(cliptestf(-dx-dz, v1[0]+v13, &u1,&u2)) { - if(cliptestf(dx-dz, v13-v1[0], &u1,&u2)) { + if(cliptestf(-dx, -dz, v1[0], v13, &u1,&u2)) { + if(cliptestf(dx, -dz, v13, -v1[0], &u1,&u2)) { dy= v2[1]-v1[1]; - if(cliptestf(-dy-dz, v1[1]+v13, &u1,&u2)) { - if(cliptestf(dy-dz, v13-v1[1], &u1,&u2)) { + if(cliptestf(-dy, -dz, v1[1], v13, &u1,&u2)) { + if(cliptestf(dy, -dz, v13, -v1[1], &u1,&u2)) { if(u2<1.0f) { v2[0]= v1[0]+u2*dx; @@ -1628,8 +1628,8 @@ static void clippyra(float *labda, float *v1, float *v2, int *b2, int *b3, int a * who would have thought that of L&B! */ - if(cliptestf(-da-dw, v13+v1[a], &u1,&u2)) { - if(cliptestf(da-dw, v13-v1[a], &u1,&u2)) { + if(cliptestf(-da, -dw, v13, v1[a], &u1,&u2)) { + if(cliptestf(da, -dw, v13, -v1[a], &u1,&u2)) { *b3=1; if(u2<1.0f) { labda[1]= u2; |