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

Comparing ray/src/gen/gensky.c (file contents):
Revision 2.7 by greg, Fri Oct 2 16:11:53 1992 UTC vs.
Revision 2.10 by greg, Fri Jun 4 14:30:24 1993 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1986 Regents of the University of California */
1 > /* Copyright (c) 1992 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 19 | Line 19 | static char SCCSid[] = "$SunId$ LBL";
19  
20   #include  "color.h"
21  
22 #ifndef atof
23 extern double  atof();
24 #endif
22   extern char  *strcpy(), *strcat(), *malloc();
23   extern double  stadj(), sdec(), sazi(), salt();
24  
# Line 49 | Line 46 | double  gprefl = 0.2;
46   double  sundir[3];
47   double  groundbr;
48   double  F2;
49 < double  solarbr;
49 > double  solarbr = -1.0;
50  
51   char  *progname;
52   char  errmsg[128];
# Line 91 | Line 88 | char  *argv[];
88                                  cloudy = 0;
89                                  dosun = argv[i][0] == '+';
90                                  break;
91 +                        case 'r':
92 +                                solarbr = atof(argv[++i]);
93 +                                break;
94                          case 'c':
95                                  cloudy = argv[i][0] == '+' ? 2 : 1;
96                                  dosun = 0;
# Line 148 | Line 148 | computesky()                   /* compute sky parameters */
148                  altitude = salt(sd, st);
149                  azimuth = sazi(sd, st);
150          }
151 +        if (!cloudy && altitude > 87.*PI/180.) {
152 +                fprintf(stderr,
153 + "%s: warning - sun too close to zenith, reducing altitude to 87 degrees\n",
154 +                                progname);
155 +                printf(
156 + "# warning - sun too close to zenith, reducing altitude to 87 degrees\n");
157 +                altitude = 87.*PI/180.;
158 +        }
159          sundir[0] = -sin(azimuth)*cos(altitude);
160          sundir[1] = -cos(azimuth)*cos(altitude);
161          sundir[2] = sin(altitude);
# Line 175 | Line 183 | computesky()                   /* compute sky parameters */
183                                  0.45*sundir[2]*sundir[2]);
184                  groundbr = zenithbr*normsc(altitude)/F2/PI;
185                  printf("# Ground ambient level: %f\n", groundbr);
186 <                if (sundir[2] > 0.0) {
187 <                        if (sundir[2] > .16)
188 <                                solarbr = (1.5e9/SUNEFFICACY) *
189 <                                        (1.147 - .147/sundir[2]);
182 <                        else
183 <                                solarbr = 1.5e9/SUNEFFICACY*(1.147-.147/.16);
186 >                if (sundir[2] > 0.0 && solarbr != 0.0) {
187 >                        if (solarbr < 0.0)
188 >                                solarbr = 1.5e9/SUNEFFICACY *
189 >                                (1.147 - .147/(sundir[2]>.16?sundir[2]:.16));
190                          groundbr += solarbr*6e-5*sundir[2]/PI;
191                  } else
192                          dosun = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines