1 |
< |
/* Copyright (c) 1996 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 |
|
/* |
54 |
|
int rt; |
55 |
|
double rw; |
56 |
|
{ |
57 |
+ |
double re; |
58 |
+ |
|
59 |
|
if ((r->parent = ro) == NULL) { /* primary ray */ |
60 |
|
r->rlvl = 0; |
61 |
|
r->rweight = rw; |
84 |
|
copycolor(r->albedo, ro->albedo); |
85 |
|
r->gecc = ro->gecc; |
86 |
|
r->slights = ro->slights; |
85 |
– |
r->rweight = ro->rweight * rw; |
87 |
|
r->crtype = ro->crtype | (r->rtype = rt); |
88 |
|
VCOPY(r->rorg, ro->rop); |
89 |
+ |
r->rweight = ro->rweight * rw; |
90 |
+ |
/* estimate absorption */ |
91 |
+ |
re = colval(ro->cext,RED) < colval(ro->cext,GRN) ? |
92 |
+ |
colval(ro->cext,RED) : colval(ro->cext,GRN); |
93 |
+ |
if (colval(ro->cext,BLU) < re) re = colval(ro->cext,BLU); |
94 |
+ |
if (re > 0.) |
95 |
+ |
r->rweight *= exp(-re*ro->rot); |
96 |
|
} |
97 |
|
rayclear(r); |
98 |
|
return(r->rlvl <= maxdepth && r->rweight >= minweight ? 0 : -1); |
104 |
|
{ |
105 |
|
r->rno = raynum++; |
106 |
|
r->newcset = r->clipset; |
107 |
+ |
r->robj = OVOID; |
108 |
|
r->ro = NULL; |
109 |
< |
r->rot = FHUGE; |
109 |
> |
r->rt = r->rot = FHUGE; |
110 |
|
r->pert[0] = r->pert[1] = r->pert[2] = 0.0; |
111 |
|
setcolor(r->pcol, 1.0, 1.0, 1.0); |
112 |
|
setcolor(r->rcol, 0.0, 0.0, 0.0); |
104 |
– |
r->rt = 0.0; |
113 |
|
} |
114 |
|
|
115 |
|
|
197 |
|
register RAY *r; |
198 |
|
{ |
199 |
|
COLOR ce, ca; |
192 |
– |
double dist; |
200 |
|
double re, ge, be; |
201 |
|
|
202 |
|
if (intens(r->cext) <= 1./FHUGE) |
203 |
|
return; /* no medium */ |
204 |
< |
if ((dist = r->rot) >= FHUGE) |
205 |
< |
dist = 2.*thescene.cusize; /* what to use for infinity? */ |
206 |
< |
re = dist*colval(r->cext,RED); |
200 |
< |
ge = dist*colval(r->cext,GRN); |
201 |
< |
be = dist*colval(r->cext,BLU); |
204 |
> |
re = r->rot*colval(r->cext,RED); |
205 |
> |
ge = r->rot*colval(r->cext,GRN); |
206 |
> |
be = r->rot*colval(r->cext,BLU); |
207 |
|
if (r->crtype & SHADOW) { /* no scattering for sources */ |
208 |
|
re *= 1. - colval(r->albedo,RED); |
209 |
|
ge *= 1. - colval(r->albedo,GRN); |
277 |
|
backmat = rayshade(&br, back); |
278 |
|
/* check for transparency */ |
279 |
|
if (backmat ^ foremat) |
280 |
< |
if (backmat) |
280 |
> |
if (backmat && coef > FTINY) |
281 |
|
raytrans(&fr); |
282 |
< |
else |
282 |
> |
else if (foremat && coef < 1.0-FTINY) |
283 |
|
raytrans(&br); |
284 |
|
/* mix perturbations */ |
285 |
|
for (i = 0; i < 3; i++) |
562 |
|
checkset(oset, cxs); /* eliminate double-checking */ |
563 |
|
for (i = oset[0]; i > 0; i--) { |
564 |
|
o = objptr(oset[i]); |
565 |
< |
(*ofun[o->otype].funp)(o, r); |
565 |
> |
if ((*ofun[o->otype].funp)(o, r)) |
566 |
> |
r->robj = oset[i]; |
567 |
|
} |
568 |
|
if (r->ro == NULL) |
569 |
|
return(0); /* no scores yet */ |