Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/pure-cfg/test/vr-phong.diderot
ViewVC logotype

Diff of /branches/pure-cfg/test/vr-phong.diderot

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 775, Thu Apr 7 21:48:11 2011 UTC revision 776, Thu Apr 7 21:50:30 2011 UTC
# Line 27  Line 27 
27  strand RayCast (int row, int col)  strand RayCast (int row, int col)
28  {  {
29      vec3        pos = orig + real(row)*rVec + real(col)*cVec;      vec3        pos = orig + real(row)*rVec + real(col)*cVec;
30      vec3        dir = (pos - eye)/|pos - eye|;      vec3        dir = normalize(pos - eye);
31      real        t = 0.0;      real        t = 0.0;
32      output vec3 rayRGB = [0.0, 0.0, 0.0];      output vec3 rayRGB = [0.0, 0.0, 0.0];
33      real        rayTransp = 1.0;      real        rayTransp = 1.0;
# Line 36  Line 36 
36      {      {
37          if (inside (pos,F)) {          if (inside (pos,F)) {
38             real val = F@pos;             real val = F@pos;
39             vec3 grad = ∇F@pos;             vec3 norm = normalize(-∇F@pos);
40             vec3 norm = grad/|grad|;             vec3 halfDir = normalize(lightDir - dir);
            vec3 halfDir = (lightDir - dir)/|lightDir - dir|;  
41             vec4 matRGBA = txf@val;             vec4 matRGBA = txf@val;
42             vec3 matRGB = [matRGBA[0],matRGBA[1],matRGBA[2]];             vec3 matRGB = [matRGBA[0],matRGBA[1],matRGBA[2]];
43             real ldotn = dot(lightDir, norm);             real ldotn = lightDir • norm;
44             real hdotn = dot(halfDir, norm);             real hdotn = halfDir • norm;
45             vec3 pntRGB = (ka + kd*ldotn)*modulate(matRGB,lightRGB) + ks*pow(hdotn,sh)*lightRGB;             vec3 pntRGB = (ka + kd*ldotn)*modulate(matRGB,lightRGB) + ks*pow(hdotn,sh)*lightRGB;
46             rayRGB = rayRGB + rayTransp*matRGBA[3]*pntRGB;             rayRGB = rayRGB + rayTransp*matRGBA[3]*pntRGB;
47             rayTransp = rayTransp*(1.0 - matRGBA[3]);             rayTransp = rayTransp*(1.0 - matRGBA[3]);

Legend:
Removed from v.775  
changed lines
  Added in v.776

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0