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.1 by greg, Fri Jan 18 01:12:59 2013 UTC vs.
Revision 2.2 by greg, Fri Jan 18 19:56:03 2013 UTC

# Line 358 | Line 358 | main(int argc, char *argv[])
358                                          progname);
359          }
360                                          /* read weather tape header */
361 <        if (scanf("place %[^\n]\n", buf) != 1)
361 >        if (scanf("place %[^\r\n] ", buf) != 1)
362                  goto fmterr;
363          if (scanf("latitude %lf\n", &s_latitude) != 1)
364                  goto fmterr;
# Line 394 | Line 394 | main(int argc, char *argv[])
394                  fprintf(stderr, "%s: %d sky patches per time step\n",
395                                  progname, nskypatch);
396          }
397 +                                        /* convert quantities to radians */
398 +        s_latitude = DegToRad(s_latitude);
399 +        s_longitude = DegToRad(s_longitude);
400 +        s_meridian = DegToRad(s_meridian);
401                                          /* process each time step in tape */
402          while (scanf("%d %d %lf %lf %lf\n", &mo, &da, &hr, &dir, &dif) == 5) {
403                  double          sda, sta;
# Line 412 | Line 416 | main(int argc, char *argv[])
416                  sda = sdec(julian_date);
417                  sta = stadj(julian_date);
418                  altitude = salt(sda, hr+sta);
419 <                azimuth = sazi(sda, hr+sta);
419 >                azimuth = sazi(sda, hr+sta) + PI;
420                                          /* convert measured values */
421                  if (dir_is_horiz && altitude > 0.)
422                          dir /= sin(altitude);
# Line 456 | Line 460 | main(int argc, char *argv[])
460                                                  mtx_data[mtx_offset+2]);
461                                  mtx_offset += 3*nskypatch;
462                          }
463 <                        fputc('\n', stdout);
463 >                        if (ntsteps > 1)
464 >                                fputc('\n', stdout);
465                          break;
466                  case 'f':
467                          for (j = 0; j < ntsteps; j++) {
# Line 508 | Line 513 | ComputeSky(float *parr)
513          double norm_diff_illum;         /* Normalized diffuse illuimnance */
514          double zlumin;                  /* Zenith luminance */
515          int i;
511
512        if (bright(skycolor) <= 1e-4) {                 /* 0 sky component? */
513                memset(parr, 0, sizeof(float)*3*nskypatch);
514                return;
515        }
516          
517          /* Calculate atmospheric precipitable water content */
518          apwc = CalcPrecipWater(dew_point);
# Line 553 | Line 553 | ComputeSky(float *parr)
553                  index = CalcSkyParamFromIllum();
554          }
555  
556 +        if (bright(skycolor) <= 1e-4) {                 /* 0 sky component? */
557 +                memset(parr, 0, sizeof(float)*3*nskypatch);
558 +                return;
559 +        }
560          /* Compute ground radiance (include solar contribution if any) */
561          parr[0] = diff_illum * (1./PI/WHTEFFICACY);
562          if (altitude > 0)
# Line 620 | Line 624 | AddDirect(float *parr)
624          for (i = 4; i--; )
625                  wtot += wta[i] = 1./(1.002 - near_dprod[i]);
626                                          /* add to nearest patch radiances */
627 <        for (i = 4; i--; )
628 <                parr[near_patch[i]] += wta[i] * dir_illum /
629 <                                        (wtot * rh_dom[near_patch[i]]);
627 >        for (i = 4; i--; ) {
628 >                float   *pdest = parr + 3*near_patch[i];
629 >                float   val_add = wta[i] * dir_illum /
630 >                                (WHTEFFICACY * wtot * rh_dom[near_patch[i]]);
631 >                *pdest++ += val_add;
632 >                *pdest++ += val_add;
633 >                *pdest++ += val_add;
634 >        }
635   }
636  
637   /* Initialize Reinhart sky patch positions (GW) */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines