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