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.9 by greg, Wed Dec 9 08:32:52 1992 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 49 | Line 49 | double  gprefl = 0.2;
49   double  sundir[3];
50   double  groundbr;
51   double  F2;
52 < double  solarbr;
52 > double  solarbr = -1.0;
53  
54   char  *progname;
55   char  errmsg[128];
# Line 91 | Line 91 | char  *argv[];
91                                  cloudy = 0;
92                                  dosun = argv[i][0] == '+';
93                                  break;
94 +                        case 'r':
95 +                                solarbr = atof(argv[++i]);
96 +                                break;
97                          case 'c':
98                                  cloudy = argv[i][0] == '+' ? 2 : 1;
99                                  dosun = 0;
# Line 148 | Line 151 | computesky()                   /* compute sky parameters */
151                  altitude = salt(sd, st);
152                  azimuth = sazi(sd, st);
153          }
154 +        if (!cloudy && altitude > 87.*PI/180.) {
155 +                fprintf(stderr,
156 + "%s: warning - sun too close to zenith, reducing altitude to 87 degrees\n",
157 +                                progname);
158 +                printf(
159 + "# warning - sun too close to zenith, reducing altitude to 87 degrees\n");
160 +                altitude = 87.*PI/180.;
161 +        }
162          sundir[0] = -sin(azimuth)*cos(altitude);
163          sundir[1] = -cos(azimuth)*cos(altitude);
164          sundir[2] = sin(altitude);
# Line 175 | Line 186 | computesky()                   /* compute sky parameters */
186                                  0.45*sundir[2]*sundir[2]);
187                  groundbr = zenithbr*normsc(altitude)/F2/PI;
188                  printf("# Ground ambient level: %f\n", groundbr);
189 <                if (sundir[2] > 0.0) {
190 <                        if (sundir[2] > .16)
191 <                                solarbr = (1.5e9/SUNEFFICACY) *
192 <                                        (1.147 - .147/sundir[2]);
182 <                        else
183 <                                solarbr = 1.5e9/SUNEFFICACY*(1.147-.147/.16);
189 >                if (sundir[2] > 0.0 && solarbr != 0.0) {
190 >                        if (solarbr < 0.0)
191 >                                solarbr = 1.5e9/SUNEFFICACY *
192 >                                (1.147 - .147/(sundir[2]>.16?sundir[2]:.16));
193                          groundbr += solarbr*6e-5*sundir[2]/PI;
194                  } else
195                          dosun = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines