clray
diff rt.cl @ 22:6c44e4b1726d
OMG alignment is a bitch
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 11 Aug 2010 04:30:35 +0100 |
parents | bd6c2b25f6e7 |
children | 51f115e337c2 |
line diff
1.1 --- a/rt.cl Tue Aug 10 07:24:18 2010 +0100 1.2 +++ b/rt.cl Wed Aug 11 04:30:35 2010 +0100 1.3 @@ -1,10 +1,10 @@ 1.4 /* vim: set ft=opencl:ts=4:sw=4 */ 1.5 1.6 struct RendInfo { 1.7 + float4 ambient; 1.8 int xsz, ysz; 1.9 int num_faces, num_lights; 1.10 int max_iter; 1.11 - float4 ambient; 1.12 }; 1.13 1.14 struct Vertex { 1.15 @@ -88,7 +88,7 @@ 1.16 transform_ray(&ray, xform, invtrans); 1.17 1.18 float4 pixel = (float4)(0, 0, 0, 0); 1.19 - float4 energy = (float4)(1.0, 1.0, 1.0, 1.0); 1.20 + float4 energy = (float4)(1.0, 1.0, 1.0, 0.0); 1.21 int iter = 0; 1.22 1.23 while(iter++ < rinf->max_iter && mean(energy) > MIN_ENERGY) { 1.24 @@ -136,10 +136,10 @@ 1.25 float4 vref = reflect(vdir, norm); 1.26 1.27 float diff = fmax(dot(ldir, norm), 0.0f); 1.28 - dcol += sp->mat.kd * diff * scn->lights[i].color; 1.29 + dcol += sp->mat.kd * scn->lights[i].color * diff; 1.30 1.31 float spec = powr(fmax(dot(ldir, vref), 0.0f), sp->mat.spow); 1.32 - scol += sp->mat.ks * spec * scn->lights[i].color; 1.33 + scol += sp->mat.ks * scn->lights[i].color * spec; 1.34 } 1.35 } 1.36