From 54d7d1efe215337d121813e27cd4909b9a76e912 Mon Sep 17 00:00:00 2001 From: Anthony LaTorre Date: Tue, 16 Aug 2011 17:07:52 -0400 Subject: add linear_extrude() function to make.py. rotate_extrude() now takes the number of rotational steps to extrude instead of the angle step size. updated documention in make.py. --- src/intersect.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/intersect.h') diff --git a/src/intersect.h b/src/intersect.h index d2f54ce..26e1d7e 100644 --- a/src/intersect.h +++ b/src/intersect.h @@ -60,17 +60,20 @@ __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__ unsigned int get_color(const float3 &direction, const float3 &v0, const float3& v1, const float3 &v2, const unsigned int base_color=0xFFFFFFFF) +__device__ unsigned int get_color(const float3 &direction, const float3 &v0, const float3& v1, const float3 &v2, unsigned int base_color=0xFFFFFF) { float scale = dot(normalize(cross(v1-v0,v2-v1)),-direction); + if (scale < 0.0f) + { + base_color = 0xff0000; + scale = dot(-normalize(cross(v1-v0,v2-v1)),-direction); + } + unsigned int r = 0xFF & (base_color >> 16); unsigned int g = 0xFF & (base_color >> 8); unsigned int b = 0xFF & base_color; - if (scale < 0.0f) - scale = dot(-normalize(cross(v1-v0,v2-v1)),-direction); - r = floorf(r*scale); g = floorf(g*scale); b = floorf(b*scale); -- cgit