clray
diff rt.cl @ 15:754faf15ba36
burp
author | John Tsiombikas |
---|---|
date | Sun, 08 Aug 2010 09:51:45 +0100 |
parents | 85fd61f374d9 |
children | 9e4a28063394 |
line diff
1.1 --- a/rt.cl Sat Aug 07 03:36:36 2010 +0100 1.2 +++ b/rt.cl Sun Aug 08 09:51:45 2010 +0100 1.3 @@ -4,6 +4,7 @@ 1.4 int xsz, ysz; 1.5 int num_faces, num_lights; 1.6 int max_iter; 1.7 + int dbg; 1.8 }; 1.9 1.10 struct Vertex { 1.11 @@ -59,17 +60,26 @@ 1.12 global const struct Light *lights, 1.13 global const struct Ray *primrays, 1.14 global const float *xform, 1.15 - global const float *invtrans) 1.16 + global const float *invtrans, 1.17 + global struct Face *outfaces) 1.18 { 1.19 int idx = get_global_id(0); 1.20 + 1.21 + if(idx == 0) { 1.22 + for(int i=0; i<rinf->num_faces; i++) { 1.23 + outfaces[i] = faces[i]; 1.24 + } 1.25 + } 1.26 1.27 struct Ray ray = transform_ray(primrays + idx, xform, invtrans); 1.28 1.29 struct SurfPoint sp, sp0; 1.30 sp0.t = FLT_MAX; 1.31 sp0.obj = 0; 1.32 + 1.33 + int max_faces = min(rinf->num_faces, rinf->dbg); 1.34 1.35 - for(int i=0; i<rinf->num_faces; i++) { 1.36 + for(int i=0; i<max_faces; i++) { 1.37 if(intersect(ray, faces + i, &sp) && sp.t < sp0.t) { 1.38 sp0 = sp; 1.39 } 1.40 @@ -94,7 +104,7 @@ 1.41 entering = false; 1.42 } 1.43 1.44 - float4 dcol = (float4)(0, 0, 0, 0); 1.45 + float4 dcol = (float4)(0.07, 0.07, 0.07, 0); 1.46 float4 scol = (float4)(0, 0, 0, 0); 1.47 1.48 for(int i=0; i<num_lights; i++) {