49 |
|
FVECT pnorm; |
50 |
|
double cos2; |
51 |
|
COLOR trans, refl; |
52 |
– |
double transbright; |
52 |
|
double d, r1; |
53 |
|
RAY p; |
54 |
|
register int i; |
60 |
|
|
61 |
|
if (r->rod < 0.0) /* reorient if necessary */ |
62 |
|
flipsurface(r); |
63 |
+ |
r->rt = r->rot; /* default ray length */ |
64 |
|
/* get modifiers */ |
65 |
|
raytexture(r, m->omod); |
66 |
|
pdot = raynormal(pnorm, r); |
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; |
83 |
|
/* transmitted ray */ |
84 |
|
if (rayorigin(&p, r, TRANS, bright(trans)) == 0) { |
85 |
|
VCOPY(p.rdir, r->rdir); |
87 |
|
multcolor(p.rcol, r->pcol); /* modify */ |
88 |
|
multcolor(p.rcol, trans); |
89 |
|
addcolor(r->rcol, p.rcol); |
90 |
< |
transbright = bright(p.rcol); |
91 |
< |
r->rt = r->rot + p.rt; |
90 |
> |
if (bright(p.rcol) > .5) |
91 |
> |
r->rt = r->rot + p.rt; |
92 |
|
} |
93 |
|
|
94 |
|
if (r->crtype & SHADOW) /* skip reflected ray */ |
106 |
|
rayvalue(&p); |
107 |
|
multcolor(p.rcol, refl); |
108 |
|
addcolor(r->rcol, p.rcol); |
110 |
– |
if (bright(p.rcol) > transbright) |
111 |
– |
r->rt = r->rot + p.rt; |
109 |
|
} |
110 |
|
} |