14 |
|
|
15 |
|
#include "platform.h" |
16 |
|
#include "RpictSimulManager.h" |
17 |
+ |
#include "ambient.h" |
18 |
+ |
#include "pmapray.h" |
19 |
|
#include "random.h" |
20 |
|
|
21 |
|
extern char *progname; /* argv[0] */ |
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? |
62 |
|
void |
63 |
|
quit(int code) /* quit program */ |
64 |
|
{ |
65 |
+ |
ambsync(); // flush ambient cache |
66 |
+ |
|
67 |
+ |
ray_done_pmap(); /* PMAP: free photon maps */ |
68 |
+ |
|
69 |
|
exit(code); |
70 |
|
} |
71 |
|
|
323 |
|
// render tiles |
324 |
|
dtype = rpiece(outfile, dtype, zfile); |
325 |
|
|
326 |
< |
quit(dtype==RDTnone); // clean up and exit |
326 |
> |
quit(dtype==RDTnone); // status is 1 on failure |
327 |
|
|
328 |
|
badopt: |
329 |
|
sprintf(errmsg, "command line error at '%s'", argv[i]); |
340 |
|
const char *s |
341 |
|
) |
342 |
|
{ |
343 |
+ |
if (!erract[WARNING].pf) |
344 |
+ |
return; // warnings were disabled! |
345 |
|
int lasterrno = errno; |
346 |
|
eputs(s); |
347 |
|
errno = lasterrno; |
646 |
|
if (dt == RDTnone) |
647 |
|
quit(1); |
648 |
|
fprtresolu(hresolu, vresolu, pdfp[0]); |
649 |
< |
} |
650 |
< |
if (RDTdepthT(dt) == RDTdshort) { |
641 |
< |
if (newOutput) |
649 |
> |
fflush(pdfp[0]); |
650 |
> |
if (RDTdepthT(dt) == RDTdshort) { |
651 |
|
fprtresolu(hresolu, vresolu, pdfp[1]); |
652 |
< |
else if (!fscnresolu(&hvdim[0], &hvdim[1], pdfp[1]) || |
653 |
< |
(hvdim[0] != hresolu) | (hvdim[1] != vresolu)) |
654 |
< |
error(USER, "mismatched depth file resolution"); |
655 |
< |
} |
652 |
> |
fflush(pdfp[1]); |
653 |
> |
} |
654 |
> |
} else if (RDTdepthT(dt) == RDTdshort && |
655 |
> |
(!fscnresolu(&hvdim[0], &hvdim[1], pdfp[1]) || |
656 |
> |
(hvdim[0] != hresolu) | (hvdim[1] != vresolu))) |
657 |
> |
error(USER, "mismatched depth file resolution"); |
658 |
|
// prepare (flat) pixel buffer |
659 |
|
const long pdata_beg = ftell(pdfp[0]); |
660 |
|
const size_t pixSiz = (RDTcolorT(dt)==RDTrgbe)|(RDTcolorT(dt)==RDTxyze) ? sizeof(COLR) |