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

SCM Repository

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

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

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

trunk/test/vr-lite.diderot revision 322, Wed Aug 18 04:33:04 2010 UTC branches/pure-cfg/test/vr-lite.diderot revision 780, Thu Apr 7 22:38:42 2011 UTC
# Line 22  Line 22 
22  //field#1(3)[] F = convolve (bspln3, img);  //field#1(3)[] F = convolve (bspln3, img);
23  field#2(3)[] F = img ⊛ bspln3;  field#2(3)[] F = img ⊛ bspln3;
24    
25  actor RayCast (int row, int col)  strand RayCast (int row, int col)
26  {  {
27      vec3 pos = orig + real(row)*rVec + real(col)*cVec;      vec3 pos = orig + real(row)*rVec + real(col)*cVec;
28      vec3 dir = (pos - eye)/|pos - eye|;      vec3 dir = normalize(pos - eye);
29      real t = 0.0;      real t = 0.0;
30      real transp = 1.0;      real transp = 1.0;
31      real gray = 0.0;      real gray = 0.0;
# Line 36  Line 36 
36          pos = pos + stepSz*dir;          pos = pos + stepSz*dir;
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);
             vec3 norm = -grad/|grad|;  
40              if (val > valOpacMin) {  // we have some opacity              if (val > valOpacMin) {  // we have some opacity
41                  real opac = 0.0;     // dummy initialization                  real opac = min(1.0, lerp(0.0, 1.0, valOpacMin, val, valOpacMax));
42                  if (val > valOpacMax) {                  gray = gray + transp*opac*max(0.0, -dir • norm);
                    opac = 1.0;  
                 } else {  
                    opac = (val - valOpacMin)/(valOpacMax - valOpacMin);  
                 }  
                 gray = gray + transp*opac*max(0.0, dot(-dir,norm));  
43                  transp = transp*(1.0 - opac);                  transp = transp*(1.0 - opac);
44              }              }
45          }          }
46          if (transp < 0.01) {  // early ray termination          if (transp < 0.01) {  // early ray termination
47              transp = 0.0;              transp = 0.0;
48                rgba = [gray, gray, gray, 1.0-transp]; /* FIXME */
49              stabilize;              stabilize;
50          }          }
51          if (t > 40.0) {          if (t > 40.0) {
52                rgba = [gray, gray, gray, 1.0-transp]; /* FIXME */
53              stabilize;              stabilize;
54          }          }
55          t = t + stepSz;          t = t + stepSz;
56      }      }
57    
58       stabilize {       stabilize {
59          rgba = [gray, gray, gray, 1.0-transp];  //        rgba = [gray, gray, gray, 1.0-transp];
60       }       }
61    
62      /* render: output rgba */      /* render: output rgba */

Legend:
Removed from v.322  
changed lines
  Added in v.780

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