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.29 by greg, Fri Jan 29 16:21:55 2016 UTC vs.
Revision 2.31 by greg, Wed Feb 3 18:53:14 2016 UTC

# Line 42 | Line 42 | unsigned long          bsdf_hist[HISTLEN];
42  
43                                  /* BSDF value for boundary regions */
44   double                  bsdf_min = 0;
45 < double                  bsdf_spec_peak = 0;
45 > double                  bsdf_spec_val = 0;
46   double                  bsdf_spec_rad = 0;
47  
48                                  /* processed incident DSF measurements */
# Line 310 | Line 310 | eval_rbfcol(SDValue *sv, const RBFNODE *rp, const FVEC
310                  }
311                  res += val;
312          }
313 <        if ((rbf_colorimetry == RBCtristimulus) & (res > 1e-6)) {
313 >        sv->cieY = res / COSF(outvec[2]);
314 >        if (sv->cieY < bsdf_min) {      /* never return less than bsdf_min */
315 >                sv->cieY = bsdf_min;
316 >        } else if (rbf_colorimetry == RBCtristimulus) {
317                  C_CHROMA        cres = (int)(usum/res + frandom());
318                  cres |= (int)(vsum/res + frandom()) << 8;
319                  c_decodeChroma(&sv->spec, cres);
320          }
318        sv->cieY = res / COSF(outvec[2]);
319        if (sv->cieY < bsdf_min)        /* never return less than bsdf_min */
320                sv->cieY = bsdf_min;
321          return(SDEnone);
322   }
323  
# Line 443 | Line 443 | def_rbf_spec(const FVECT invec)
443  
444          if (input_orient > 0 ^ invec[2] > 0)    /* wrong side? */
445                  return(NULL);
446 <        if ((bsdf_spec_peak <= bsdf_min) | (bsdf_spec_rad <= 0))
446 >        if ((bsdf_spec_val <= bsdf_min) | (bsdf_spec_rad <= 0))
447                  return(NULL);                   /* nothing set */
448          rbf = (RBFNODE *)malloc(sizeof(RBFNODE));
449          if (rbf == NULL)
# Line 457 | Line 457 | def_rbf_spec(const FVECT invec)
457          rbf->ejl = NULL;
458          VCOPY(rbf->invec, invec);
459          rbf->nrbf = 1;
460 <        rbf->rbfa[0].peak = bsdf_spec_peak * output_orient*ovec[2];
460 >        rbf->rbfa[0].peak = bsdf_spec_val * COSF(ovec[2]);
461          rbf->rbfa[0].chroma = c_dfchroma;
462          rbf->rbfa[0].crad = ANG2R(bsdf_spec_rad);
463          rbf->rbfa[0].gx = pos[0];
# Line 582 | Line 582 | clear_bsdf_rep(void)
582          input_orient = output_orient = 0;
583          rbf_colorimetry = RBCunknown;
584          grid_res = GRIDRES;
585 +        memset(bsdf_hist, 0, sizeof(bsdf_hist));
586          bsdf_min = 0;
587 <        bsdf_spec_peak = 0;
587 >        bsdf_spec_val = 0;
588          bsdf_spec_rad = 0;
589   }
590  
# Line 604 | Line 605 | save_bsdf_rep(FILE *ofp)
605          fprintf(ofp, "COLORIMETRY=%s\n", RBCident[rbf_colorimetry]);
606          fprintf(ofp, "GRIDRES=%d\n", grid_res);
607          fprintf(ofp, "BSDFMIN=%g\n", bsdf_min);
608 <        if ((bsdf_spec_peak > bsdf_min) & (bsdf_spec_rad > 0))
609 <                fprintf(ofp, "BSDFSPEC= %f %f\n", bsdf_spec_peak, bsdf_spec_rad);
608 >        if ((bsdf_spec_val > bsdf_min) & (bsdf_spec_rad > 0))
609 >                fprintf(ofp, "BSDFSPEC= %f %f\n", bsdf_spec_val, bsdf_spec_rad);
610          fputformat(BSDFREP_FMT, ofp);
611          fputc('\n', ofp);
612          putint(BSDFREP_MAGIC, 2, ofp);
# Line 698 | Line 699 | headline(char *s, void *p)
699                  return(0);
700          }
701          if (!strncmp(s, "BSDFSPEC=", 9)) {
702 <                sscanf(s+9, "%lf %lf", &bsdf_spec_peak, &bsdf_spec_rad);
702 >                sscanf(s+9, "%lf %lf", &bsdf_spec_val, &bsdf_spec_rad);
703                  return(0);
704          }
705          if (formatval(fmt, s) && strcmp(fmt, BSDFREP_FMT))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines