57 |
|
double cos1, cos2, nratio; |
58 |
|
COLOR mcolor; |
59 |
|
double mabsorp; |
60 |
< |
double refl, trans; |
60 |
> |
double refl, trans, transbright; |
61 |
|
FVECT dnorm; |
62 |
|
double d1, d2; |
63 |
|
RAY p; |
92 |
|
else |
93 |
|
setcolor(mcolor, 1.0, 1.0, 1.0); |
94 |
|
} |
95 |
< |
mabsorp = intens(mcolor); |
95 |
> |
mabsorp = bright(mcolor); |
96 |
|
|
97 |
|
d2 = 1.0 - nratio*nratio*(1.0 - cos1*cos1); /* compute cos theta2 */ |
98 |
|
|
115 |
|
|
116 |
|
refl /= 2.0; |
117 |
|
trans = 1.0 - refl; |
118 |
+ |
transbright = -FTINY; |
119 |
|
|
120 |
|
if (rayorigin(&p, r, REFRACTED, mabsorp*trans) == 0) { |
121 |
|
|
136 |
|
multcolor(mcolor, r->pcol); /* modify */ |
137 |
|
scalecolor(p.rcol, trans); |
138 |
|
addcolor(r->rcol, p.rcol); |
139 |
+ |
transbright = bright(p.rcol); |
140 |
+ |
r->rt = r->rot + p.rt; |
141 |
|
} |
142 |
|
} |
143 |
|
} |
153 |
|
|
154 |
|
scalecolor(p.rcol, refl); /* color contribution */ |
155 |
|
addcolor(r->rcol, p.rcol); |
156 |
+ |
if (bright(p.rcol) > transbright) |
157 |
+ |
r->rt = r->rot + p.rt; |
158 |
|
} |
159 |
|
|
160 |
|
multcolor(r->rcol, mcolor); /* multiply by transmittance */ |
258 |
|
/* trace source ray */ |
259 |
|
normalize(sray.rdir); |
260 |
|
rayvalue(&sray); |
261 |
< |
if (intens(sray.rcol) <= FTINY) /* missed it */ |
261 |
> |
if (bright(sray.rcol) <= FTINY) /* missed it */ |
262 |
|
continue; |
263 |
|
|
264 |
|
/* |