21 |
|
* String arguments include the reflection function and files. |
22 |
|
* The BRDF is currently used just for the specular component to light |
23 |
|
* sources. Reflectance values or data coordinates are functions |
24 |
< |
* of the direction to the light source. |
24 |
> |
* of the direction to the light source. (Data modification functions |
25 |
> |
* are passed the source direction as args 2-4.) |
26 |
|
* We orient the surface towards the incoming ray, so a single |
27 |
|
* surface can be used to represent an infinitely thin object. |
28 |
|
* |
89 |
|
COLOR ctmp; |
90 |
|
FVECT ldx; |
91 |
|
double lddx[3], pt[MAXDIM]; |
92 |
+ |
double vldx[4]; |
93 |
|
register char **sa; |
94 |
|
register int i; |
95 |
|
|
155 |
|
} else { |
156 |
|
for (i = 0; i < np->dp->nd; i++) |
157 |
|
pt[i] = funvalue(sa[3+i], 3, lddx); |
158 |
< |
dtmp = datavalue(np->dp, pt); |
159 |
< |
dtmp = funvalue(sa[0], 1, &dtmp); |
158 |
> |
vldx[0] = datavalue(np->dp, pt); |
159 |
> |
vldx[1] = lddx[0]; vldx[2] = lddx[1]; vldx[3] = lddx[2]; |
160 |
> |
dtmp = funvalue(sa[0], 4, vldx); |
161 |
|
setcolor(ctmp, dtmp, dtmp, dtmp); |
162 |
|
} |
163 |
|
if (errno) { |
197 |
|
double transtest, transdist; |
198 |
|
int hasrefl, hastrans; |
199 |
|
COLOR ctmp; |
197 |
– |
double dtmp; |
200 |
|
register MFUNC *mf; |
201 |
|
register int i; |
202 |
|
/* check arguments */ |
241 |
|
/* compute transmitted ray */ |
242 |
|
setbrdfunc(&nd); |
243 |
|
transtest = 0; |
244 |
+ |
transdist = r->rot; |
245 |
|
errno = 0; |
246 |
|
setcolor(ctmp, evalue(mf->ep[3]), |
247 |
|
evalue(mf->ep[4]), |
268 |
|
transdist = r->rot + sr.rt; |
269 |
|
} |
270 |
|
if (r->crtype & SHADOW) /* the rest is shadow */ |
271 |
< |
return; |
271 |
> |
return(1); |
272 |
|
/* compute reflected ray */ |
273 |
|
setbrdfunc(&nd); |
274 |
|
errno = 0; |
308 |
|
/* check distance */ |
309 |
|
if (transtest > bright(r->rcol)) |
310 |
|
r->rt = transdist; |
311 |
+ |
|
312 |
+ |
return(1); |
313 |
|
} |
314 |
|
|
315 |
|
|
323 |
|
double dtmp; |
324 |
|
/* always a shadow */ |
325 |
|
if (r->crtype & SHADOW) |
326 |
< |
return; |
326 |
> |
return(1); |
327 |
|
/* check arguments */ |
328 |
|
if (m->oargs.nsargs < (hasdata(m->otype)?4:2) | m->oargs.nfargs < |
329 |
|
(m->otype==MAT_TFUNC|m->otype==MAT_TDATA?6:4)) |
383 |
|
} |
384 |
|
/* add direct component */ |
385 |
|
direct(r, dirbrdf, &nd); |
386 |
+ |
|
387 |
+ |
return(1); |
388 |
|
} |
389 |
|
|
390 |
|
|