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

Comparing ray/src/cv/bsdfrep.c (file contents):
Revision 2.16 by greg, Tue Oct 22 05:48:05 2013 UTC vs.
Revision 2.18 by greg, Fri Nov 8 05:37:20 2013 UTC

# Line 258 | Line 258 | rbf_volume(const RBFVAL *rbfp)
258   double
259   eval_rbfrep(const RBFNODE *rp, const FVECT outvec)
260   {
261 +        const double    rfact2 = (38./M_PI/M_PI)*(grid_res*grid_res);
262          double          minval = bsdf_min*output_orient*outvec[2];
263          int             pos[2];
264          double          res = 0;
# Line 280 | Line 281 | eval_rbfrep(const RBFNODE *rp, const FVECT outvec)
281                                  (pos[1]-rbfp->gy)*(pos[1]-rbfp->gy);
282                  rad2 = R2ANG(rbfp->crad);
283                  rad2 *= rad2;
284 <                if (d2 > (38.*GRIDRES*GRIDRES/M_PI/M_PI)*rad2)
284 >                if (d2 > rad2*rfact2)
285                          continue;
286                  ovec_from_pos(odir, rbfp->gx, rbfp->gy);
287                  res += rbfp->peak * exp((DOT(odir,outvec) - 1.) / rad2);
# Line 512 | Line 513 | load_bsdf_rep(FILE *ifp)
513                                  progname);
514                  return(0);
515          }
516 <        rbfh.next = NULL;               /* read each DSF */
516 <        rbfh.ejl = NULL;
516 >        memset(&rbfh, 0, sizeof(rbfh)); /* read each DSF */
517          while ((rbfh.ord = getint(4, ifp)) >= 0) {
518                  RBFNODE         *newrbf;
519  
# Line 530 | Line 530 | load_bsdf_rep(FILE *ifp)
530                                          sizeof(RBFVAL)*(rbfh.nrbf-1));
531                  if (newrbf == NULL)
532                          goto memerr;
533 <                memcpy(newrbf, &rbfh, sizeof(RBFNODE)-sizeof(RBFVAL));
533 >                *newrbf = rbfh;
534                  for (i = 0; i < rbfh.nrbf; i++) {
535                          newrbf->rbfa[i].peak = getflt(ifp);
536                          newrbf->rbfa[i].crad = getint(2, ifp) & 0xffff;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines