src/octree.cc
branchpyrit
changeset 103 3b3257a410fe
parent 95 ca7d4c665531
--- a/src/octree.cc	Mon Sep 08 20:14:24 2014 +0200
+++ b/src/octree.cc	Tue Jul 26 17:41:36 2016 +0200
@@ -26,6 +26,8 @@
 
 #include "octree.h"
 
+const int Octree::MAX_DEPTH = 10;
+
 OctreeNode::~OctreeNode()
 {
 	if (isLeaf())
@@ -101,7 +103,7 @@
 	ShapeList::iterator shape;
 	for (shape = shapes.begin(); shape != shapes.end(); shape++)
 		root->addShape(*shape);
-	root->subdivide(bbox, max_depth);
+	root->subdivide(bbox, MAX_DEPTH);
 	built = true;
 }
 
@@ -155,12 +157,7 @@
 	if (!built)
 		return Container::nearest_intersection(origin_shape, ray, nearest_distance);
 
-#ifdef MSVC
-	// MSVC wants constant expression here... hope it won't overflow :)
-	OctreeTravState st[20];
-#else
-	OctreeTravState st[max_depth+1];
-#endif
+	OctreeTravState st[MAX_DEPTH+1];
 	OctreeTravState *st_cur = st;
 
 #	define node	st_cur->node