From 9a17b5ce0489bdb60ca04b441d2c44452edfb50e Mon Sep 17 00:00:00 2001 From: Anthony LaTorre Date: Sun, 11 Sep 2011 01:39:03 -0400 Subject: speedup triangle intersection by reducing STACK_SIZE. --- src/mesh.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/mesh.h') 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); -- cgit