diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/intersect.h | 11 | ||||
-rw-r--r-- | src/photon.h | 5 |
2 files changed, 7 insertions, 9 deletions
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); diff --git a/src/photon.h b/src/photon.h index fa3b85b..f76ca54 100644 --- a/src/photon.h +++ b/src/photon.h @@ -103,9 +103,6 @@ __device__ void fill_state(State &s, Photon &p) s.absorption_length = interp_property(p.wavelength, material1.absorption_length); s.scattering_length = interp_property(p.wavelength, material1.scattering_length); - printf("wavelength = %f", p.wavelength); - printf("scattering length = %f\n", s.scattering_length); - } // fill_state __device__ void rayleigh_scatter(Photon &p, curandState &rng) @@ -156,8 +153,6 @@ __device__ int propagate_to_boundary(Photon &p, State &s, curandState &rng) { if (scattering_distance <= s.distance_to_boundary) { - printf("scattering distance = %f\n", scattering_distance); - p.time += scattering_distance/(SPEED_OF_LIGHT/s.refractive_index1); p.position += scattering_distance*p.direction; |