49 |
|
FVECT pnorm; |
50 |
|
double cos2; |
51 |
|
COLOR trans, refl; |
52 |
+ |
double transbright; |
53 |
|
double d, r1; |
54 |
|
RAY p; |
55 |
|
register int i; |
80 |
|
d = colval(mcolor, i); |
81 |
|
colval(trans,i) = (1.0-r1)*(1.0-r1)*d / (1.0 - r1*r1*d*d); |
82 |
|
} |
83 |
+ |
transbright = -FTINY; |
84 |
|
/* transmitted ray */ |
85 |
|
if (rayorigin(&p, r, TRANS, bright(trans)) == 0) { |
86 |
|
VCOPY(p.rdir, r->rdir); |
88 |
|
multcolor(p.rcol, r->pcol); /* modify */ |
89 |
|
multcolor(p.rcol, trans); |
90 |
|
addcolor(r->rcol, p.rcol); |
91 |
+ |
transbright = bright(p.rcol); |
92 |
+ |
r->rt = r->rot + p.rt; |
93 |
|
} |
94 |
+ |
|
95 |
|
if (r->crtype & SHADOW) /* skip reflected ray */ |
96 |
|
return; |
97 |
|
/* compute reflectance */ |
107 |
|
rayvalue(&p); |
108 |
|
multcolor(p.rcol, refl); |
109 |
|
addcolor(r->rcol, p.rcol); |
110 |
+ |
if (bright(p.rcol) > transbright) |
111 |
+ |
r->rt = r->rot + p.rt; |
112 |
|
} |
113 |
|
} |