ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/rxpiece.cpp
(Generate patch)

Comparing ray/src/rt/rxpiece.cpp (file contents):
Revision 2.4 by greg, Tue Sep 17 02:24:18 2024 UTC vs.
Revision 2.5 by greg, Tue Sep 17 16:29:09 2024 UTC

# Line 14 | Line 14 | static const char      RCSid[] = "$Id$";
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] */
# Line 55 | Line 57 | static RenderDataType rpiece(char *pout, RenderDataTyp
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  
# Line 315 | Line 323 | main(int  argc, char  *argv[])
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]);
# Line 636 | Line 644 | rpiece(char *pout, RenderDataType dt, char *zout)
644                  if (dt == RDTnone)
645                          quit(1);
646                  fprtresolu(hresolu, vresolu, pdfp[0]);
647 <        }
648 <        if (RDTdepthT(dt) == RDTdshort) {
641 <                if (newOutput)
647 >                fflush(pdfp[0]);
648 >                if (RDTdepthT(dt) == RDTdshort) {
649                          fprtresolu(hresolu, vresolu, pdfp[1]);
650 <                else if (!fscnresolu(&hvdim[0], &hvdim[1], pdfp[1]) ||
651 <                                (hvdim[0] != hresolu) | (hvdim[1] != vresolu))
652 <                        error(USER, "mismatched depth file resolution");
653 <        }
650 >                        fflush(pdfp[1]);
651 >                }
652 >        } else if (RDTdepthT(dt) == RDTdshort &&
653 >                        (!fscnresolu(&hvdim[0], &hvdim[1], pdfp[1]) ||
654 >                                (hvdim[0] != hresolu) | (hvdim[1] != vresolu)))
655 >                error(USER, "mismatched depth file resolution");
656                                                  // prepare (flat) pixel buffer
657          const long      pdata_beg = ftell(pdfp[0]);
658          const size_t    pixSiz = (RDTcolorT(dt)==RDTrgbe)|(RDTcolorT(dt)==RDTxyze) ? sizeof(COLR)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines