# HG changeset patch # User John Tsiombikas # Date 1281326597 -3600 # Node ID 074a64b9d6bdefab1214534926ffbf74b71d6d79 # Parent 9e4a28063394e654e97b4c0f03df5e7ad5f4d681 foo diff -r 9e4a28063394 -r 074a64b9d6bd rt.cl --- a/rt.cl Mon Aug 09 04:18:21 2010 +0100 +++ b/rt.cl Mon Aug 09 05:03:17 2010 +0100 @@ -57,7 +57,7 @@ #define MIN_ENERGY 0.001 #define EPSILON 1e-6 -float4 trace(struct Ray ray, struct Scene *scn); +//float4 trace(struct Ray ray, struct Scene *scn); float4 shade(struct Ray ray, struct Scene *scn, const struct SurfPoint *sp); bool find_intersection(struct Ray ray, const struct Scene *scn, struct SurfPoint *sp); bool intersect(struct Ray ray, global const struct Face *face, struct SurfPoint *sp); @@ -90,10 +90,17 @@ struct Ray ray = primrays[idx]; transform_ray(&ray, xform, invtrans); - fb[idx] = trace(ray, &scn); + //fb[idx] = trace(ray, &scn); + + struct SurfPoint sp; + if(find_intersection(ray, &scn, &sp)) { + fb[idx] = shade(ray, &scn, &sp); + } else { + fb[idx] = (float4)(0, 0, 0, 0); + } } -float4 trace(struct Ray ray, struct Scene *scn) +/*float4 trace(struct Ray ray, struct Scene *scn) { float4 color; struct SurfPoint sp; @@ -104,7 +111,7 @@ color = (float4)(0, 0, 0, 0); } return color; -} +}*/ float4 shade(struct Ray ray, struct Scene *scn, const struct SurfPoint *sp) { @@ -140,7 +147,7 @@ } } - float4 refl_col = mat.ks * mat.kr; + /*float4 refl_col = mat.ks * mat.kr; float refl_coeff = (refl_col.x + refl_col.y + refl_col.z) / 3.0; if(refl_coeff > MIN_ENERGY) { @@ -150,7 +157,7 @@ refl_ray.energy *= refl_coeff; scol += trace(refl_ray, scn) * refl_col; - } + }*/ return dcol + scol; }