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-cam.diderot
ViewVC logotype

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

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

revision 774, Thu Apr 7 21:08:46 2011 UTC revision 775, Thu Apr 7 21:48:11 2011 UTC
# Line 13  Line 13 
13  //real camNear = -5.0;  //real camNear = -5.0;
14  //real camFar = 5.0;  //real camFar = 5.0;
15  //real camFOV = 18.0;  //real camFOV = 18.0;
16  //int imgResU = 320;  //int imgResU = 480;
17  //int imgResV = 240;  //int imgResV = 345;
18  //real rayStep = 0.1;  //real rayStep = 0.1;
19  //real valOpacMin = 0.20;          // highest value with opacity 0.0  //real valOpacMin = 0.20;          // highest value with opacity 0.0
20  //real valOpacMax = 0.25;          // lowest value with opacity 1.0  //real valOpacMax = 0.25;          // lowest value with opacity 1.0
# Line 41  Line 41 
41  real camDist = |camAt - camEye|;  real camDist = |camAt - camEye|;
42  real camVspNear = camDist + camNear;  real camVspNear = camDist + camNear;
43  real camVspFar = camDist + camFar;  real camVspFar = camDist + camFar;
44  vec3 camN = (camAt - camEye)/camDist;  vec3 camN = normalize(camAt - camEye);
45  vec3 camU = normalize(camN × camUp);  vec3 camU = normalize(camN × camUp);
46  vec3 camV = camN × camU;  vec3 camV = camN × camU;
47  real camVmax = tan(camFOV*3.1415926536/360.0)*camDist;  real camVmax = tan(camFOV*3.1415926536/360.0)*camDist;
48  real camUmax = camVmax*real(imgResU)/real(imgResV);  real camUmax = camVmax*real(imgResU)/real(imgResV);
49    
50    // HEY (BUG): these:
51    //   vec3 lightVspDir = [1.0, -0.0, 0.0];
52    //   vec3 lightVspDir = [1.0, 0.0, -0.0];
53    // work okay but this:
54    //   vec3 lightVspDir = [1.0, 0.0, 0.0];
55    // does not:
56    // uncaught exception Fail [Fail: E_Slice]
57    //   raised at simplify/eval.sml:266.57
58    //   raised at simplify/eval.sml:183.33-183.47
59  vec3 lightVspDir = [0.9, -1.0, -2.5];  vec3 lightVspDir = [0.9, -1.0, -2.5];
60  vec3 lightDir = normalize(lightVspDir[0]*camU + lightVspDir[1]*camV + lightVspDir[2]*camN);  vec3 lightDir = normalize(lightVspDir[0]*camU + lightVspDir[1]*camV + lightVspDir[2]*camN);
61    
# Line 85  Line 94 
94            vec3 norm = normalize(-∇F@rayPos);            vec3 norm = normalize(-∇F@rayPos);
95            if (val > valOpacMin) {  // we have some opacity            if (val > valOpacMin) {  // we have some opacity
96                real opac = min(1.0, lerp(0.0, 1.0, valOpacMin, val, valOpacMax));                real opac = min(1.0, lerp(0.0, 1.0, valOpacMin, val, valOpacMax));
97                real ld = lightDir • norm;                real ld = norm • lightDir;
98                  real hd = norm • normalize(lightDir + normalize(camEye - rayPos));
99                real mat = (  phongKa                real mat = (  phongKa
100                            + phongKd*(ld if ld > 0.0 else 0.0)                            + phongKd*(ld if ld > 0.0 else 0.0)
101                            + phongKs*(pow(ld, phongSp) if ld > 0.0 else 0.0));                            + phongKs*(pow(hd, phongSp) if hd > 0.0 else 0.0));
102                gray = gray + transp*opac*mat;                gray = gray + transp*opac*mat;
103                transp = transp*(1.0 - opac);                transp = transp*(1.0 - opac);
104            }            }

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

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