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.20 by schorsch, Sun Mar 6 01:13:18 2016 UTC vs.
Revision 2.21 by greg, Fri Oct 14 00:54:22 2016 UTC

# Line 395 | Line 395 | determine_angle_basis(const char *fn, ezxml_t wtl)
395   static int
396   filter_klems_matrix(FILE *fp)
397   {
398 #define MAX_COLUMNS     145
398          const char      *bn = klems_basis_name[angle_basis];
400        float           col_corr[MAX_COLUMNS];
399          int             i, j, n = nabases;
400                                          /* get angle basis */
401          while (n-- > 0)
# Line 405 | Line 403 | filter_klems_matrix(FILE *fp)
403                          break;
404          if (n < 0)
405                  return 0;
408        if (abase_list[n].nangles > MAX_COLUMNS) {
409                fputs("Internal error - too many Klems columns!\n", stderr);
410                return 0;
411        }
412                                        /* get correction factors */
413        for (j = abase_list[n].nangles; j--; )
414                col_corr[j] = 1.f / io_getohm(j, &abase_list[n]);
406                                          /* read/correct/write matrix */
407          for (i = 0; i < abase_list[n].nangles; i++) {
408 +            const double        corr = 1./io_getohm(i, &abase_list[n]);
409              for (j = 0; j < abase_list[n].nangles; j++) {
410                  double  d;
411                  if (fscanf(fp, "%lf", &d) != 1)
# Line 422 | Line 414 | filter_klems_matrix(FILE *fp)
414                          fputs("Negative BSDF data!\n", stderr);
415                          return 0;
416                  }
417 <                printf(" %.3e", d*col_corr[j]*(d > 0));
417 >                printf(" %.3e", d*corr*(d > 0));
418              }
419              fputc('\n', stdout);
420          }
# Line 432 | Line 424 | filter_klems_matrix(FILE *fp)
424                          return 0;
425                  }
426          return 1;                       /* all is good */
435 #undef MAX_COLUMNS
427   }
428  
429   /* Write out BSDF data block with surrounding tags */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines