37 |
|
|
38 |
|
double dblur = 0.; /* depth-of-field blur parameter */ |
39 |
|
|
40 |
< |
int nproc = 1; /* number of processes to run */ |
40 |
> |
int nproc = 1; /* number of processes to run (-1 in child) */ |
41 |
|
|
42 |
|
RpictSimulManager myRPmanager; // global simulation manager |
43 |
|
|
56 |
|
"AdaptiveShadowTesting\nOutputs=v,l\n" \ |
57 |
|
"OutputCS=RGB,XYZ,prims,spec\n" |
58 |
|
|
59 |
< |
|
60 |
< |
// We could call myRPmanager.Cleanup() but why waste time |
61 |
< |
// unwinding data structures when the whole frame is going away? |
59 |
> |
// Exit program |
60 |
|
void |
61 |
|
quit(int code) /* quit program */ |
62 |
|
{ |
63 |
< |
ambsync(); // flush ambient cache |
63 |
> |
exit(code); // don't bother to free data structs |
64 |
> |
} |
65 |
|
|
66 |
< |
ray_done_pmap(); /* PMAP: free photon maps */ |
67 |
< |
|
68 |
< |
exit(code); |
66 |
> |
/* Set default options */ |
67 |
> |
static void |
68 |
> |
default_options(void) |
69 |
> |
{ |
70 |
> |
shadthresh = .05; |
71 |
> |
shadcert = .5; |
72 |
> |
srcsizerat = .25; |
73 |
> |
directrelay = 1; |
74 |
> |
ambacc = 0.2; |
75 |
> |
ambres = 64; |
76 |
> |
ambdiv = 512; |
77 |
> |
ambssamp = 128; |
78 |
> |
maxdepth = 7; |
79 |
|
} |
80 |
|
|
72 |
– |
|
81 |
|
int |
82 |
|
main(int argc, char *argv[]) |
83 |
|
{ |
104 |
|
strcat(RFeatureList, RXPIECE_FEATURES); |
105 |
|
if (argc > 1 && !strcmp(argv[1], "-features")) |
106 |
|
return feature_status(argc-2, argv+2); |
107 |
+ |
/* set defaults */ |
108 |
+ |
default_options(); |
109 |
|
/* option city */ |
110 |
|
for (i = 1; i < argc; i++) { |
111 |
|
/* expand arguments */ |
333 |
|
// render tiles |
334 |
|
dtype = rpiece(outfile, dtype, zfile); |
335 |
|
|
336 |
+ |
ambsync(); // flush ambient cache |
337 |
+ |
|
338 |
+ |
ray_done_pmap(); /* PMAP: free photon maps */ |
339 |
+ |
|
340 |
|
quit(dtype==RDTnone); // status is 1 on failure |
341 |
|
|
342 |
|
badopt: |
354 |
|
const char *s |
355 |
|
) |
356 |
|
{ |
357 |
+ |
if (!erract[WARNING].pf) |
358 |
+ |
return; // warnings were disabled! |
359 |
|
int lasterrno = errno; |
360 |
|
eputs(s); |
361 |
|
errno = lasterrno; |
523 |
|
|
524 |
|
if (cpid == 0) { // children render tiles |
525 |
|
sleep(nproc - cnt); // avoid race conditions |
526 |
+ |
nproc = -1; // flag as child |
527 |
|
return false; |
528 |
|
} |
529 |
|
cow_doneshare(); // parent frees memory and waits |
629 |
|
} else { |
630 |
|
dt = myRPmanager.ReopenOutput(pdfp, pout, zout); |
631 |
|
if (dt == RDTnone) |
632 |
< |
quit(1); |
632 |
> |
return RDTnone; |
633 |
|
if (!fscnresolu(&hresolu, &vresolu, pdfp[0])) |
634 |
|
error(USER, "missing picture resolution"); |
635 |
|
pixaspect = .0; // need to leave this as is |
659 |
|
myRPmanager.AddHeader(buf); |
660 |
|
dt = myRPmanager.NewOutput(pdfp, pout, dt, zout); |
661 |
|
if (dt == RDTnone) |
662 |
< |
quit(1); |
662 |
> |
return RDTnone; |
663 |
|
fprtresolu(hresolu, vresolu, pdfp[0]); |
664 |
|
fflush(pdfp[0]); |
665 |
|
if (RDTdepthT(dt) == RDTdshort) { |