summaryrefslogtreecommitdiff
path: root/view.py
diff options
context:
space:
mode:
authorAnthony LaTorre <tlatorre9@gmail.com>2011-07-20 17:48:32 -0400
committerAnthony LaTorre <tlatorre9@gmail.com>2011-07-20 17:48:32 -0400
commit46011a8e4ffa31f4b057b20b84e5b45b447902b7 (patch)
treecde666bfb4b568c74923dff4a1de99505ff89ed1 /view.py
parentf5a328b72ebb643b51cae41a991c934da712f0e5 (diff)
downloadchroma-46011a8e4ffa31f4b057b20b84e5b45b447902b7.tar.gz
chroma-46011a8e4ffa31f4b057b20b84e5b45b447902b7.tar.bz2
chroma-46011a8e4ffa31f4b057b20b84e5b45b447902b7.zip
pulled a lot of the photon propagation code out of src/kernel.cu into src/photon.h so that photon propagation by propagate() in kernel.cu and the hybrid monte carlo ray tracing use the same code. instead of a single state, photons now carry the history of the processes they've undergone. this history is stored as a bitmask; see src/photon.h. start_node and first_node of the mesh are now stored as global variables in mesh.h instead of being passed to kernel functions.
Diffstat (limited to 'view.py')
-rwxr-xr-xview.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/view.py b/view.py
index 5dfd995..c01dd3f 100755
--- a/view.py
+++ b/view.py
@@ -12,6 +12,7 @@ import src
from camera import Camera
from geometry import Mesh, Solid, Geometry
from transform import rotate
+from optics import *
from pycuda import autoinit
from pycuda.compiler import SourceModule
@@ -69,7 +70,7 @@ def build(obj, bits):
geometry.add_solid(obj)
elif isinstance(obj, Mesh):
geometry = Geometry()
- geometry.add_solid(Solid(obj))
+ geometry.add_solid(Solid(obj, vacuum, vacuum, surface=lambertian_surface))
else:
raise Exception('cannot build type %s' % type(obj))
@@ -190,12 +191,10 @@ def view(viewable, size=(800,600), name='', bits=8, load_bvh=False):
nblocks = 64
- gpu_kwargs = {'block': (nblocks,1,1), 'grid':(pixels_gpu.size/nblocks+1,1)}
-
def update():
"""Render the mesh and display to screen."""
t0 = time.time()
- cuda_raytrace(np.int32(pixels_gpu.size), origins_gpu, directions_gpu, np.int32(geometry.node_map.size-1), np.int32(geometry.first_node), pixels_gpu, block=(nblocks,1,1), grid=(pixels_gpu.size//nblocks+1,1))
+ cuda_raytrace(np.int32(pixels_gpu.size), origins_gpu, directions_gpu, pixels_gpu, block=(nblocks,1,1), grid=(pixels_gpu.size//nblocks+1,1))
cuda.Context.synchronize()
elapsed = time.time() - t0