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

Comparing ray/src/rt/m_bsdf.c (file contents):
Revision 2.15 by greg, Mon Aug 22 16:00:47 2011 UTC vs.
Revision 2.19 by greg, Tue Apr 24 15:36:40 2012 UTC

# Line 109 | Line 109 | direct_bsdf_OK(COLOR cval, FVECT ldir, double omega, B
109                                          /* transform source direction */
110          if (SDmapDir(vsrc, ndp->toloc, ldir) != SDEnone)
111                  return(0);
112 +                                        /* assign number of samples */
113 +        ec = SDsizeBSDF(&tomega, ndp->vray, vsrc, SDqueryMin, ndp->sd);
114 +        if (ec)
115 +                goto baderror;
116                                          /* check indirect over-counting */
117          if (ndp->thick != 0 && ndp->pr->crtype & (SPECULAR|AMBIENT)
118                                  && vsrc[2] > 0 ^ ndp->vray[2] > 0) {
119                  double  dx = vsrc[0] + ndp->vray[0];
120                  double  dy = vsrc[1] + ndp->vray[1];
121 <                if (dx*dx + dy*dy <= omega*(1./PI))
121 >                if (dx*dx + dy*dy <= omega+tomega)
122                          return(0);
123          }
120                                        /* assign number of samples */
121        ec = SDsizeBSDF(&tomega, ndp->vray, vsrc, SDqueryMin, ndp->sd);
122        if (ec)
123                goto baderror;
124          sf = specjitter * ndp->pr->rweight;
125          if (25.*tomega <= omega)
126                  nsamp = 100.*sf + .5;
# Line 157 | Line 157 | direct_bsdf_OK(COLOR cval, FVECT ldir, double omega, B
157          return(ok);
158   baderror:
159          objerror(ndp->mp, USER, transSDError(ec));
160 +        return(0);                      /* gratis return */
161   }
162  
163   /* Compute source contribution for BSDF (reflected & transmitted) */
# Line 511 | Line 512 | m_bsdf(OBJREC *m, RAY *r)
512                  nd.vray[1] = -r->rdir[1];
513                  nd.vray[2] = -r->rdir[2];
514                  ec = SDmapDir(nd.vray, nd.toloc, nd.vray);
515 +        }
516 +        if (ec) {
517 +                objerror(m, WARNING, "Illegal orientation vector");
518 +                return(1);
519          }
520 <        if (!ec)
516 <                ec = SDinvXform(nd.fromloc, nd.toloc);
520 >        ec = SDinvXform(nd.fromloc, nd.toloc);
521                                                  /* determine BSDF resolution */
522          if (!ec)
523                  ec = SDsizeBSDF(nd.sr_vpsa, nd.vray, NULL,
# Line 556 | Line 560 | m_bsdf(OBJREC *m, RAY *r)
560                  bnorm[2] = -nd.pnorm[2];
561                  if (nd.thick != 0) {            /* proxy with offset? */
562                          VCOPY(vtmp, r->rop);
563 <                        VSUM(r->rop, vtmp, r->ron, -nd.thick);
563 >                        VSUM(r->rop, vtmp, r->ron, nd.thick);
564                          multambient(ctmp, r, bnorm);
565                          VCOPY(r->rop, vtmp);
566                  } else

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines