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

Comparing ray/src/cv/bsdf2ttree.c (file contents):
Revision 2.1 by greg, Fri Oct 19 04:14:29 2012 UTC vs.
Revision 2.4 by greg, Wed Nov 7 03:04:23 2012 UTC

# Line 29 | Line 29 | interp_isotropic()
29          char            cmd[128];
30          int             ix, ox, oy;
31          FVECT           ivec, ovec;
32 <        double          bsdf;
32 >        float           bsdf;
33   #if DEBUG
34          fprintf(stderr, "Writing isotropic order %d ", samp_order);
35          if (pctcull >= 0) fprintf(stderr, "data with %d%% culling\n", pctcull);
36          else fputs("raw data\n", stderr);
37   #endif
38          if (pctcull >= 0) {                     /* begin output */
39 <                sprintf(cmd, "rttree_reduce -h -a -fd -r 3 -t %d -g %d",
39 >                sprintf(cmd, "rttree_reduce -h -a -ff -r 3 -t %d -g %d",
40                                  pctcull, samp_order);
41                  fflush(stdout);
42                  ofp = popen(cmd, "w");
# Line 66 | Line 66 | interp_isotropic()
66                          else
67                                  printf("\t%.3e\n", bsdf);
68                      }
69 <                free(rbf);
69 >                if (rbf != NULL)
70 >                        free(rbf);
71          }
72          if (pctcull >= 0) {                     /* finish output */
73                  if (pclose(ofp)) {
# Line 90 | Line 91 | interp_anisotropic()
91          char            cmd[128];
92          int             ix, iy, ox, oy;
93          FVECT           ivec, ovec;
94 <        double          bsdf;
94 >        float           bsdf;
95   #if DEBUG
96          fprintf(stderr, "Writing anisotropic order %d ", samp_order);
97          if (pctcull >= 0) fprintf(stderr, "data with %d%% culling\n", pctcull);
98          else fputs("raw data\n", stderr);
99   #endif
100          if (pctcull >= 0) {                     /* begin output */
101 <                sprintf(cmd, "rttree_reduce -h -a -fd -r 4 -t %d -g %d",
101 >                sprintf(cmd, "rttree_reduce -h -a -ff -r 4 -t %d -g %d",
102                                  pctcull, samp_order);
103                  fflush(stdout);
104                  ofp = popen(cmd, "w");
# Line 127 | Line 128 | interp_anisotropic()
128                          else
129                                  printf("\t%.3e\n", bsdf);
130                      }
131 <                free(rbf);
131 >                if (rbf != NULL)
132 >                        free(rbf);
133              }
134          if (pctcull >= 0) {                     /* finish output */
135                  if (pclose(ofp)) {
# Line 160 | Line 162 | main(int argc, char *argv[])
162                  }
163                  argv += 2; argc -= 2;
164          }
165 <        if (argc == 2)
165 >        if (argc == 2) {                        /* open input if given */
166                  fpin = fopen(argv[1], "r");
167 <        else if (argc != 1)
167 >                if (fpin == NULL) {
168 >                        fprintf(stderr, "%s: cannot open BSDF interpolant '%s'\n",
169 >                                        progname, argv[1]);
170 >                        return(1);
171 >                }
172 >        } else if (argc != 1)
173                  goto userr;
174          SET_FILE_BINARY(fpin);                  /* load BSDF interpolant */
175          if (!load_bsdf_rep(fpin))
176                  return(1);
170        draw_edges();
177          /* xml_prologue();                              /* start XML output */
178          if (single_plane_incident)              /* resample dist. */
179                  interp_isotropic();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines