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.4 by greg, Sun Jan 20 01:16:15 2013 UTC vs.
Revision 2.7 by greg, Sat Jan 26 00:59:08 2013 UTC

# Line 494 | Line 494 | main(int argc, char *argv[])
494                  fprintf(stderr, "%s: done.\n", progname);
495          exit(0);
496   userr:
497 <        fprintf(stderr, "Usage: %s [-v][-d|-s][-m N][-g refl][-c r g b][-o{f|d}] [tape.wea]\n",
497 >        fprintf(stderr, "Usage: %s [-v][-d|-s][-m N][-g r g b][-c r g b][-o{f|d}] [tape.wea]\n",
498                          progname);
499          exit(1);
500   fmterr:
# Line 515 | Line 515 | ComputeSky(float *parr)
515   {
516          int index;                      /* Category index */
517          double norm_diff_illum;         /* Normalized diffuse illuimnance */
518        double zlumin;                  /* Zenith luminance */
518          int i;
519          
520          /* Calculate atmospheric precipitable water content */
521          apwc = CalcPrecipWater(dew_point);
522  
523 <        /* Limit solar altitude to keep circumsolar off zenith */
524 <        if (altitude > DegToRad(87.0))
525 <                altitude = DegToRad(87.0);
523 >        /* Calculate sun zenith angle (don't let it dip below horizon) */
524 >        /* Also limit minimum angle to keep circumsolar off zenith */
525 >        if (altitude <= 0.0)
526 >                sun_zenith = DegToRad(90.0);
527 >        else if (altitude >= DegToRad(87.0))
528 >                sun_zenith = DegToRad(3.0);
529 >        else
530 >                sun_zenith = DegToRad(90.0) - altitude;
531  
528        /* Calculate sun zenith angle */
529        sun_zenith = DegToRad(90.0) - altitude;
530
532          /* Compute the inputs for the calculation of the sky distribution */
533          
534          if (input == 0)                                 /* XXX never used */
# Line 580 | Line 581 | ComputeSky(float *parr)
581          /* Normalization coefficient */
582          norm_diff_illum = diff_illum / norm_diff_illum;
583  
583        /* Calculate relative zenith luminance */
584        zlumin = CalcRelLuminance(sun_zenith, 0.0);
585
586        /* Calculate absolute zenith illuminance */
587        zlumin *= norm_diff_illum;
588
584          /* Apply to sky patches to get absolute radiance values */
585          for (i = 1; i < nskypatch; i++) {
586 <                scalecolor(parr+3*i, zlumin*(1./WHTEFFICACY));
586 >                scalecolor(parr+3*i, norm_diff_illum*(1./WHTEFFICACY));
587                  multcolor(parr+3*i, skycolor);
588          }
589   }
# Line 943 | Line 938 | double CalcRelHorzIllum( float *parr )
938          double rh_illum = 0.0;  /* Relative horizontal illuminance */
939  
940          for (i = 1; i < nskypatch; i++)
941 <                rh_illum += parr[3*i+1] * rh_cos(i);
941 >                rh_illum += parr[3*i+1] * rh_cos(i) * rh_dom[i];
942  
943 <        return rh_illum * (2.0 * PI / (nskypatch-1));
943 >        return rh_illum;
944   }
945  
946   /* Calculate earth orbit eccentricity correction factor */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines