1 |
< |
/* Copyright (c) 1990 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1991 Regents of the University of California */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
132 |
|
/* compute BRTDF */ |
133 |
|
if (np->mp->otype == MAT_BRTDF) { |
134 |
|
colval(ctmp,RED) = funvalue(sa[6], 3, ldx); |
135 |
< |
if (sa[7] == sa[6]) |
135 |
> |
if (!strcmp(sa[7],sa[6])) |
136 |
|
colval(ctmp,GRN) = colval(ctmp,RED); |
137 |
|
else |
138 |
|
colval(ctmp,GRN) = funvalue(sa[7], 3, ldx); |
139 |
< |
if (sa[8] == sa[6]) |
139 |
> |
if (!strcmp(sa[8],sa[6])) |
140 |
|
colval(ctmp,BLU) = colval(ctmp,RED); |
141 |
< |
else if (sa[8] == sa[7]) |
141 |
> |
else if (!strcmp(sa[8],sa[7])) |
142 |
|
colval(ctmp,BLU) = colval(ctmp,GRN); |
143 |
|
else |
144 |
|
colval(ctmp,BLU) = funvalue(sa[8], 3, ldx); |
189 |
|
{ |
190 |
|
int minsa, minfa; |
191 |
|
BRDFDAT nd; |
192 |
+ |
double transtest, transdist; |
193 |
|
COLOR ctmp; |
194 |
|
double dtmp; |
195 |
|
FVECT vec; |
238 |
|
nd.pdot = raynormal(nd.pnorm, r); /* perturb normal */ |
239 |
|
multcolor(nd.mcolor, r->pcol); /* modify material color */ |
240 |
|
r->rt = r->rot; /* default ray length */ |
241 |
+ |
transtest = 0; |
242 |
|
/* load auxiliary files */ |
243 |
|
if (m->otype == MAT_PDATA || m->otype == MAT_MDATA |
244 |
|
|| m->otype == MAT_TDATA) { |
281 |
|
objerror(m, WARNING, "compute error"); |
282 |
|
else if ((dtmp = bright(ctmp)) > FTINY && |
283 |
|
rayorigin(&sr, r, TRANS, dtmp) == 0) { |
284 |
< |
VCOPY(sr.rdir, r->rdir); |
284 |
> |
if (DOT(r->pert,r->pert) > FTINY*FTINY) { |
285 |
> |
for (i = 0; i < 3; i++) /* perturb direction */ |
286 |
> |
sr.rdir[i] = r->rdir[i] - |
287 |
> |
.75*r->pert[i]; |
288 |
> |
normalize(sr.rdir); |
289 |
> |
} else |
290 |
> |
transtest = 2; |
291 |
|
rayvalue(&sr); |
292 |
|
multcolor(sr.rcol, ctmp); |
293 |
|
addcolor(r->rcol, sr.rcol); |
294 |
< |
if (dtmp > .5) |
295 |
< |
r->rt = r->rot + sr.rt; |
294 |
> |
transtest *= bright(sr.rcol); |
295 |
> |
transdist = r->rot + sr.rt; |
296 |
|
} |
297 |
|
} |
298 |
|
if (r->crtype & SHADOW) /* the rest is shadow */ |
340 |
|
} |
341 |
|
/* add direct component */ |
342 |
|
direct(r, dirbrdf, &nd); |
343 |
+ |
/* check distance */ |
344 |
+ |
if (transtest > bright(r->rcol)) |
345 |
+ |
r->rt = transdist; |
346 |
|
} |