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

Comparing ray/src/cv/bsdf2rad.c (file contents):
Revision 2.25 by greg, Wed Apr 12 00:31:40 2017 UTC vs.
Revision 2.28 by greg, Wed Apr 12 04:27:04 2017 UTC

# Line 26 | Line 26 | double overall_max = .0;               /* overall maximum BSDF valu
26  
27   char    ourTempDir[TEMPLEN] = "";       /* our temporary directory */
28  
29 < const char      frpref[] = "frefl";
30 < const char      ftpref[] = "ftrans";
31 < const char      brpref[] = "brefl";
32 < const char      btpref[] = "btrans";
29 > const char      frpref[] = "rf";
30 > const char      ftpref[] = "tf";
31 > const char      brpref[] = "rb";
32 > const char      btpref[] = "tb";
33   const char      dsuffix[] = ".txt";
34  
35   const char      sph_fmat[] = "fBSDFmat";
# Line 381 | Line 381 | put_BSDFs(void)
381          printf("\nvoid glow arrow_glow\n0\n0\n4 1 0 1 0\n");
382          printf("\nvoid mixfunc arrow_mat\n4 arrow_glow void 0.25 .\n0\n0\n");
383  
384        if (front_comp & SDsampR)                       /* front reflection */
384          for (i = 0; i < NINCIDENT; i++) {
385                  get_ivector(ivec, i);
386                  nrm[0] = -ivec[0]; nrm[1] = -ivec[1]; nrm[2] = ivec[2];
# Line 471 | Line 470 | put_matBSDF(const char *XMLfile)
470          }
471          switch (XMLfile[0]) {           /* avoid RAYPATH search */
472          case '.':
473 +        case '~':
474          CASEDIRSEP:
475                  curdir = "";
476                  break;
# Line 750 | Line 750 | main(int argc, char *argv[])
750                  strcpy(bsdf_manuf, myBSDF.makr);
751                  put_matBSDF(argv[1]);
752          } else {
753 <                FILE    *fp;
753 >                FILE    *fp[4];
754 >                if (argc > 5) {
755 >                        fprintf(stderr, "%s: more than 4 hemispheres!\n", progname);
756 >                        return(1);
757 >                }
758                  for (n = 1; n < argc; n++) {
759 <                        fp = fopen(argv[n], "rb");
760 <                        if (fp == NULL) {
759 >                        fp[n-1] = fopen(argv[n], "rb");
760 >                        if (fp[n-1] == NULL) {
761                                  fprintf(stderr, "%s: cannot open BSDF interpolant '%s'\n",
762                                                  progname, argv[n]);
763                                  return(1);
764                          }
765 <                        if (getheader(fp, rbf_headline, NULL) < 0) {
765 >                        if (getheader(fp[n-1], rbf_headline, NULL) < 0) {
766                                  fprintf(stderr, "%s: bad BSDF interpolant '%s'\n",
767                                                  progname, argv[n]);
768                                  return(1);
769                          }
766                        fclose(fp);
770                  }
771                  set_minlog();
772                  for (n = 1; n < argc; n++) {
773 <                        fp = fopen(argv[n], "rb");
774 <                        if (!load_bsdf_rep(fp))
773 >                        if (fseek(fp[n-1], 0L, SEEK_SET) < 0) {
774 >                                fprintf(stderr, "%s: cannot seek on '%s'\n",
775 >                                                progname, argv[n]);
776                                  return(1);
777 <                        fclose(fp);
777 >                        }
778 >                        if (!load_bsdf_rep(fp[n-1]))
779 >                                return(1);
780 >                        fclose(fp[n-1]);
781                          if (!build_wRBF())
782                                  return(1);
783                  }
# Line 781 | Line 788 | main(int argc, char *argv[])
788          put_scale();
789          if (inpXML && myBSDF.mgf)
790                  convert_mgf(myBSDF.mgf);
791 <        if (!put_BSDFs())
791 >        if (!put_BSDFs())               /* most of the output happens here */
792                  return(1);
793          cleanup_tmp();
794          return(0);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines