summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnthony LaTorre <tlatorre9@gmail.com>2011-09-10 15:39:12 -0400
committerAnthony LaTorre <tlatorre9@gmail.com>2011-09-10 15:39:12 -0400
commit2b557d1cb46fcd12271bedcc97969b51a46b65ee (patch)
treef19d2d8f00b0af6ee4202ab37798783bb64e6bcb /src
parent254a0713a85c869e96425522df4ae182f3ab8e13 (diff)
downloadchroma-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.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