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 770, Thu Apr 7 20:42:13 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 = (pos - eye)/|pos - eye|;
# 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 grad = ∇F@pos;
40              vec3 norm = -grad/|grad|;              vec3 norm = -grad/|grad|;
41              if (val > valOpacMin) {  // we have some opacity              if (val > valOpacMin) {  // we have some opacity
42                  real opac = 0.0;     // dummy initialization                  real opac = min(1.0, lerp(0.0, 1.0, valOpacMin, val, valOpacMax));
43                  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));  
44                  transp = transp*(1.0 - opac);                  transp = transp*(1.0 - opac);
45              }              }
46          }          }
47          if (transp < 0.01) {  // early ray termination          if (transp < 0.01) {  // early ray termination
48                rgba = [gray, gray, gray, 1.0-transp]; /* FIXME */
49              transp = 0.0;              transp = 0.0;
50              stabilize;              stabilize;
51          }          }
52          if (t > 40.0) {          if (t > 40.0) {
53                rgba = [gray, gray, gray, 1.0-transp]; /* FIXME */
54              stabilize;              stabilize;
55          }          }
56          t = t + stepSz;          t = t + stepSz;
57      }      }
58    
59       stabilize {       stabilize {
60          rgba = [gray, gray, gray, 1.0-transp];  //        rgba = [gray, gray, gray, 1.0-transp];
61       }       }
62    
63      /* render: output rgba */      /* render: output rgba */

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

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