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.29 by greg, Wed Aug 14 21:00:14 2019 UTC vs.
Revision 2.33 by greg, Mon Jan 6 21:22:46 2020 UTC

# Line 81 | Line 81 | static const char RCSid[] = "$Id$";
81  
82   /* Include files */
83   #define _USE_MATH_DEFINES
84 #include <stdio.h>
84   #include <stdlib.h>
86 #include <string.h>
85   #include <ctype.h>
86 + #include "platform.h"
87   #include "rtmath.h"
88   #include "rtio.h"
90 #include "resolu.h"
91 #include "platform.h"
89   #include "color.h"
90 < #include "resolu.h"
90 > #include "sun.h"
91  
92   char *progname;                                                         /* Program name */
93   char errmsg[128];                                                       /* Error message buffer */
# Line 255 | Line 252 | static const ModelCoeff DirectLumEff[8] =
252   #define NSUNPATCH       4               /* max. # patches to spread sun into */
253   #endif
254  
258 extern int jdate(int month, int day);
259 extern double stadj(int  jd);
260 extern double sdec(int  jd);
261 extern double salt(double sd, double st);
262 extern double sazi(double sd, double st);
263                                        /* sun calculation constants */
264 extern double  s_latitude;
265 extern double  s_longitude;
266 extern double  s_meridian;
267
255   int             nsuns = NSUNPATCH;      /* number of sun patches to use */
256   double          fixed_sun_sa = -1;      /* fixed solid angle per sun? */
257  
# Line 326 | Line 313 | main(int argc, char *argv[])
313          int     tstorage = 0;           /* number of allocated time steps */
314          int     nstored = 0;            /* number of time steps in matrix */
315          int     last_monthly = 0;       /* month of last report */
329        int     inconsistent = 0;       /* inconsistent options set? */
316          int     mo, da;                 /* month (1-12) and day (1-31) */
317          double  hr;                     /* hour (local standard time) */
318          double  dir, dif;               /* direct and diffuse values */
# Line 377 | Line 363 | main(int argc, char *argv[])
363                          rhsubdiv = atoi(argv[++i]);
364                          break;
365                  case 'c':                       /* sky color */
380                        inconsistent |= (skycolor[1] <= 1e-4);
366                          skycolor[0] = atof(argv[++i]);
367                          skycolor[1] = atof(argv[++i]);
368                          skycolor[2] = atof(argv[++i]);
369                          break;
370                  case 'd':                       /* solar (direct) only */
371                          skycolor[0] = skycolor[1] = skycolor[2] = 0;
372 <                        if (suncolor[1] <= 1e-4) {
388 <                                inconsistent = 1;
389 <                                suncolor[0] = suncolor[1] = suncolor[2] = 1;
390 <                        }
372 >                        grefl[0] = grefl[1] = grefl[2] = 0;
373                          break;
374                  case 's':                       /* sky only (no direct) */
375                          suncolor[0] = suncolor[1] = suncolor[2] = 0;
394                        if (skycolor[1] <= 1e-4) {
395                                inconsistent = 1;
396                                skycolor[0] = skycolor[1] = skycolor[2] = 1;
397                        }
376                          break;
377                  case 'r':                       /* rotate distribution */
378                          if (argv[i][2] && argv[i][2] != 'z')
# Line 419 | Line 397 | main(int argc, char *argv[])
397                  }
398          if (i < argc-1)
399                  goto userr;
422        if (inconsistent)
423                fprintf(stderr, "%s: WARNING: inconsistent -s, -d, -c options!\n",
424                                progname);
400          if (i == argc-1 && freopen(argv[i], "r", stdin) == NULL) {
401                  fprintf(stderr, "%s: cannot open '%s' for input\n",
402                                  progname, argv[i]);
# Line 680 | Line 655 | ComputeSky(float *parr)
655                  diff_illum = diff_irrad * WHTEFFICACY;
656                  dir_illum = dir_irrad * WHTEFFICACY;
657          }
683
684        if (bright(skycolor) <= 1e-4) {                 /* 0 sky component? */
685                memset(parr, 0, sizeof(float)*3*nskypatch);
686                return;
687        }
658          /* Compute ground radiance (include solar contribution if any) */
659          parr[0] = diff_illum;
660          if (altitude > 0)
# Line 692 | Line 662 | ComputeSky(float *parr)
662          parr[2] = parr[1] = parr[0] *= (1./PI/WHTEFFICACY);
663          multcolor(parr, grefl);
664  
665 +        if (bright(skycolor) <= 1e-4) {                 /* 0 sky component? */
666 +                memset(parr+3, 0, sizeof(float)*3*(nskypatch-1));
667 +                return;
668 +        }
669          /* Calculate Perez sky model parameters */
670          CalcPerezParam(sun_zenith, sky_clearness, sky_brightness, index);
671  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines