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

Comparing ray/src/util/wrapBSDF.c (file contents):
Revision 2.26 by greg, Mon Oct 26 21:12:20 2020 UTC vs.
Revision 2.27 by greg, Wed Sep 7 18:55:39 2022 UTC

# Line 417 | Line 417 | determine_angle_basis(const char *fn, ezxml_t wtl)
417          return -1;
418   }
419  
420 < /* Filter Klems angle basis, factoring out incident projected solid angle */
420 > /* Filter Klems angle data, factoring out incident projected solid angle */
421   static int
422   filter_klems_matrix(FILE *fp)
423   {
424          const char      *bn = klems_basis_name[angle_basis];
425 <        int             i, j, n = nabases;
425 >        int             i, j, c, n = nabases;
426                                          /* get angle basis */
427          while (n-- > 0)
428                  if (!strcasecmp(bn, abase_list[n].name))
# Line 434 | Line 434 | filter_klems_matrix(FILE *fp)
434              const double        corr = 1./io_getohm(i, &abase_list[n]);
435              for (j = 0; j < abase_list[n].nangles; j++) {
436                  double  d;
437 <                if (fscanf(fp, "%lf", &d) != 1)
437 >                if (fscanf(fp, "%lf ", &d) != 1)
438                          return 0;
439 +                if ((c = getc(fp)) != ',')
440 +                        ungetc(c, fp);
441                  if (d < -1e-3) {
442                          fputs("Negative BSDF data!\n", stderr);
443                          return 0;
# Line 444 | Line 446 | filter_klems_matrix(FILE *fp)
446              }
447              fputc('\n', stdout);
448          }
449 <        while ((i = getc(fp)) != EOF)
450 <                if (!isspace(i)) {
449 >        while ((c = getc(fp)) != EOF)
450 >                if (!isspace(c)) {
451                          fputs("Unexpected data past EOF\n", stderr);
452                          return 0;
453                  }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines