summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony LaTorre <tlatorre9@gmail.com>2011-09-11 01:39:03 -0400
committerAnthony LaTorre <tlatorre9@gmail.com>2011-09-11 01:39:03 -0400
commit9a17b5ce0489bdb60ca04b441d2c44452edfb50e (patch)
treede015da0877b80e465974f8cf203c10d788d178a
parent1a3dc65dd50d1cfb8ef819abbdbdf99e61b3ed0b (diff)
downloadchroma-9a17b5ce0489bdb60ca04b441d2c44452edfb50e.tar.gz
chroma-9a17b5ce0489bdb60ca04b441d2c44452edfb50e.tar.bz2
chroma-9a17b5ce0489bdb60ca04b441d2c44452edfb50e.zip
speedup triangle intersection by reducing STACK_SIZE.
-rw-r--r--src/mesh.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mesh.h b/src/mesh.h
index 73dff71..d60d801 100644
--- a/src/mesh.h
+++ b/src/mesh.h
@@ -4,7 +4,9 @@
#include "intersect.h"
#include "geometry.h"
-#define STACK_SIZE 500
+#include "stdio.h"
+
+#define STACK_SIZE 100
/* Tests the intersection between a ray and a node in the bounding volume
hierarchy. If the ray intersects the bounding volume and `min_distance`
@@ -109,6 +111,11 @@ intersect_mesh(const float3 &origin, const float3& direction, Geometry *g,
} // node is a leaf
+ if (node > tail) {
+ printf("warning: intersect_mesh() aborted; node > tail\n");
+ break;
+ }
+
} // while loop
while (node != head);