clray
diff rt.cl @ 17:074a64b9d6bd
foo
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 09 Aug 2010 05:03:17 +0100 |
parents | 9e4a28063394 |
children | 4b1604f9798a |
line diff
1.1 --- a/rt.cl Mon Aug 09 04:18:21 2010 +0100 1.2 +++ b/rt.cl Mon Aug 09 05:03:17 2010 +0100 1.3 @@ -57,7 +57,7 @@ 1.4 #define MIN_ENERGY 0.001 1.5 #define EPSILON 1e-6 1.6 1.7 -float4 trace(struct Ray ray, struct Scene *scn); 1.8 +//float4 trace(struct Ray ray, struct Scene *scn); 1.9 float4 shade(struct Ray ray, struct Scene *scn, const struct SurfPoint *sp); 1.10 bool find_intersection(struct Ray ray, const struct Scene *scn, struct SurfPoint *sp); 1.11 bool intersect(struct Ray ray, global const struct Face *face, struct SurfPoint *sp); 1.12 @@ -90,10 +90,17 @@ 1.13 struct Ray ray = primrays[idx]; 1.14 transform_ray(&ray, xform, invtrans); 1.15 1.16 - fb[idx] = trace(ray, &scn); 1.17 + //fb[idx] = trace(ray, &scn); 1.18 + 1.19 + struct SurfPoint sp; 1.20 + if(find_intersection(ray, &scn, &sp)) { 1.21 + fb[idx] = shade(ray, &scn, &sp); 1.22 + } else { 1.23 + fb[idx] = (float4)(0, 0, 0, 0); 1.24 + } 1.25 } 1.26 1.27 -float4 trace(struct Ray ray, struct Scene *scn) 1.28 +/*float4 trace(struct Ray ray, struct Scene *scn) 1.29 { 1.30 float4 color; 1.31 struct SurfPoint sp; 1.32 @@ -104,7 +111,7 @@ 1.33 color = (float4)(0, 0, 0, 0); 1.34 } 1.35 return color; 1.36 -} 1.37 +}*/ 1.38 1.39 float4 shade(struct Ray ray, struct Scene *scn, const struct SurfPoint *sp) 1.40 { 1.41 @@ -140,7 +147,7 @@ 1.42 } 1.43 } 1.44 1.45 - float4 refl_col = mat.ks * mat.kr; 1.46 + /*float4 refl_col = mat.ks * mat.kr; 1.47 float refl_coeff = (refl_col.x + refl_col.y + refl_col.z) / 3.0; 1.48 1.49 if(refl_coeff > MIN_ENERGY) { 1.50 @@ -150,7 +157,7 @@ 1.51 refl_ray.energy *= refl_coeff; 1.52 1.53 scol += trace(refl_ray, scn) * refl_col; 1.54 - } 1.55 + }*/ 1.56 1.57 return dcol + scol; 1.58 }