Revision: 15134
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15134
Author:   genscher
Date:     2008-06-05 15:02:17 +0200 (Thu, 05 Jun 2008)

Log Message:
-----------
BLI_kdopbvh: crashed when traversing with little faces

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/intern/BLI_kdopbvh.c

Modified: trunk/blender/source/blender/blenlib/intern/BLI_kdopbvh.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/BLI_kdopbvh.c   2008-06-05 
13:02:00 UTC (rev 15133)
+++ trunk/blender/source/blender/blenlib/intern/BLI_kdopbvh.c   2008-06-05 
13:02:17 UTC (rev 15134)
@@ -240,17 +240,16 @@
 //after a call to this function you can expect one of:
 //      every node to left of a[n] are smaller or equal to it
 //      every node to the right of a[n] are greater or equal to it
-int partition_nth_element(BVHNode **a, int _begin, int _end, int n, int axis){ 
       
-       int begin = _begin, end = _end, cut;        
-       int i;         
-       while(end-begin > 3)        
-       {                            
-               cut = bvh_partition(a, begin, end, bvh_medianof3(a, begin, 
(begin+end)/2, end-1, axis), axis );                 
-               if(cut <= n)                        
-                       begin = cut;                
-               else                        
-                       end = cut;        
-       }        
+int partition_nth_element(BVHNode **a, int _begin, int _end, int n, int axis){
+       int begin = _begin, end = _end, cut;
+       while(end-begin > 3)
+       {
+               cut = bvh_partition(a, begin, end, bvh_medianof3(a, begin, 
(begin+end)/2, end-1, axis), axis ); 
+               if(cut <= n)
+                       begin = cut;
+               else
+                       end = cut;
+       }
        bvh_insertionsort(a, begin, end, axis);
 
        return n;
@@ -415,7 +414,7 @@
 
        for (j = start; j < end; j++)
        {
-                // for all Axes.
+// for all Axes.
                for (i = tree->start_axis; i < tree->stop_axis; i++)
                {
                        newmin = tree->nodes[j]->bv[(2 * i)];   
@@ -696,7 +695,7 @@
        }
 
 #pragma omp parallel for private(j) schedule(static)
-       for(j = 0; j < tree1->tree_type; j++)
+       for(j = 0; j < MIN2(tree1->tree_type, 
tree1->nodes[tree1->totleaf]->totnode); j++)
        {
                traverse(data[j], tree1->nodes[tree1->totleaf]->children[j], 
tree2->nodes[tree2->totleaf]);
        }


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to