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 1.1 by greg, Thu Feb 2 11:16:29 1989 UTC vs.
Revision 2.2 by greg, Thu Dec 19 15:09:28 1991 UTC

# Line 17 | Line 17 | static char SCCSid[] = "$SunId$ LBL";
17  
18   #include  <math.h>
19  
20 + #include  "color.h"
21  
22 + #ifndef atof
23 + extern double  atof();
24 + #endif
25   extern char  *strcpy(), *strcat(), *malloc();
26   extern double  stadj(), sdec(), sazi(), salt();
27  
# Line 53 | Line 57 | main(argc, argv)
57   int  argc;
58   char  *argv[];
59   {
60 <        extern double  atof();
60 >        extern double  fabs();
61          int  i;
62  
63          progname = argv[0];
# Line 102 | Line 106 | char  *argv[];
106                  else
107                          userror("bad option");
108  
109 +        if (fabs(s_meridian-s_longitude) > 30*PI/180)
110 +                fprintf(stderr,
111 +        "%s: warning: %.1f hours btwn. standard meridian and longitude\n",
112 +                        progname, (s_longitude-s_meridian)*12/PI);
113 +
114          printhead(argc, argv);
115  
116          computesky();
# Line 128 | Line 137 | computesky()                   /* compute sky parameters */
137          if (zenithbr <= 0.0)
138                  if (cloudy) {
139                          zenithbr = 8.6*sundir[2] + .123;
140 <                        zenithbr *= 1000.0/683.0;
140 >                        zenithbr *= 1000.0/SKYEFFICACY;
141                  } else {
142                          zenithbr = (1.376*turbidity-1.81)*tan(altitude)+0.38;
143 <                        zenithbr *= 1000.0/683.0;
143 >                        zenithbr *= 1000.0/SKYEFFICACY;
144                  }
145 +        if (zenithbr < 0.0)
146 +                zenithbr = 0.0;
147                                          /* Compute horizontal radiance */
148          if (cloudy) {
149                  groundbr = zenithbr*0.777778;
# Line 144 | Line 155 | computesky()                   /* compute sky parameters */
155                  printf("# Ground ambient level: %f\n", groundbr);
156                  if (sundir[2] > 0.0) {
157                          if (sundir[2] > .16)
158 <                                solarbr = 2.47e6 - 3.15e5/sundir[2];
158 >                                solarbr = (1.5e9/SUNEFFICACY) *
159 >                                        (1.147 - .147/sundir[2]);
160                          else
161 <                                solarbr = 5e5;
161 >                                solarbr = 1.5e9/SUNEFFICACY*(1.147-.147/.16);
162                          groundbr += solarbr*6e-5*sundir[2]/PI;
163                  } else
164                          dosun = 0;
# Line 157 | Line 169 | computesky()                   /* compute sky parameters */
169  
170   printsky()                      /* print out sky */
171   {
160        register int  i;
161
172          if (dosun) {
173                  printf("\nvoid light solar\n");
174                  printf("0\n0\n");
175 <                printf("3 %f %f %f\n", solarbr, solarbr, solarbr);
175 >                printf("3 %.2e %.2e %.2e\n", solarbr, solarbr, solarbr);
176                  printf("\nsolar source sun\n");
177                  printf("0\n0\n");
178                  printf("4 %f %f %f 0.5\n", sundir[0], sundir[1], sundir[2]);
# Line 172 | Line 182 | printsky()                     /* print out sky */
182          printf("2 skybright skybright.cal\n");
183          printf("0\n");
184          if (cloudy)
185 <                printf("3 1 %f %f\n", zenithbr, groundbr);
185 >                printf("3 1 %.2e %.2e\n", zenithbr, groundbr);
186          else
187 <                printf("7 -1 %f %f %f %f %f %f\n", zenithbr, groundbr, F2,
188 <                                sundir[0], sundir[1], sundir[2]);
187 >                printf("7 -1 %.2e %.2e %.2e %f %f %f\n", zenithbr, groundbr,
188 >                                F2, sundir[0], sundir[1], sundir[2]);
189   }
190  
191  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines