[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43861] trunk/blender/source/blender/ render/intern/source/zbuf.c: Fix #29921: render rasterization error in a corner case, only happened on 32bit
Brecht Van Lommel
brechtvanlommel at pandora.be
Thu Feb 2 22:46:20 CET 2012
Revision: 43861
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43861
Author: blendix
Date: 2012-02-02 21:46:11 +0000 (Thu, 02 Feb 2012)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/source/blender/render/intern/source/zbuf.c
Modified: trunk/blender/source/blender/render/intern/source/zbuf.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/zbuf.c 2012-02-02 21:07:56 UTC (rev 43860)
+++ trunk/blender/source/blender/render/intern/source/zbuf.c 2012-02-02 21:46:11 UTC (rev 43861)
@@ -212,9 +212,9 @@
}
/* 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 @@
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 @@
* 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;
More information about the Bf-blender-cvs
mailing list