1 |
< |
/* Copyright (c) 1986 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1998 Silicon Graphics, Inc. */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
4 |
> |
static char SCCSid[] = "$SunId$ SGI"; |
5 |
|
#endif |
6 |
|
|
7 |
|
/* |
73 |
|
double cos1, cos2, nratio; |
74 |
|
COLOR ctrans; |
75 |
|
COLOR talb; |
76 |
– |
double mabsorp; |
76 |
|
double refl, trans; |
77 |
|
FVECT dnorm; |
78 |
|
double d1, d2; |
127 |
|
r->gecc = 0.; |
128 |
|
} |
129 |
|
} |
131 |
– |
mabsorp = exp(-bright(r->cext)*r->rot); /* approximate */ |
130 |
|
|
131 |
|
d2 = 1.0 - nratio*nratio*(1.0 - cos1*cos1); /* compute cos theta2 */ |
132 |
|
|
150 |
|
refl *= 0.5; |
151 |
|
trans = 1.0 - refl; |
152 |
|
|
153 |
< |
if (rayorigin(&p, r, REFRACTED, mabsorp*trans) == 0) { |
153 |
> |
if (rayorigin(&p, r, REFRACTED, trans) == 0) { |
154 |
|
|
155 |
|
/* compute refracted ray */ |
156 |
|
d1 = nratio*cos1 - cos2; |
163 |
|
|| r->crtype & SHADOW |
164 |
|
|| !directvis |
165 |
|
|| m->oargs.farg[4] == 0.0 |
166 |
< |
|| !disperse(m, r, p.rdir, trans)) |
166 |
> |
|| !disperse(m, r, p.rdir, |
167 |
> |
trans, ctrans, talb)) |
168 |
|
#endif |
169 |
|
{ |
170 |
|
copycolor(p.cext, ctrans); |
179 |
|
} |
180 |
|
|
181 |
|
if (!(r->crtype & SHADOW) && |
182 |
< |
rayorigin(&p, r, REFLECTED, mabsorp*refl) == 0) { |
182 |
> |
rayorigin(&p, r, REFLECTED, refl) == 0) { |
183 |
|
|
184 |
|
/* compute reflected ray */ |
185 |
|
for (i = 0; i < 3; i++) |
198 |
|
#ifdef DISPERSE |
199 |
|
|
200 |
|
static |
201 |
< |
disperse(m, r, vt, tr) /* check light sources for dispersion */ |
201 |
> |
disperse(m, r, vt, tr, cet, abt) /* check light sources for dispersion */ |
202 |
|
OBJREC *m; |
203 |
|
RAY *r; |
204 |
|
FVECT vt; |
205 |
|
double tr; |
206 |
+ |
COLOR cet, abt; |
207 |
|
{ |
208 |
|
RAY sray, *entray; |
209 |
|
FVECT v1, v2, n1, n2; |
289 |
|
if (l1 > MAXLAMBDA || l1 < MINLAMBDA) /* not visible */ |
290 |
|
continue; |
291 |
|
/* trace source ray */ |
292 |
+ |
copycolor(sray.cext, cet); |
293 |
+ |
copycolor(sray.albedo, abt); |
294 |
|
normalize(sray.rdir); |
295 |
|
rayvalue(&sray); |
296 |
|
if (bright(sray.rcol) <= FTINY) /* missed it */ |