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 |
55 |
|
static void onsig(int signo); |
56 |
|
static void sigdie(int signo, char *msg); |
57 |
|
static void printdefaults(void); |
58 |
+ |
/* rpict additional features */ |
59 |
+ |
#ifdef PERSIST |
60 |
+ |
#define RPICT_FEATURES "Persist\nParallelPersist\n" \ |
61 |
+ |
"Recovery\nIrradianceCalc\nViewTypes=v,l,a,h,s,c\n" \ |
62 |
+ |
"HessianAmbientCache\nAmbientAveraging\nAmbientValueSharing\n" \ |
63 |
+ |
"PixelJitter\nPixelSampling\nPixelMotion\nPixelDepthOfField\n" \ |
64 |
+ |
"SmallSourceDrawing\nViewSequence\nProgressReporting\n" \ |
65 |
+ |
"AdaptiveShadowTesting\nOutputs=v,l\n" |
66 |
+ |
#else |
67 |
+ |
#define RPICT_FEATURES "Recovery\nIrradianceCalc\nViewTypes=v,l,a,h,s,c\n" \ |
68 |
+ |
"HessianAmbientCache\nAmbientAveraging\nAmbientValueSharing\n" \ |
69 |
+ |
"PixelJitter\nPixelSampling\nPixelMotion\nPixelDepthOfField\n" \ |
70 |
+ |
"SmallSourceDrawing\nViewSequence\nProgressReporting\n" \ |
71 |
+ |
"AdaptiveShadowTesting\nOutputs=v,l\n" |
72 |
+ |
#endif |
73 |
|
|
74 |
|
|
75 |
|
int |
78 |
|
#define check(ol,al) if (argv[i][ol] || \ |
79 |
|
badarg(argc-i-1,argv+i+1,al)) \ |
80 |
|
goto badopt |
81 |
< |
#define bool(olen,var) switch (argv[i][olen]) { \ |
81 |
> |
#define check_bool(olen,var) switch (argv[i][olen]) { \ |
82 |
|
case '\0': var = !var; break; \ |
83 |
|
case 'y': case 'Y': case 't': case 'T': \ |
84 |
|
case '+': case '1': var = 1; break; \ |
92 |
|
int loadflags = ~IO_FILES; |
93 |
|
int seqstart = 0; |
94 |
|
int persist = 0; |
95 |
< |
int duped1; |
95 |
> |
int duped1 = -1; |
96 |
|
int rval; |
97 |
|
int i; |
98 |
|
/* record start time */ |
99 |
|
tstart = time((time_t *)NULL); |
100 |
|
/* global program name */ |
101 |
|
progname = argv[0] = fixargv0(argv[0]); |
102 |
+ |
/* feature check only? */ |
103 |
+ |
strcat(RFeatureList, RPICT_FEATURES); |
104 |
+ |
if (!strcmp(argv[1], "-features")) |
105 |
+ |
return feature_status(argc-2, argv+2); |
106 |
|
/* option city */ |
107 |
|
for (i = 1; i < argc; i++) { |
108 |
|
/* expand arguments */ |
228 |
|
#endif |
229 |
|
case 'w': /* warnings */ |
230 |
|
rval = erract[WARNING].pf != NULL; |
231 |
< |
bool(2,rval); |
231 |
> |
check_bool(2,rval); |
232 |
|
if (rval) erract[WARNING].pf = wputs; |
233 |
|
else erract[WARNING].pf = NULL; |
234 |
|
break; |
305 |
|
#endif |
306 |
|
if (outfile != NULL) |
307 |
|
openheader(); |
288 |
– |
#ifdef _WIN32 |
308 |
|
SET_FILE_BINARY(stdout); |
309 |
|
if (octname == NULL) |
310 |
|
SET_FILE_BINARY(stdin); |
292 |
– |
#endif |
311 |
|
readoct(octname, loadflags, &thescene, NULL); |
312 |
|
nsceneobjs = nobjects; |
313 |
|
|
315 |
|
printargs(i, argv, stdout); |
316 |
|
printf("SOFTWARE= %s\n", VersionID); |
317 |
|
} |
318 |
+ |
|
319 |
+ |
ray_init_pmap(); /* PMAP: set up & load photon maps */ |
320 |
|
|
321 |
|
marksources(); /* find and mark sources */ |
322 |
|
|
323 |
|
setambient(); /* initialize ambient calculation */ |
324 |
+ |
|
325 |
+ |
fflush(stdout); /* in case we're duplicating header */ |
326 |
|
|
327 |
|
#ifdef PERSIST |
328 |
|
if (persist) { |
307 |
– |
fflush(stdout); |
329 |
|
if (outfile == NULL) { /* reconnect stdout */ |
330 |
|
dup2(duped1, fileno(stdout)); |
331 |
|
close(duped1); |
377 |
|
goto runagain; |
378 |
|
} |
379 |
|
#endif |
380 |
+ |
|
381 |
+ |
|
382 |
+ |
ray_done_pmap(); /* PMAP: free photon maps */ |
383 |
+ |
|
384 |
|
quit(0); |
385 |
|
|
386 |
|
badopt: |
389 |
|
return 1; /* pro forma return */ |
390 |
|
|
391 |
|
#undef check |
392 |
< |
#undef bool |
392 |
> |
#undef check_bool |
393 |
|
} |
394 |
|
|
395 |
|
|
406 |
|
|
407 |
|
void |
408 |
|
eputs( /* put string to stderr */ |
409 |
< |
register char *s |
409 |
> |
char *s |
410 |
|
) |
411 |
|
{ |
412 |
|
static int midline = 0; |