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.10 by greg, Thu Jan 9 17:25:37 2025 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 35 | Line 37 | double  mblur = 0.;                    /* motion blur parameter (unused
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  
# Line 54 | Line 56 | static RenderDataType rpiece(char *pout, RenderDataTyp
56                  "AdaptiveShadowTesting\nOutputs=v,l\n" \
57                  "OutputCS=RGB,XYZ,prims,spec\n"
58  
59 <
59 > // Exit program
60   void
61   quit(int code)                          /* quit program */
62   {
63 <        exit(code);
63 >        exit(code);                     // don't bother to free data structs
64   }
65  
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  
81   int
82   main(int  argc, char  *argv[])
# Line 88 | Line 104 | main(int  argc, char  *argv[])
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 */
# Line 315 | Line 333 | main(int  argc, char  *argv[])
333                                          // render tiles
334          dtype = rpiece(outfile, dtype, zfile);
335  
336 <        quit(dtype==RDTnone);           // clean up and exit
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:
343          sprintf(errmsg, "command line error at '%s'", argv[i]);
344          error(USER, errmsg);
# Line 332 | Line 354 | wputs(                         /* warning output function */
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;
# Line 499 | Line 523 | children_finished()
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
# Line 604 | Line 629 | rpiece(char *pout, RenderDataType dt, char *zout)
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
# Line 634 | Line 659 | rpiece(char *pout, RenderDataType dt, char *zout)
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 <        }
665 <        if (RDTdepthT(dt) == RDTdshort) {
641 <                if (newOutput)
664 >                fflush(pdfp[0]);
665 >                if (RDTdepthT(dt) == RDTdshort) {
666                          fprtresolu(hresolu, vresolu, pdfp[1]);
667 <                else if (!fscnresolu(&hvdim[0], &hvdim[1], pdfp[1]) ||
668 <                                (hvdim[0] != hresolu) | (hvdim[1] != vresolu))
669 <                        error(USER, "mismatched depth file resolution");
670 <        }
667 >                        fflush(pdfp[1]);
668 >                }
669 >        } else if (RDTdepthT(dt) == RDTdshort &&
670 >                        (!fscnresolu(&hvdim[0], &hvdim[1], pdfp[1]) ||
671 >                                (hvdim[0] != hresolu) | (hvdim[1] != vresolu)))
672 >                error(USER, "mismatched depth file resolution");
673                                                  // prepare (flat) pixel buffer
674          const long      pdata_beg = ftell(pdfp[0]);
675          const size_t    pixSiz = (RDTcolorT(dt)==RDTrgbe)|(RDTcolorT(dt)==RDTxyze) ? sizeof(COLR)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines