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

Comparing ray/src/util/dctimestep.c (file contents):
Revision 2.33 by greg, Sun Jun 1 03:20:29 2014 UTC vs.
Revision 2.35 by greg, Fri Sep 26 23:33:09 2014 UTC

# Line 26 | Line 26 | sum_images(const char *fspec, const CMATRIX *cv, FILE
26          int     i, y;
27  
28          if (cv->ncols != 1)
29 <                error(INTERNAL, "expected matrix in sum_images()");
29 >                error(INTERNAL, "expected vector in sum_images()");
30          for (i = 0; i < cv->nrows; i++) {
31                  const COLORV    *scv = cv_lval(cv,i);
32                  char            fname[1024];
# Line 119 | Line 119 | hasNumberFormat(const char *s)
119   int
120   main(int argc, char *argv[])
121   {
122 <        int             skyfmt = DTascii;
122 >        int             skyfmt = DTfromHeader;
123          int             outfmt = DTascii;
124 <        int             nsteps = 1;
124 >        int             headout = 1;
125 >        int             nsteps = 0;
126          char            *ofspec = NULL;
127          FILE            *ofp = stdout;
128          CMATRIX         *cmtx;          /* component vector/matrix result */
# Line 136 | Line 137 | main(int argc, char *argv[])
137                          nsteps = atoi(argv[++a]);
138                          if (nsteps < 0)
139                                  goto userr;
140 +                        skyfmt = nsteps ? DTascii : DTfromHeader;
141                          break;
142 +                case 'h':
143 +                        headout = !headout;
144 +                        break;
145                  case 'i':
146                          switch (argv[a][2]) {
147                          case 'f':
# Line 148 | Line 153 | main(int argc, char *argv[])
153                          case 'a':
154                                  skyfmt = DTascii;
155                                  break;
151                        case 'h':
152                                skyfmt = DTfromHeader;
153                                break;
156                          default:
157                                  goto userr;
158                          }
# Line 183 | Line 185 | main(int argc, char *argv[])
185                  CMATRIX *smtx, *Dmat, *Tmat, *imtx;
186                                                  /* get sky vector/matrix */
187                  smtx = cm_load(argv[a+3], 0, nsteps, skyfmt);
188 +                nsteps = smtx->ncols;
189                                                  /* load BSDF */
190                  Tmat = cm_loadBTDF(argv[a+1]);
191                                                  /* load Daylight matrix */
# Line 196 | Line 199 | main(int argc, char *argv[])
199                  cm_free(imtx);
200          } else {                                /* sky vector/matrix only */
201                  cmtx = cm_load(argv[a+1], 0, nsteps, skyfmt);
202 +                nsteps = cmtx->ncols;
203          }
204                                                  /* prepare output stream */
205          if ((ofspec != NULL) & (nsteps == 1) && hasNumberFormat(ofspec)) {
# Line 266 | Line 270 | main(int argc, char *argv[])
270   #ifdef getc_unlocked
271                                  flockfile(ofp);
272   #endif
273 +                                if (headout) {  /* header output */
274 +                                        newheader("RADIANCE", ofp);
275 +                                        printargs(argc, argv, ofp);
276 +                                        fputnow(ofp);
277 +                                        fprintf(ofp, "FRAME=%d\n", i+1);
278 +                                        fprintf(ofp, "NROWS=%d\n", rvec->nrows);
279 +                                        fputs("NCOLS=1\nNCOMP=3\n", ofp);
280 +                                        fputformat((char *)cm_fmt_id[outfmt], ofp);
281 +                                        fputc('\n', ofp);
282 +                                }
283                                  cm_write(rvec, outfmt, ofp);
284                                  if (fclose(ofp) == EOF) {
285                                          fprintf(stderr,
# Line 282 | Line 296 | main(int argc, char *argv[])
296   #endif
297                          if (outfmt != DTascii)
298                                  SET_FILE_BINARY(ofp);
299 <                        if (rmtx->ncols > 1) {  /* header if actual matrix */
299 >                        if (headout) {          /* header output */
300                                  newheader("RADIANCE", ofp);
301                                  printargs(argc, argv, ofp);
302                                  fputnow(ofp);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines