SCM Repository
[diderot] Diff of /trunk/test/vr.diderot
Diff of /trunk/test/vr.diderot
Parent Directory
|
Revision Log
|
Patch
5 |
|
|
6 |
input string dataFile; // name of dataset |
input string dataFile; // name of dataset |
7 |
input real stepSz; // size of steps |
input real stepSz; // size of steps |
8 |
|
input vec<3> light; |
9 |
|
input int wid = 640; |
10 |
|
input int ht = 480; |
11 |
|
|
12 |
image<3> img = load (dataFile); |
image[3] img = load (dataFile); |
13 |
|
|
14 |
|
field#1[3] F = convolve (bspln3, img); |
15 |
|
|
16 |
actor RayCast (int row, int col) |
actor RayCast (int row, int col) |
17 |
{ |
{ |
18 |
vec<3> dir = (real(row), real(col)); |
vec<3> dir = (real(row), real(col), 0.0); |
19 |
vec<3> pos = (0.0, 0.0); |
vec<3> pos = (0.0, 0.0, 0.0); |
20 |
vec<3> t = 0.0; |
real t = 0.0; |
21 |
|
real[4] color = (0.0, 0.0, 0.0, 0.0); |
22 |
|
|
23 |
update |
update |
24 |
{ |
{ |
25 |
pos = pos + t*dir; |
vec<3> pt = pos + t*dir; |
26 |
|
t = t + stepSz; |
27 |
|
vec<3> g = (D F)@pt; |
28 |
|
color = over(color, phong(light, g, txf(F@pt))); |
29 |
|
if (color[3] >= 0.999) |
30 |
|
stabilize; |
31 |
} |
} |
32 |
|
|
33 |
} |
} |
|
Legend:
Removed from v.38 |
|
changed lines |
|
Added in v.39 |
|
|