--- ray/src/rt/m_brdf.c 2003/03/03 00:10:51 2.17 +++ ray/src/rt/m_brdf.c 2003/08/28 03:22:16 2.20 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: m_brdf.c,v 2.17 2003/03/03 00:10:51 greg Exp $"; +static const char RCSid[] = "$Id: m_brdf.c,v 2.20 2003/08/28 03:22:16 greg Exp $"; #endif /* * Shading for materials with arbitrary BRDF's @@ -9,6 +9,8 @@ static const char RCSid[] = "$Id: m_brdf.c,v 2.17 2003 #include "ray.h" +#include "ambient.h" + #include "data.h" #include "otypes.h" @@ -160,7 +162,7 @@ double omega; /* light source size */ dtmp = funvalue(sa[0], 5, vldx); setcolor(ctmp, dtmp, dtmp, dtmp); } - if (errno) { + if (errno == EDOM || errno == ERANGE) { objerror(np->mp, WARNING, "compute error"); return; } @@ -170,7 +172,7 @@ double omega; /* light source size */ /* * Compute reflected non-diffuse component. */ - if (np->mp->otype == MAT_MFUNC | np->mp->otype == MAT_MDATA) + if ((np->mp->otype == MAT_MFUNC) | (np->mp->otype == MAT_MDATA)) multcolor(ctmp, np->mcolor); dtmp = ldot * omega * np->rspec; scalecolor(ctmp, dtmp); @@ -179,7 +181,7 @@ double omega; /* light source size */ /* * Compute transmitted non-diffuse component. */ - if (np->mp->otype == MAT_TFUNC | np->mp->otype == MAT_TDATA) + if ((np->mp->otype == MAT_TFUNC) | (np->mp->otype == MAT_TDATA)) multcolor(ctmp, np->mcolor); dtmp = -ldot * omega * np->tspec; scalecolor(ctmp, dtmp); @@ -204,7 +206,7 @@ register RAY *r; register MFUNC *mf; register int i; /* check arguments */ - if (m->oargs.nsargs < 10 | m->oargs.nfargs < 9) + if ((m->oargs.nsargs < 10) | (m->oargs.nfargs < 9)) objerror(m, USER, "bad # arguments"); nd.mp = m; nd.pr = r; @@ -251,7 +253,7 @@ register RAY *r; setcolor(ctmp, evalue(mf->ep[3]), evalue(mf->ep[4]), evalue(mf->ep[5])); - if (errno) + if (errno == EDOM || errno == ERANGE) objerror(m, WARNING, "compute error"); else if (rayorigin(&sr, r, TRANS, bright(ctmp)) == 0) { if (!(r->crtype & SHADOW) && @@ -280,7 +282,7 @@ register RAY *r; setcolor(ctmp, evalue(mf->ep[0]), evalue(mf->ep[1]), evalue(mf->ep[2])); - if (errno) + if (errno == EDOM || errno == ERANGE) objerror(m, WARNING, "compute error"); else if (rayorigin(&sr, r, REFLECTED, bright(ctmp)) == 0) { for (i = 0; i < 3; i++) @@ -335,8 +337,8 @@ register RAY *r; if (r->crtype & SHADOW) 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)) + if ((m->oargs.nsargs < (hasdata(m->otype)?4:2)) | (m->oargs.nfargs < + ((m->otype==MAT_TFUNC)|(m->otype==MAT_TDATA)?6:4))) objerror(m, USER, "bad # arguments"); /* check for back side */ if (r->rod < 0.0) { @@ -359,7 +361,7 @@ register RAY *r; /* get specular component */ nd.rspec = m->oargs.farg[3]; /* compute transmittance */ - if (m->otype == MAT_TFUNC | m->otype == MAT_TDATA) { + if ((m->otype == MAT_TFUNC) | (m->otype == MAT_TDATA)) { nd.trans = m->oargs.farg[4]*(1.0 - nd.rspec); nd.tspec = nd.trans * m->oargs.farg[5]; dtmp = nd.trans - nd.tspec;