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.19 by greg, Wed Feb 3 00:22:55 2016 UTC vs.
Revision 2.21 by greg, Fri Oct 14 00:54:22 2016 UTC

# Line 7 | Line 7 | static const char RCSid[] = "$Id$";
7   *      G. Ward         February 2015
8   */
9  
10 + #include "platform.h"
11   #include <ctype.h>
12   #include "rtio.h"
13   #include "paths.h"
# Line 165 | Line 166 | input2str(const char *inpspec)
166                          fprintf(stderr, "%s: cannot open\n", inpspec);
167                          return "";
168                  }
169 < #ifndef _WIN32                          /* XXX somehow broken on Windows */
169 > #if !defined(_WIN32) && !defined(_WIN64)
170 >                                /* XXX somehow broken on Windows */
171                  len = lseek(fd, 0L, SEEK_END);
172                  if (len > 0) {
173                          lseek(fd, 0L, SEEK_SET);
# Line 393 | Line 395 | determine_angle_basis(const char *fn, ezxml_t wtl)
395   static int
396   filter_klems_matrix(FILE *fp)
397   {
396 #define MAX_COLUMNS     145
398          const char      *bn = klems_basis_name[angle_basis];
398        float           col_corr[MAX_COLUMNS];
399          int             i, j, n = nabases;
400                                          /* get angle basis */
401          while (n-- > 0)
# Line 403 | Line 403 | filter_klems_matrix(FILE *fp)
403                          break;
404          if (n < 0)
405                  return 0;
406        if (abase_list[n].nangles > MAX_COLUMNS) {
407                fputs("Internal error - too many Klems columns!\n", stderr);
408                return 0;
409        }
410                                        /* get correction factors */
411        for (j = abase_list[n].nangles; j--; )
412                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 420 | 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 430 | Line 424 | filter_klems_matrix(FILE *fp)
424                          return 0;
425                  }
426          return 1;                       /* all is good */
433 #undef MAX_COLUMNS
427   }
428  
429   /* Write out BSDF data block with surrounding tags */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines