128 |
|
r->gecc = 0.; |
129 |
|
} |
130 |
|
} |
131 |
< |
mabsorp = exp(-bright(r->cext)*r->rot); /* approximate */ |
131 |
> |
/* estimate absorption */ |
132 |
> |
mabsorp = colval(r->cext,RED) < colval(r->cext,GRN) ? |
133 |
> |
colval(r->cext,RED) : colval(r->cext,GRN); |
134 |
> |
if (colval(r->cext,BLU) < mabsorp) mabsorp = colval(r->cext,BLU); |
135 |
> |
if (mabsorp > 0.) |
136 |
> |
mabsorp = exp(-mabsorp*r->rot); /* conservative */ |
137 |
> |
else |
138 |
> |
mabsorp = 1.0; |
139 |
|
|
140 |
|
d2 = 1.0 - nratio*nratio*(1.0 - cos1*cos1); /* compute cos theta2 */ |
141 |
|
|
172 |
|
|| r->crtype & SHADOW |
173 |
|
|| !directvis |
174 |
|
|| m->oargs.farg[4] == 0.0 |
175 |
< |
|| !disperse(m, r, p.rdir, trans)) |
175 |
> |
|| !disperse(m, r, p.rdir, |
176 |
> |
trans, ctrans, talb)) |
177 |
|
#endif |
178 |
|
{ |
179 |
|
copycolor(p.cext, ctrans); |
207 |
|
#ifdef DISPERSE |
208 |
|
|
209 |
|
static |
210 |
< |
disperse(m, r, vt, tr) /* check light sources for dispersion */ |
210 |
> |
disperse(m, r, vt, tr, cet, abt) /* check light sources for dispersion */ |
211 |
|
OBJREC *m; |
212 |
|
RAY *r; |
213 |
|
FVECT vt; |
214 |
|
double tr; |
215 |
+ |
COLOR cet, abt; |
216 |
|
{ |
217 |
|
RAY sray, *entray; |
218 |
|
FVECT v1, v2, n1, n2; |
298 |
|
if (l1 > MAXLAMBDA || l1 < MINLAMBDA) /* not visible */ |
299 |
|
continue; |
300 |
|
/* trace source ray */ |
301 |
+ |
copycolor(sray.cext, cet); |
302 |
+ |
copycolor(sray.albedo, abt); |
303 |
|
normalize(sray.rdir); |
304 |
|
rayvalue(&sray); |
305 |
|
if (bright(sray.rcol) <= FTINY) /* missed it */ |