summaryrefslogtreecommitdiff
path: root/geometry.py
diff options
context:
space:
mode:
Diffstat (limited to 'geometry.py')
-rw-r--r--geometry.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/geometry.py b/geometry.py
index 0569dcd..938001e 100644
--- a/geometry.py
+++ b/geometry.py
@@ -231,6 +231,26 @@ class Geometry(object):
set_surface(i, surface.absorption_gpu, surface.reflection_diffuse_gpu, surface.reflection_specular_gpu)
+ material1_index_tex = module.get_texref('material1_index')
+ material2_index_tex = module.get_texref('material2_index')
+ surface1_index_tex = module.get_texref('surface1_index')
+ surface2_index_tex = module.get_texref('surface2_index')
+
+ material1_index_gpu = cuda.to_device(self.material1_index)
+ material2_index_gpu = cuda.to_device(self.material2_index)
+ surface1_index_gpu = cuda.to_device(self.surface1_index)
+ surface2_index_gpu = cuda.to_device(self.surface2_index)
+
+ material1_index_tex.set_address(material1_index_gpu, self.material1_index.nbytes)
+ material2_index_tex.set_address(material2_index_gpu, self.material2_index.nbytes)
+ surface1_index_tex.set_address(surface1_index_gpu, self.surface1_index.nbytes)
+ surface2_index_tex.set_address(surface2_index_gpu, self.surface2_index.nbytes)
+
+ material1_index_tex.set_format(cuda.array_format.SIGNED_INT32, 1)
+ material2_index_tex.set_format(cuda.array_format.SIGNED_INT32, 1)
+ surface1_index_tex.set_format(cuda.array_format.SIGNED_INT32, 1)
+ surface2_index_tex.set_format(cuda.array_format.SIGNED_INT32, 1)
+
vertices = np.empty(len(self.mesh.vertices), dtype=gpuarray.vec.float4)
vertices['x'] = self.mesh.vertices[:,0]
vertices['y'] = self.mesh.vertices[:,1]