39 |
|
long npixinvw; /* number of pixels in view */ |
40 |
|
long npixmiss; /* number of pixels missed */ |
41 |
|
|
42 |
+ |
static int angcmp(const void *ap1, const void *ap2); |
43 |
+ |
static void init(void); |
44 |
+ |
static void cleanup(void); |
45 |
+ |
static void printsources(void); |
46 |
+ |
static void printillum(void); |
47 |
|
|
48 |
< |
main(argc, argv) |
49 |
< |
int argc; |
50 |
< |
char *argv[]; |
48 |
> |
|
49 |
> |
|
50 |
> |
int |
51 |
> |
main( |
52 |
> |
int argc, |
53 |
> |
char *argv[] |
54 |
> |
) |
55 |
|
{ |
56 |
|
int combine = 1; |
57 |
|
int gotview = 0; |
65 |
|
while ((rval = expandarg(&argc, &argv, i)) > 0) |
66 |
|
; |
67 |
|
if (rval < 0) { |
68 |
< |
fprintf(stderr, "%s: cannot expand '%s'", |
68 |
> |
fprintf(stderr, "%s: cannot expand '%s'\n", |
69 |
|
argv[0], argv[i]); |
70 |
|
exit(1); |
71 |
|
} |
129 |
|
/* FALL THROUGH */ |
130 |
|
case 's': |
131 |
|
case 'P': |
132 |
+ |
case 'n': |
133 |
|
rtargv[rtargc++] = argv[i]; |
134 |
|
rtargv[rtargc++] = argv[++i]; |
135 |
|
break; |
136 |
|
case 'w': |
137 |
+ |
case 'u': |
138 |
+ |
case 'b': |
139 |
|
rtargv[rtargc++] = argv[i]; |
140 |
|
break; |
141 |
|
case 'a': |
146 |
|
} |
147 |
|
rtargv[rtargc++] = argv[++i]; |
148 |
|
break; |
149 |
+ |
case 'm': |
150 |
+ |
rtargv[rtargc++] = argv[i]; |
151 |
+ |
if ((argv[i][2] == 'e') | (argv[i][2] == 'a')) { |
152 |
+ |
rtargv[rtargc++] = argv[++i]; |
153 |
+ |
rtargv[rtargc++] = argv[++i]; |
154 |
+ |
} |
155 |
+ |
rtargv[rtargc++] = argv[++i]; |
156 |
+ |
break; |
157 |
|
default: |
158 |
|
goto userr; |
159 |
|
} |
194 |
|
progname); |
195 |
|
exit(1); |
196 |
|
} |
197 |
< |
copystruct(&ourview, &pictview); |
197 |
> |
ourview = pictview; |
198 |
|
} else if (picture != NULL && !VEQ(ourview.vp, pictview.vp)) { |
199 |
|
fprintf(stderr, "%s: picture must have same viewpoint\n", |
200 |
|
progname); |
241 |
|
} |
242 |
|
|
243 |
|
|
244 |
< |
int |
245 |
< |
angcmp(ap1, ap2) /* compare two angles */ |
246 |
< |
ANGLE *ap1, *ap2; |
244 |
> |
static int |
245 |
> |
angcmp( /* compare two angles */ |
246 |
> |
const void *ap1, |
247 |
> |
const void *ap2 |
248 |
> |
) |
249 |
|
{ |
250 |
|
register int a1, a2; |
251 |
|
|
252 |
< |
a1 = *ap1; |
253 |
< |
a2 = *ap2; |
252 |
> |
a1 = *(ANGLE *)ap1; |
253 |
> |
a2 = *(ANGLE *)ap2; |
254 |
|
if (a1 == a2) { |
255 |
|
fprintf(stderr, "%s: duplicate glare angle (%d)\n", |
256 |
|
progname, a1); |
260 |
|
} |
261 |
|
|
262 |
|
|
263 |
< |
init() /* initialize global variables */ |
263 |
> |
static void |
264 |
> |
init(void) /* initialize global variables */ |
265 |
|
{ |
266 |
|
double d; |
267 |
|
register int i; |
292 |
|
if (indirect == NULL) |
293 |
|
memerr("indirect illuminances"); |
294 |
|
npixinvw = npixmiss = 0L; |
295 |
< |
copystruct(&leftview, &ourview); |
296 |
< |
copystruct(&rightview, &ourview); |
295 |
> |
leftview = ourview; |
296 |
> |
rightview = ourview; |
297 |
|
spinvector(leftview.vdir, ourview.vdir, ourview.vup, maxtheta); |
298 |
|
spinvector(rightview.vdir, ourview.vdir, ourview.vup, -maxtheta); |
299 |
|
setview(&leftview); |
337 |
|
} |
338 |
|
|
339 |
|
|
340 |
< |
cleanup() /* close files, wait for children */ |
340 |
> |
static void |
341 |
> |
cleanup(void) /* close files, wait for children */ |
342 |
|
{ |
343 |
|
if (verbose) |
344 |
|
fprintf(stderr, "%s: cleaning up... \n", progname); |
352 |
|
} |
353 |
|
|
354 |
|
|
355 |
< |
compdir(vd, x, y) /* compute direction for x,y */ |
356 |
< |
FVECT vd; |
357 |
< |
int x, y; |
355 |
> |
extern int |
356 |
> |
compdir( /* compute direction for x,y */ |
357 |
> |
FVECT vd, |
358 |
> |
int x, |
359 |
> |
int y |
360 |
> |
) |
361 |
|
{ |
362 |
|
int hl; |
363 |
|
FVECT org; /* dummy variable */ |
385 |
|
} |
386 |
|
|
387 |
|
|
388 |
< |
double |
389 |
< |
pixsize(x, y) /* return the solid angle of pixel at (x,y) */ |
390 |
< |
int x, y; |
388 |
> |
extern double |
389 |
> |
pixsize( /* return the solid angle of pixel at (x,y) */ |
390 |
> |
int x, |
391 |
> |
int y |
392 |
> |
) |
393 |
|
{ |
394 |
|
register int hl, xo; |
395 |
|
double disc; |
408 |
|
} |
409 |
|
|
410 |
|
|
411 |
< |
memerr(s) /* malloc failure */ |
412 |
< |
char *s; |
411 |
> |
extern void |
412 |
> |
memerr( /* malloc failure */ |
413 |
> |
char *s |
414 |
> |
) |
415 |
|
{ |
416 |
|
fprintf(stderr, "%s: out of memory for %s\n", progname, s); |
417 |
|
exit(1); |
418 |
|
} |
419 |
|
|
420 |
|
|
421 |
< |
printsources() /* print out glare sources */ |
421 |
> |
static void |
422 |
> |
printsources(void) /* print out glare sources */ |
423 |
|
{ |
424 |
|
register struct source *sp; |
425 |
|
|
432 |
|
} |
433 |
|
|
434 |
|
|
435 |
< |
printillum() /* print out indirect illuminances */ |
435 |
> |
static void |
436 |
> |
printillum(void) /* print out indirect illuminances */ |
437 |
|
{ |
438 |
|
register int i; |
439 |
|
|