diff options
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 |