40 |
|
|
41 |
|
struct illum *indirect; /* array of indirect illuminances */ |
42 |
|
|
43 |
+ |
long npixinvw; /* number of pixels in view */ |
44 |
+ |
long npixmiss; /* number of pixels missed */ |
45 |
|
|
46 |
+ |
|
47 |
|
main(argc, argv) |
48 |
|
int argc; |
49 |
|
char *argv[]; |
226 |
|
indirect = (struct illum *)calloc(nglardirs, sizeof(struct illum)); |
227 |
|
if (indirect == NULL) |
228 |
|
memerr("indirect illuminances"); |
229 |
+ |
npixinvw = npixmiss = 0L; |
230 |
|
copystruct(&leftview, &ourview); |
231 |
|
copystruct(&rightview, &ourview); |
232 |
|
spinvector(leftview.vdir, ourview.vdir, ourview.vup, maxtheta); |
280 |
|
close_pict(); |
281 |
|
if (octree != NULL) |
282 |
|
done_rtrace(); |
283 |
+ |
if (npixinvw < 100*npixmiss) |
284 |
+ |
fprintf(stderr, "%s: warning -- missing %ld%% of samples\n", |
285 |
+ |
progname, 100L*npixmiss/npixinvw); |
286 |
|
} |
287 |
|
|
288 |
|
|
294 |
|
|
295 |
|
if (x <= -hlim) /* left region */ |
296 |
|
return(viewray(org, vd, &leftview, |
297 |
< |
(x+hlim)/(2.*sampdens)+.5, |
298 |
< |
y/(2.*sampdens)+.5)); |
297 |
> |
(double)(x+hlim)/(2*sampdens)+.5, |
298 |
> |
(double)y/(2*sampdens)+.5)); |
299 |
|
if (x >= hlim) /* right region */ |
300 |
|
return(viewray(org, vd, &rightview, |
301 |
< |
(x-hlim)/(2.*sampdens)+.5, |
302 |
< |
y/(2.*sampdens)+.5)); |
301 |
> |
(double)(x-hlim)/(2*sampdens)+.5, |
302 |
> |
(double)y/(2*sampdens)+.5)); |
303 |
|
/* central region */ |
304 |
< |
if (viewray(org, vd, &ourview, .5, y/(2.*sampdens)+.5) < 0) |
304 |
> |
if (viewray(org, vd, &ourview, .5, (double)y/(2*sampdens)+.5) < 0) |
305 |
|
return(-1); |
306 |
|
spinvector(vd, vd, ourview.vup, h_theta(x)); |
307 |
|
return(0); |
335 |
|
|
336 |
|
printf("BEGIN indirect illuminance\n"); |
337 |
|
for (i = 0; i < nglardirs; i++) |
338 |
< |
printf("\t%.0f\t%f\n", (180.0/PI)*indirect[i].theta, |
339 |
< |
PI * indirect[i].sum / (double)indirect[i].n); |
338 |
> |
if (indirect[i].n > FTINY) |
339 |
> |
printf("\t%.0f\t%f\n", (180.0/PI)*indirect[i].theta, |
340 |
> |
PI * indirect[i].sum / indirect[i].n); |
341 |
|
printf("END indirect illuminance\n"); |
342 |
|
} |