Bugfix for approximate AO to deal better with degenerate geometry.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 22 Jan 2008 14:01:50 +0000 (14:01 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 22 Jan 2008 14:01:50 +0000 (14:01 +0000)
source/blender/render/intern/source/occlusion.c

index 620151b6c70c4b71954adfd6eb90dc663db23724..7d7ed5bcdce1992afbbf59974bc716956be97df7 100644 (file)
@@ -471,6 +471,10 @@ static void occ_build_8_split(OcclusionTree *tree, int begin, int end, int *offs
 
        occ_build_split(tree, begin, end, &splitx);
 
+       /* force split if none found, to deal with degenerate geometry */
+       if(splitx == begin || splitx == end)
+               splitx= (begin+end)/2;
+
        occ_build_split(tree, begin, splitx, &splity[0]);
        occ_build_split(tree, splitx, end, &splity[1]);