81 |
|
|
82 |
|
/* Include files */ |
83 |
|
#define _USE_MATH_DEFINES |
84 |
– |
#include <stdio.h> |
84 |
|
#include <stdlib.h> |
86 |
– |
#include <string.h> |
85 |
|
#include <ctype.h> |
86 |
+ |
#include "platform.h" |
87 |
|
#include "rtmath.h" |
88 |
|
#include "rtio.h" |
90 |
– |
#include "resolu.h" |
91 |
– |
#include "platform.h" |
89 |
|
#include "color.h" |
90 |
< |
#include "resolu.h" |
90 |
> |
#include "sun.h" |
91 |
|
|
92 |
|
char *progname; /* Program name */ |
93 |
|
char errmsg[128]; /* Error message buffer */ |
252 |
|
#define NSUNPATCH 4 /* max. # patches to spread sun into */ |
253 |
|
#endif |
254 |
|
|
258 |
– |
extern int jdate(int month, int day); |
259 |
– |
extern double stadj(int jd); |
260 |
– |
extern double sdec(int jd); |
261 |
– |
extern double salt(double sd, double st); |
262 |
– |
extern double sazi(double sd, double st); |
263 |
– |
/* sun calculation constants */ |
264 |
– |
extern double s_latitude; |
265 |
– |
extern double s_longitude; |
266 |
– |
extern double s_meridian; |
267 |
– |
|
255 |
|
int nsuns = NSUNPATCH; /* number of sun patches to use */ |
256 |
|
double fixed_sun_sa = -1; /* fixed solid angle per sun? */ |
257 |
|
|
667 |
|
diff_illum = diff_irrad * WHTEFFICACY; |
668 |
|
dir_illum = dir_irrad * WHTEFFICACY; |
669 |
|
} |
683 |
– |
|
684 |
– |
if (bright(skycolor) <= 1e-4) { /* 0 sky component? */ |
685 |
– |
memset(parr, 0, sizeof(float)*3*nskypatch); |
686 |
– |
return; |
687 |
– |
} |
670 |
|
/* Compute ground radiance (include solar contribution if any) */ |
671 |
|
parr[0] = diff_illum; |
672 |
|
if (altitude > 0) |
674 |
|
parr[2] = parr[1] = parr[0] *= (1./PI/WHTEFFICACY); |
675 |
|
multcolor(parr, grefl); |
676 |
|
|
677 |
+ |
if (bright(skycolor) <= 1e-4) { /* 0 sky component? */ |
678 |
+ |
memset(parr+3, 0, sizeof(float)*3*(nskypatch-1)); |
679 |
+ |
return; |
680 |
+ |
} |
681 |
|
/* Calculate Perez sky model parameters */ |
682 |
|
CalcPerezParam(sun_zenith, sky_clearness, sky_brightness, index); |
683 |
|
|