diff options
author | Anthony LaTorre <tlatorre9@gmail.com> | 2011-09-10 15:39:12 -0400 |
---|---|---|
committer | Anthony LaTorre <tlatorre9@gmail.com> | 2011-09-10 15:39:12 -0400 |
commit | 2b557d1cb46fcd12271bedcc97969b51a46b65ee (patch) | |
tree | f19d2d8f00b0af6ee4202ab37798783bb64e6bcb /src | |
parent | 254a0713a85c869e96425522df4ae182f3ab8e13 (diff) | |
download | chroma-2b557d1cb46fcd12271bedcc97969b51a46b65ee.tar.gz chroma-2b557d1cb46fcd12271bedcc97969b51a46b65ee.tar.bz2 chroma-2b557d1cb46fcd12271bedcc97969b51a46b65ee.zip |
update 3d mode to work properly when rendering multiple geometries.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh.h | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -123,26 +123,24 @@ extern "C" { __global__ void -distance_to_mesh(int nthreads, float3 *positions, float3 *directions, - Geometry *g, float *distances) +distance_to_mesh(int nthreads, float3 *_origin, float3 *_direction, + Geometry *g, float *_distance) { int id = blockIdx.x*blockDim.x + threadIdx.x; if (id >= nthreads) return; - float3 position = positions[id]; - float3 direction = directions[id]; + float3 origin = _origin[id]; + float3 direction = _direction[id]; direction /= norm(direction); float distance; - int triangle_index = intersect_mesh(position, direction, g, distance); + int triangle_index = intersect_mesh(origin, direction, g, distance); - if (triangle_index == -1) - distances[id] = 1e9; - else - distances[id] = distance; + if (triangle_index != -1) + _distance[id] = distance; } __global__ void |