[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16012] trunk/blender/source/blender/ blenlib/intern/BLI_kdopbvh.c: Fixing compile error with msvc ( introducing max tree to 32)

Daniel Genrich daniel.genrich at gmx.net
Fri Aug 8 00:05:45 CEST 2008


Revision: 16012
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16012
Author:   genscher
Date:     2008-08-08 00:05:45 +0200 (Fri, 08 Aug 2008)

Log Message:
-----------
Fixing compile error with msvc (introducing max tree to 32)

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-08-07 20:41:45 UTC (rev 16011)
+++ trunk/blender/source/blender/blenlib/intern/BLI_kdopbvh.c	2008-08-07 22:05:45 UTC (rev 16012)
@@ -43,6 +43,10 @@
 #include <omp.h>
 #endif
 
+
+
+#define MAX_TREETYPE 32
+
 typedef struct BVHNode
 {
 	struct BVHNode **children;
@@ -490,7 +494,7 @@
 #endif
 
 //Helper data and structures to build a min-leaf generalized implicit tree
-//This code can be easily reduced (basicly this is only method to calculate pow(k, n) in O(1).. and sutff like that)
+//This code can be easily reduced (basicly this is only method to calculate pow(k, n) in O(1).. and stuff like that)
 typedef struct BVHBuildHelper
 {
 	int tree_type;				//
@@ -648,7 +652,7 @@
 			int k;
 			const int parent_level_index= j-i;
 			BVHNode* parent = branches_array + j;
-			int nth_positions[ tree_type + 1 ];
+			int nth_positions[ MAX_TREETYPE + 1];
 			char split_axis;
 
 			int parent_leafs_begin = implicit_leafs_index(&data, depth, parent_level_index);
@@ -713,6 +717,9 @@
 	// theres not support for trees below binary-trees :P
 	if(tree_type < 2)
 		return NULL;
+	
+	if(tree_type > MAX_TREETYPE)
+		return NULL;
 
 	tree = (BVHTree *)MEM_callocN(sizeof(BVHTree), "BVHTree");
 	





More information about the Bf-blender-cvs mailing list