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.17 by greg, Sun Oct 26 17:35:53 2014 UTC vs.
Revision 2.22 by greg, Fri Oct 30 17:06:34 2015 UTC

# Line 86 | Line 86 | static const char RCSid[] = "$Id$";
86   #include <string.h>
87   #include <ctype.h>
88   #include "rtmath.h"
89 + #include "resolu.h"
90   #include "platform.h"
91   #include "color.h"
92   #include "resolu.h"
# Line 322 | Line 323 | main(int argc, char *argv[])
323          int     ntsteps = 0;            /* number of rows in matrix */
324          int     step_alloc = 0;
325          int     last_monthly = 0;       /* month of last report */
326 +        int     inconsistent = 0;       /* inconsistent options set? */
327          int     mo, da;                 /* month (1-12) and day (1-31) */
328          double  hr;                     /* hour (local standard time) */
329          double  dir, dif;               /* direct and diffuse values */
# Line 372 | Line 374 | main(int argc, char *argv[])
374                          rhsubdiv = atoi(argv[++i]);
375                          break;
376                  case 'c':                       /* sky color */
377 +                        inconsistent |= (skycolor[1] <= 1e-4);
378                          skycolor[0] = atof(argv[++i]);
379                          skycolor[1] = atof(argv[++i]);
380                          skycolor[2] = atof(argv[++i]);
381                          break;
382                  case 'd':                       /* solar (direct) only */
383                          skycolor[0] = skycolor[1] = skycolor[2] = 0;
384 <                        if (suncolor[1] <= 1e-4)
384 >                        if (suncolor[1] <= 1e-4) {
385 >                                inconsistent = 1;
386                                  suncolor[0] = suncolor[1] = suncolor[2] = 1;
387 +                        }
388                          break;
389                  case 's':                       /* sky only (no direct) */
390                          suncolor[0] = suncolor[1] = suncolor[2] = 0;
391 <                        if (skycolor[1] <= 1e-4)
391 >                        if (skycolor[1] <= 1e-4) {
392 >                                inconsistent = 1;
393                                  skycolor[0] = skycolor[1] = skycolor[2] = 1;
394 +                        }
395                          break;
396                  case 'r':                       /* rotate distribution */
397                          if (argv[i][2] && argv[i][2] != 'z')
# Line 393 | Line 400 | main(int argc, char *argv[])
400                          break;
401                  case '5':                       /* 5-phase calculation */
402                          nsuns = 1;
403 <                        fixed_sun_sa = 6.797e-05;
403 >                        fixed_sun_sa = PI/360.*atof(argv[++i]);
404 >                        if (fixed_sun_sa <= 0) {
405 >                                fprintf(stderr, "%s: missing solar disk size argument for '-5' option\n",
406 >                                                argv[0]);
407 >                                exit(1);
408 >                        }
409 >                        fixed_sun_sa *= fixed_sun_sa*PI;
410                          break;
411                  default:
412                          goto userr;
413                  }
414          if (i < argc-1)
415                  goto userr;
416 +        if (inconsistent)
417 +                fprintf(stderr, "%s: WARNING: inconsistent -s, -d, -c options!\n",
418 +                                progname);
419          if (i == argc-1 && freopen(argv[i], "r", stdin) == NULL) {
420                  fprintf(stderr, "%s: cannot open '%s' for input\n",
421                                  progname, argv[i]);
# Line 520 | Line 536 | main(int argc, char *argv[])
536                  printf("NROWS=%d\n", nskypatch);
537                  printf("NCOLS=%d\n", ntsteps);
538                  printf("NCOMP=3\n");
539 <                fputformat(getfmtname(outfmt), stdout);
539 >                fputformat((char *)getfmtname(outfmt), stdout);
540                  putchar('\n');
541          }
542                                          /* patches are rows (outer sort) */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines