diff options
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; } |