diff options
author | Stan Seibert <stan@mtrr.org> | 2011-06-22 15:14:04 -0400 |
---|---|---|
committer | Stan Seibert <stan@mtrr.org> | 2011-06-22 15:14:04 -0400 |
commit | 484d4d574c57f14ca66c8e1c141b58915a1798ae (patch) | |
tree | 03b98353857d4e9bfd4af81aa79be9079ef2c1e6 /src | |
parent | 9813441eca580e6566d059e78eae5c2d0251e144 (diff) | |
download | chroma-484d4d574c57f14ca66c8e1c141b58915a1798ae.tar.gz chroma-484d4d574c57f14ca66c8e1c141b58915a1798ae.tar.bz2 chroma-484d4d574c57f14ca66c8e1c141b58915a1798ae.zip |
Switch from float4 to float3 for vertices.
Diffstat (limited to 'src')
-rw-r--r-- | src/kernel.cu | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/kernel.cu b/src/kernel.cu index 98d3ca7..584c9e4 100644 --- a/src/kernel.cu +++ b/src/kernel.cu @@ -22,7 +22,7 @@ enum }; /* flattened triangle mesh */ -__device__ float4 *vertices; +__device__ float3 *vertices; __device__ uint4 *triangles; /* lower/upper bounds for the bounding box associated with each node/leaf */ @@ -110,9 +110,9 @@ __device__ int intersect_mesh(const float3 &origin, const float3& direction, con uint4 triangle_data = triangles[index+i]; - float3 v0 = make_float3(vertices[triangle_data.x]); - float3 v1 = make_float3(vertices[triangle_data.y]); - float3 v2 = make_float3(vertices[triangle_data.z]); + float3 v0 = vertices[triangle_data.x]; + float3 v1 = vertices[triangle_data.y]; + float3 v2 = vertices[triangle_data.z]; if (intersect_triangle(origin, direction, v0, v1, v2, distance)) { @@ -146,7 +146,7 @@ __device__ curandState rng_states[100000]; extern "C" { - __global__ void set_pointer(uint4 *triangle_ptr, float4 *vertex_ptr) + __global__ void set_pointer(uint4 *triangle_ptr, float3 *vertex_ptr) { triangles = triangle_ptr; vertices = vertex_ptr; @@ -214,9 +214,9 @@ __global__ void ray_trace(int nthreads, float3 *positions, float3 *directions, i { uint4 triangle_data = triangles[triangle_index]; - float3 v0 = make_float3(vertices[triangle_data.x]); - float3 v1 = make_float3(vertices[triangle_data.y]); - float3 v2 = make_float3(vertices[triangle_data.z]); + float3 v0 = vertices[triangle_data.x]; + float3 v1 = vertices[triangle_data.y]; + float3 v2 = vertices[triangle_data.z]; pixels[id] = get_color(direction, v0, v1, v2, triangle_data.w); } @@ -263,9 +263,9 @@ __global__ void propagate(int nthreads, float3 *positions, float3 *directions, f uint4 triangle_data = triangles[last_hit_triangle]; - float3 v0 = make_float3(vertices[triangle_data.x]); - float3 v1 = make_float3(vertices[triangle_data.y]); - float3 v2 = make_float3(vertices[triangle_data.z]); + float3 v0 = vertices[triangle_data.x]; + float3 v1 = vertices[triangle_data.y]; + float3 v2 = vertices[triangle_data.z]; int material_in_index = convert(0xFF & (triangle_data.w >> 24)); int material_out_index = convert(0xFF & (triangle_data.w >> 16)); |