summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesh.h16
1 files changed, 7 insertions, 9 deletions
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