18 |
|
#include "random.h" |
19 |
|
#include "paths.h" |
20 |
|
#include "view.h" |
21 |
+ |
#include "pmapray.h" |
22 |
|
|
23 |
|
/* persistent processes define */ |
24 |
|
#ifdef F_SETLKW |
63 |
|
#define check(ol,al) if (argv[i][ol] || \ |
64 |
|
badarg(argc-i-1,argv+i+1,al)) \ |
65 |
|
goto badopt |
66 |
< |
#define bool(olen,var) switch (argv[i][olen]) { \ |
66 |
> |
#define check_bool(olen,var) switch (argv[i][olen]) { \ |
67 |
|
case '\0': var = !var; break; \ |
68 |
|
case 'y': case 'Y': case 't': case 'T': \ |
69 |
|
case '+': case '1': var = 1; break; \ |
209 |
|
#endif |
210 |
|
case 'w': /* warnings */ |
211 |
|
rval = erract[WARNING].pf != NULL; |
212 |
< |
bool(2,rval); |
212 |
> |
check_bool(2,rval); |
213 |
|
if (rval) erract[WARNING].pf = wputs; |
214 |
|
else erract[WARNING].pf = NULL; |
215 |
|
break; |
286 |
|
#endif |
287 |
|
if (outfile != NULL) |
288 |
|
openheader(); |
288 |
– |
#ifdef _WIN32 |
289 |
|
SET_FILE_BINARY(stdout); |
290 |
|
if (octname == NULL) |
291 |
|
SET_FILE_BINARY(stdin); |
292 |
– |
#endif |
292 |
|
readoct(octname, loadflags, &thescene, NULL); |
293 |
|
nsceneobjs = nobjects; |
294 |
|
|
296 |
|
printargs(i, argv, stdout); |
297 |
|
printf("SOFTWARE= %s\n", VersionID); |
298 |
|
} |
299 |
+ |
|
300 |
+ |
ray_init_pmap(); /* PMAP: set up & load photon maps */ |
301 |
|
|
302 |
|
marksources(); /* find and mark sources */ |
303 |
|
|
304 |
|
setambient(); /* initialize ambient calculation */ |
305 |
+ |
|
306 |
+ |
fflush(stdout); /* in case we're duplicating header */ |
307 |
|
|
308 |
|
#ifdef PERSIST |
309 |
|
if (persist) { |
307 |
– |
fflush(stdout); |
310 |
|
if (outfile == NULL) { /* reconnect stdout */ |
311 |
|
dup2(duped1, fileno(stdout)); |
312 |
|
close(duped1); |
358 |
|
goto runagain; |
359 |
|
} |
360 |
|
#endif |
361 |
+ |
|
362 |
+ |
|
363 |
+ |
ray_done_pmap(); /* PMAP: free photon maps */ |
364 |
+ |
|
365 |
|
quit(0); |
366 |
|
|
367 |
|
badopt: |
370 |
|
return 1; /* pro forma return */ |
371 |
|
|
372 |
|
#undef check |
373 |
< |
#undef bool |
373 |
> |
#undef check_bool |
374 |
|
} |
375 |
|
|
376 |
|
|