| 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; |
| 237 |
|
raytexture(r, m->omod); |
| 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 */ |
| 240 |
> |
transtest = 0; |
| 241 |
|
/* load auxiliary files */ |
| 242 |
|
if (m->otype == MAT_PDATA || m->otype == MAT_MDATA |
| 243 |
|
|| m->otype == MAT_TDATA) { |
| 280 |
|
objerror(m, WARNING, "compute error"); |
| 281 |
|
else if ((dtmp = bright(ctmp)) > FTINY && |
| 282 |
|
rayorigin(&sr, r, TRANS, dtmp) == 0) { |
| 283 |
< |
VCOPY(sr.rdir, r->rdir); |
| 283 |
> |
if (DOT(r->pert,r->pert) > FTINY*FTINY) { |
| 284 |
> |
for (i = 0; i < 3; i++) /* perturb direction */ |
| 285 |
> |
sr.rdir[i] = r->rdir[i] - |
| 286 |
> |
.75*r->pert[i]; |
| 287 |
> |
normalize(sr.rdir); |
| 288 |
> |
} else { |
| 289 |
> |
VCOPY(sr.rdir, r->rdir); |
| 290 |
> |
transtest = 2; |
| 291 |
> |
} |
| 292 |
|
rayvalue(&sr); |
| 293 |
|
multcolor(sr.rcol, ctmp); |
| 294 |
|
addcolor(r->rcol, sr.rcol); |
| 295 |
< |
if (dtmp > .5) |
| 296 |
< |
r->rt = r->rot + sr.rt; |
| 295 |
> |
transtest *= bright(sr.rcol); |
| 296 |
> |
transdist = r->rot + sr.rt; |
| 297 |
|
} |
| 298 |
|
} |
| 299 |
|
if (r->crtype & SHADOW) /* the rest is shadow */ |
| 341 |
|
} |
| 342 |
|
/* add direct component */ |
| 343 |
|
direct(r, dirbrdf, &nd); |
| 344 |
+ |
/* check distance */ |
| 345 |
+ |
if (transtest > bright(r->rcol)) |
| 346 |
+ |
r->rt = transdist; |
| 347 |
|
} |