summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony LaTorre <tlatorre9@gmail.com>2011-08-15 21:36:07 -0400
committerAnthony LaTorre <tlatorre9@gmail.com>2011-08-15 21:36:07 -0400
commitfd2e841c4c40f9e46258ac8d11c32c2204cddd5b (patch)
tree70ce88efb4ffad81846d9e8f32a02887d160ce64
parent1913c9cbed2ce6404c2a9650b49e400918a94df5 (diff)
parentfbe20d1adc26e724c92a9070d49a97808676c047 (diff)
downloadchroma-fd2e841c4c40f9e46258ac8d11c32c2204cddd5b.tar.gz
chroma-fd2e841c4c40f9e46258ac8d11c32c2204cddd5b.tar.bz2
chroma-fd2e841c4c40f9e46258ac8d11c32c2204cddd5b.zip
merge
-rwxr-xr-xcamera.py13
-rw-r--r--images/doomhud.pngbin0 -> 17911 bytes
-rw-r--r--src/photon.h6
3 files changed, 19 insertions, 0 deletions
diff --git a/camera.py b/camera.py
index c270472..d7c2038 100755
--- a/camera.py
+++ b/camera.py
@@ -79,6 +79,17 @@ class Camera(Thread):
pygame.display.set_caption('')
self.clock = pygame.time.Clock()
+ self.doom_mode = False
+ try:
+ if self.width == 640: # SECRET DOOM MODE!
+ print 'shotgun activated!'
+ self.doom_hud = pygame.image.load('images/doomhud.png').convert_alpha()
+ rect = self.doom_hud.get_rect()
+ self.doom_rect = rect.move(0, self.height - rect.height)
+ self.doom_mode = True
+ except:
+ pass
+
lower_bound, upper_bound = self.geometry.mesh.get_bounds()
self.scale = np.linalg.norm(upper_bound-lower_bound)
@@ -212,6 +223,8 @@ class Camera(Thread):
self.kernels.ray_trace(np.int32(self.pixels_gpu.size), self.origins_gpu, self.directions_gpu, self.pixels_gpu, block=(self.nblocks,1,1), grid=(self.pixels_gpu.size//self.nblocks+1,1))
pygame.surfarray.blit_array(self.screen, self.pixels_gpu.get().reshape(self.size))
+ if self.doom_mode:
+ self.screen.blit(self.doom_hud, self.doom_rect)
pygame.display.flip()
if self.movie:
diff --git a/images/doomhud.png b/images/doomhud.png
new file mode 100644
index 0000000..3c11b78
--- /dev/null
+++ b/images/doomhud.png
Binary files differ
diff --git a/src/photon.h b/src/photon.h
index fb29ffe..fa3b85b 100644
--- a/src/photon.h
+++ b/src/photon.h
@@ -1,6 +1,7 @@
#ifndef __PHOTON_H__
#define __PHOTON_H__
+#include "stdio.h"
#include "linalg.h"
#include "materials.h"
#include "rotate.h"
@@ -102,6 +103,9 @@ __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)
@@ -152,6 +156,8 @@ __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;