ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/m_brdf.c
(Generate patch)

Comparing ray/src/rt/m_brdf.c (file contents):
Revision 2.23 by greg, Tue Apr 19 01:15:06 2005 UTC vs.
Revision 2.27 by greg, Mon Oct 25 22:57:45 2010 UTC

# Line 129 | Line 129 | dirbrdf(               /* compute source contribution */
129                  addcolor(cval, ctmp);
130          }
131          if (ldot > 0.0 ? np->rspec <= FTINY : np->tspec <= FTINY)
132 <                return;         /* no specular component */
132 >                return;         /* diffuse only */
133                                          /* set up function */
134          setbrdfunc(np);
135          sa = np->mp->oargs.sarg;
# Line 145 | Line 145 | dirbrdf(               /* compute source contribution */
145                          colval(ctmp,RED) = 0.0;
146                  else
147                          colval(ctmp,RED) = funvalue(sa[6], 4, lddx);
148 <                if (!strcmp(sa[7],sa[6]))
148 >                if (sa[7][0] == '0')
149 >                        colval(ctmp,GRN) = 0.0;
150 >                else if (!strcmp(sa[7],sa[6]))
151                          colval(ctmp,GRN) = colval(ctmp,RED);
152                  else
153                          colval(ctmp,GRN) = funvalue(sa[7], 4, lddx);
# Line 166 | Line 168 | dirbrdf(               /* compute source contribution */
168                  dtmp = funvalue(sa[0], 5, vldx);
169                  setcolor(ctmp, dtmp, dtmp, dtmp);
170          }
171 <        if (errno == EDOM || errno == ERANGE) {
171 >        if ((errno == EDOM) | (errno == ERANGE)) {
172                  objerror(np->mp, WARNING, "compute error");
173                  return;
174          }
# Line 265 | Line 267 | m_brdf(                        /* color a ray that hit a BRDTfunc material
267          setcolor(ctmp, evalue(mf->ep[3]),
268                          evalue(mf->ep[4]),
269                          evalue(mf->ep[5]));
270 <        if (errno == EDOM || errno == ERANGE)
270 >        if ((errno == EDOM) | (errno == ERANGE))
271                  objerror(m, WARNING, "compute error");
272          else if (rayorigin(&sr, TRANS, r, ctmp) == 0) {
273                  if (!(r->crtype & SHADOW) && hastexture) {
274 <                        for (i = 0; i < 3; i++) /* perturb direction */
275 <                                sr.rdir[i] = r->rdir[i] - .75*r->pert[i];
274 >                                                /* perturb direction */
275 >                        VSUM(sr.rdir, r->rdir, r->pert, -.75);
276                          if (normalize(sr.rdir) == 0.0) {
277                                  objerror(m, WARNING, "illegal perturbation");
278                                  VCOPY(sr.rdir, r->rdir);
# Line 294 | Line 296 | m_brdf(                        /* color a ray that hit a BRDTfunc material
296          setcolor(ctmp, evalue(mf->ep[0]),
297                          evalue(mf->ep[1]),
298                          evalue(mf->ep[2]));
299 <        if (errno == EDOM || errno == ERANGE)
299 >        if ((errno == EDOM) | (errno == ERANGE))
300                  objerror(m, WARNING, "compute error");
301          else if (rayorigin(&sr, REFLECTED, r, ctmp) == 0) {
302 <                for (i = 0; i < 3; i++)
303 <                        sr.rdir[i] = r->rdir[i] + 2.0*nd.pdot*nd.pnorm[i];
302 >                VSUM(sr.rdir, r->rdir, nd.pnorm, 2.*nd.pdot);
303 >                checknorm(sr.rdir);
304                  rayvalue(&sr);
305                  multcolor(sr.rcol, sr.rcoef);
306                  addcolor(r->rcol, sr.rcol);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines