diff options
author | Anthony LaTorre <tlatorre9@gmail.com> | 2011-08-12 20:55:07 -0400 |
---|---|---|
committer | Anthony LaTorre <tlatorre9@gmail.com> | 2011-08-12 20:55:07 -0400 |
commit | 272c555f6b893a05f6d6a6439d519036e9379075 (patch) | |
tree | b14de78e915fd11fc037a9a415366a0a7ee4c45e /src/intersect.h | |
parent | 8328b6e53f51974afb4b22c8a84e4d0a99cf162b (diff) | |
download | chroma-272c555f6b893a05f6d6a6439d519036e9379075.tar.gz chroma-272c555f6b893a05f6d6a6439d519036e9379075.tar.bz2 chroma-272c555f6b893a05f6d6a6439d519036e9379075.zip |
do not check child nodes of a node at which the distance to the bounding box is further than a triangle the ray/photon has already intersected
Diffstat (limited to 'src/intersect.h')
-rw-r--r-- | src/intersect.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/intersect.h b/src/intersect.h index c400f1c..d2f54ce 100644 --- a/src/intersect.h +++ b/src/intersect.h @@ -60,7 +60,7 @@ __device__ bool intersect_triangle(const float3 &origin, const float3 &direction angle between the ray and the plane normal to determine the brightness. `direction` must be normalized. */ -__device__ int get_color(const float3 &direction, const float3 &v0, const float3& v1, const float3 &v2, const int base_color=0xFFFFFFFF) +__device__ unsigned int get_color(const float3 &direction, const float3 &v0, const float3& v1, const float3 &v2, const unsigned int base_color=0xFFFFFFFF) { float scale = dot(normalize(cross(v1-v0,v2-v1)),-direction); @@ -82,7 +82,7 @@ __device__ int get_color(const float3 &direction, const float3 &v0, const float3 direction `direction` and the axis-aligned box defined by the opposite vertices `lower_bound` and `upper_bound`. If the ray intersects the box return True, else return False. */ -__device__ bool intersect_box(const float3 &origin, const float3 &direction, const float3 &lower_bound, const float3 &upper_bound) +__device__ bool intersect_box(const float3 &origin, const float3 &direction, const float3 &lower_bound, const float3 &upper_bound, float& distance_to_box) { float kmin, kmax, kymin, kymax, kzmin, kzmax; @@ -149,6 +149,8 @@ __device__ bool intersect_box(const float3 &origin, const float3 &direction, con if (kmin > kmax) return false; + distance_to_box = kmin; + return true; } |