From 2b557d1cb46fcd12271bedcc97969b51a46b65ee Mon Sep 17 00:00:00 2001 From: Anthony LaTorre Date: Sat, 10 Sep 2011 15:39:12 -0400 Subject: update 3d mode to work properly when rendering multiple geometries. --- src/mesh.h | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mesh.h b/src/mesh.h index 0afe1c9..c6ef8f6 100644 --- a/src/mesh.h +++ b/src/mesh.h @@ -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 -- cgit