--- ray/src/rt/m_brdf.c 1993/05/27 15:28:01 2.6 +++ ray/src/rt/m_brdf.c 1994/01/12 16:46:35 2.10 @@ -21,7 +21,8 @@ static char SCCSid[] = "$SunId$ LBL"; * String arguments include the reflection function and files. * The BRDF is currently used just for the specular component to light * sources. Reflectance values or data coordinates are functions - * of the direction to the light source. + * of the direction to the light source. (Data modification functions + * are passed the source direction as args 2-4.) * We orient the surface towards the incoming ray, so a single * surface can be used to represent an infinitely thin object. * @@ -88,6 +89,7 @@ double omega; /* light source size */ COLOR ctmp; FVECT ldx; double lddx[3], pt[MAXDIM]; + double vldx[4]; register char **sa; register int i; @@ -153,8 +155,9 @@ double omega; /* light source size */ } else { for (i = 0; i < np->dp->nd; i++) pt[i] = funvalue(sa[3+i], 3, lddx); - dtmp = datavalue(np->dp, pt); - dtmp = funvalue(sa[0], 1, &dtmp); + vldx[0] = datavalue(np->dp, pt); + vldx[1] = lddx[0]; vldx[2] = lddx[1]; vldx[3] = lddx[2]; + dtmp = funvalue(sa[0], 4, vldx); setcolor(ctmp, dtmp, dtmp, dtmp); } if (errno) { @@ -194,7 +197,6 @@ register RAY *r; double transtest, transdist; int hasrefl, hastrans; COLOR ctmp; - double dtmp; register MFUNC *mf; register int i; /* check arguments */ @@ -239,6 +241,7 @@ register RAY *r; /* compute transmitted ray */ setbrdfunc(&nd); transtest = 0; + transdist = r->rot; errno = 0; setcolor(ctmp, evalue(mf->ep[3]), evalue(mf->ep[4]), @@ -265,7 +268,7 @@ register RAY *r; transdist = r->rot + sr.rt; } if (r->crtype & SHADOW) /* the rest is shadow */ - return; + return(1); /* compute reflected ray */ setbrdfunc(&nd); errno = 0; @@ -305,6 +308,8 @@ register RAY *r; /* check distance */ if (transtest > bright(r->rcol)) r->rt = transdist; + + return(1); } @@ -318,7 +323,7 @@ register RAY *r; double dtmp; /* always a shadow */ if (r->crtype & SHADOW) - return; + return(1); /* check arguments */ if (m->oargs.nsargs < (hasdata(m->otype)?4:2) | m->oargs.nfargs < (m->otype==MAT_TFUNC|m->otype==MAT_TDATA?6:4)) @@ -378,6 +383,8 @@ register RAY *r; } /* add direct component */ direct(r, dirbrdf, &nd); + + return(1); }