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

Comparing ray/src/gen/gendaymtx.c (file contents):
Revision 2.13 by greg, Fri Oct 4 04:31:18 2013 UTC vs.
Revision 2.14 by greg, Fri May 30 00:00:54 2014 UTC

# Line 86 | Line 86 | static const char RCSid[] = "$Id$";
86   #include <string.h>
87   #include <ctype.h>
88   #include "rtmath.h"
89 + #include "platform.h"
90   #include "color.h"
91  
92   char *progname;                                                         /* Program name */
# Line 292 | Line 293 | extern int     rh_init(void);
293   extern float *  resize_dmatrix(float *mtx_data, int nsteps, int npatch);
294   extern void     AddDirect(float *parr);
295  
296 +
297 + static const char *
298 + getfmtname(int fmt)
299 + {
300 +        switch (fmt) {
301 +        case 'a':
302 +                return("ascii");
303 +        case 'f':
304 +                return("float");
305 +        case 'd':
306 +                return("double");
307 +        }
308 +        return("unknown");
309 + }
310 +
311 +
312   int
313   main(int argc, char *argv[])
314   {
315          char    buf[256];
316 +        int     doheader = 1;           /* output header? */
317          double  rotation = 0;           /* site rotation (degrees) */
318          double  elevation;              /* site elevation (meters) */
319          int     dir_is_horiz;           /* direct is meas. on horizontal? */
# Line 320 | Line 338 | main(int argc, char *argv[])
338                  case 'v':                       /* verbose progress reports */
339                          verbose++;
340                          break;
341 +                case 'h':                       /* turn off header */
342 +                        doheader = 0;
343 +                        break;
344                  case 'o':                       /* output format */
345                          switch (argv[i][2]) {
346                          case 'f':
# Line 478 | Line 499 | main(int argc, char *argv[])
499                          break;
500                  }
501                                          /* write out matrix */
502 +        if (outfmt != 'a')
503 +                SET_FILE_BINARY(stdout);
504   #ifdef getc_unlocked
505          flockfile(stdout);
506   #endif
507          if (verbose)
508                  fprintf(stderr, "%s: writing %smatrix with %d time steps...\n",
509                                  progname, outfmt=='a' ? "" : "binary ", ntsteps);
510 +        if (doheader) {
511 +                newheader("RADIANCE", stdout);
512 +                printargs(argc, argv, stdout);
513 +                printf("LATLONG= %.8f %.8f\n", RadToDeg(s_latitude),
514 +                                        -RadToDeg(s_longitude));
515 +                printf("NROWS=%d\n", nskypatch);
516 +                printf("NCOLS=%d\n", ntsteps);
517 +                printf("NCOMP=3\n");
518 +                fputformat(getfmtname(outfmt), stdout);
519 +                putchar('\n');
520 +        }
521                                          /* patches are rows (outer sort) */
522          for (i = 0; i < nskypatch; i++) {
523                  mtx_offset = 3*i;
# Line 525 | Line 559 | main(int argc, char *argv[])
559                  fprintf(stderr, "%s: done.\n", progname);
560          exit(0);
561   userr:
562 <        fprintf(stderr, "Usage: %s [-v][-d|-s][-r deg][-m N][-g r g b][-c r g b][-o{f|d}][-O{0|1}] [tape.wea]\n",
562 >        fprintf(stderr, "Usage: %s [-v][-h][-d|-s][-r deg][-m N][-g r g b][-c r g b][-o{f|d}][-O{0|1}] [tape.wea]\n",
563                          progname);
564          exit(1);
565   fmterr:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines