20 |
|
* All values default to ascii representation of real |
21 |
|
* numbers. Binary representations can be selected |
22 |
|
* with '-ff' for float or '-fd' for double. By default, |
23 |
< |
* radiance is computed. The '-i' option indicates that |
23 |
> |
* radiance is computed. The '-i' or '-I' options indicate that |
24 |
|
* irradiance values are desired. |
25 |
|
*/ |
26 |
|
|
30 |
|
|
31 |
|
#include "otypes.h" |
32 |
|
|
33 |
+ |
int dimlist[MAXDIM]; /* sampling dimensions */ |
34 |
+ |
int ndims = 0; /* number of sampling dimensions */ |
35 |
+ |
int samplendx = 0; /* index for this sample */ |
36 |
+ |
|
37 |
+ |
int imm_irrad = 0; /* compute immediate irradiance? */ |
38 |
+ |
|
39 |
|
int inform = 'a'; /* input format */ |
40 |
|
int outform = 'a'; /* output format */ |
41 |
|
char *outvals = "v"; /* output specification */ |
59 |
|
char *amblist[128]; /* ambient include/exclude list */ |
60 |
|
int ambincl = -1; /* include == 1, exclude == 0 */ |
61 |
|
|
62 |
+ |
extern OBJREC Lamb; /* a Lambertian surface */ |
63 |
+ |
|
64 |
|
static RAY thisray; /* for our convenience */ |
65 |
|
|
66 |
|
static int oputo(), oputd(), oputv(), oputl(), |
110 |
|
fflush(stdout); |
111 |
|
continue; |
112 |
|
} |
113 |
+ |
samplendx++; |
114 |
|
/* compute and print */ |
115 |
< |
if (outvals[0] == 'i') |
115 |
> |
if (imm_irrad) |
116 |
|
irrad(orig, direc); |
117 |
|
else |
118 |
< |
radiance(orig, direc); |
118 |
> |
traceray(orig, direc); |
119 |
|
/* flush if time */ |
120 |
|
if (--nextflush == 0) { |
121 |
|
fflush(stdout); |
181 |
|
} |
182 |
|
|
183 |
|
|
184 |
< |
radiance(org, dir) /* compute radiance value */ |
184 |
> |
traceray(org, dir) /* compute and print ray value(s) */ |
185 |
|
FVECT org, dir; |
186 |
|
{ |
187 |
|
register int (**tp)(); |
203 |
|
} |
204 |
|
|
205 |
|
|
206 |
< |
irrad(org, dir) /* compute irradiance value */ |
206 |
> |
irrad(org, dir) /* compute immediate irradiance value */ |
207 |
|
FVECT org, dir; |
208 |
|
{ |
200 |
– |
static double Lambfa[5] = {PI, PI, PI, 0.0, 0.0}; |
201 |
– |
static OBJREC Lamb = { |
202 |
– |
OVOID, MAT_PLASTIC, "Lambertian", |
203 |
– |
{0, 5, NULL, Lambfa}, NULL, -1, |
204 |
– |
}; |
209 |
|
register int i; |
210 |
|
|
211 |
|
for (i = 0; i < 3; i++) { |