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

Comparing ray/src/rt/rpmain.c (file contents):
Revision 2.26 by greg, Mon Feb 6 22:40:21 2023 UTC vs.
Revision 2.37 by greg, Sat Jan 18 03:49:00 2025 UTC

# Line 30 | Line 30 | static const char      RCSid[] = "$Id$";
30   char  *progname;                        /* argv[0] */
31   char  *octname;                         /* octree name */
32   char  *sigerr[NSIG];                    /* signal error messages */
33 char  *shm_boundary = NULL;             /* boundary of shared memory */
33   char  *errfile = NULL;                  /* error output file */
34  
35   extern time_t  time();
# Line 52 | Line 51 | extern double  mblur;                  /* motion blur parameter */
51  
52   extern double  dblur;                   /* depth-of-field blur parameter */
53  
54 + RGBPRIMP  out_prims = stdprims;         /* output color primitives */
55 + static RGBPRIMS  our_prims;             /* private output color primitives */
56 +
57   static void onsig(int signo);
58   static void sigdie(int  signo, char  *msg);
59   static void printdefaults(void);
60                                          /* rpict additional features */
61   #ifdef PERSIST
62   #define RPICT_FEATURES  "Persist\nParallelPersist\n" \
63 +                "ParticipatingMedia=Mist\n" \
64                  "Recovery\nIrradianceCalc\nViewTypes=v,l,a,h,s,c\n" \
65                  "HessianAmbientCache\nAmbientAveraging\nAmbientValueSharing\n" \
66                  "PixelJitter\nPixelSampling\nPixelMotion\nPixelDepthOfField\n" \
67                  "SmallSourceDrawing\nViewSequence\nProgressReporting\n" \
68 <                "AdaptiveShadowTesting\nOutputs=v,l\n"
68 >                "AdaptiveShadowTesting\nOutputs=v,l\n" \
69 >                "OutputCS=RGB,XYZ,prims\n"
70   #else
71   #define RPICT_FEATURES  "Recovery\nIrradianceCalc\nViewTypes=v,l,a,h,s,c\n" \
72 +                "ParticipatingMedia=Mist\n" \
73                  "HessianAmbientCache\nAmbientAveraging\nAmbientValueSharing\n" \
74                  "PixelJitter\nPixelSampling\nPixelMotion\nPixelDepthOfField\n" \
75                  "SmallSourceDrawing\nViewSequence\nProgressReporting\n" \
76 <                "AdaptiveShadowTesting\nOutputs=v,l\n"
76 >                "AdaptiveShadowTesting\nOutputs=v,l\n" \
77 >                "OutputCS=RGB,XYZ,prims\n"
78   #endif
79  
80  
# Line 178 | Line 184 | main(int  argc, char  *argv[])
184                                  check(3,"f");
185                                  dblur = atof(argv[++i]);
186                                  break;
187 +                        case 'R':                               /* standard RGB output */
188 +                                if (strcmp(argv[i]+2, "RGB"))
189 +                                        goto badopt;
190 +                                out_prims = stdprims;
191 +                                break;
192 +                        case 'X':                               /* XYZ output */
193 +                                if (strcmp(argv[i]+2, "XYZ"))
194 +                                        goto badopt;
195 +                                out_prims = xyzprims;
196 +                                break;
197 +                        case 'c': {                             /* chromaticities */
198 +                                int     j;
199 +                                check(3,"ffffffff");
200 +                                rval = 0;
201 +                                for (j = 0; j < 8; j++) {
202 +                                        our_prims[0][j] = atof(argv[++i]);
203 +                                        rval |= fabs(our_prims[0][j]-stdprims[0][j]) > .001;
204 +                                }
205 +                                if (rval) {
206 +                                        if (!colorprimsOK(our_prims))
207 +                                                error(USER, "illegal primary chromaticities");
208 +                                        out_prims = our_prims;
209 +                                } else
210 +                                        out_prims = stdprims;
211 +                                } break;
212                          default:
213                                  goto badopt;
214                          }
# Line 210 | Line 241 | main(int  argc, char  *argv[])
241                                  check(2,"s");
242                          recover = argv[++i];
243                          break;
213                case 't':                               /* timer */
214                        check(2,"i");
215                        ralrm = atoi(argv[++i]);
216                        break;
244   #ifdef  PERSIST
245                  case 'P':                               /* persist file */
246                          if (argv[i][2] == 'P') {
# Line 226 | Line 253 | main(int  argc, char  *argv[])
253                          persistfile(argv[++i]);
254                          break;
255   #endif
256 +                case 't':                               /* timer */
257 +                        check(2,"i");
258 +                        ralrm = atoi(argv[++i]);
259 +                        break;
260                  case 'w':                               /* warnings */
261                          rval = erract[WARNING].pf != NULL;
262                          check_bool(2,rval);
# Line 240 | Line 271 | main(int  argc, char  *argv[])
271                          goto badopt;
272                  }
273          }
274 +                                        /* set/check spectral sampling */
275 +        if (setspectrsamp(CNDX, WLPART) <= 0)
276 +                error(USER, "unsupported spectral sampling");
277 +
278          err = setview(&ourview);        /* set viewing parameters */
279          if (err != NULL)
280                  error(USER, err);
# Line 319 | Line 354 | main(int  argc, char  *argv[])
354          ray_init_pmap();     /* PMAP: set up & load photon maps */
355  
356          marksources();                  /* find and mark sources */
322
357          setambient();                   /* initialize ambient calculation */
358          
359          fflush(stdout);                 /* in case we're duplicating header */
# Line 331 | Line 365 | main(int  argc, char  *argv[])
365                          close(duped1);
366                  }
367                  if (persist == PARALLEL) {      /* multiprocessing */
368 <                        preload_objs();         /* preload scene */
335 <                        shm_boundary = (char *)malloc(16);
336 <                        strcpy(shm_boundary, "SHM_BOUNDARY");
368 >                        cow_memshare();         /* preloads scene */
369                          while ((rval=fork()) == 0) {    /* keep on forkin' */
370                                  pflock(1);
371                                  pfhold();
# Line 399 | Line 431 | wputs(                         /* warning output function */
431   )
432   {
433          int  lasterrno = errno;
434 +        if (erract[WARNING].pf == NULL)
435 +                return;         /* called by calcomp or someone */
436          eputs(s);
437          errno = lasterrno;
438   }
# Line 483 | Line 517 | printdefaults(void)                    /* print default values to stdou
517          printf("-vl %f\t\t\t# view lift\n", ourview.voff);
518          printf("-x  %-9d\t\t\t# x resolution\n", hresolu);
519          printf("-y  %-9d\t\t\t# y resolution\n", vresolu);
520 +        if (out_prims == stdprims)
521 +                printf("-pRGB\t\t\t\t# standard RGB color output\n");
522 +        else if (out_prims == xyzprims)
523 +                printf("-pXYZ\t\t\t\t# CIE XYZ color output\n");
524 +        else if (out_prims != NULL)
525 +                printf("-pc %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f\t# output color primaries and white point\n",
526 +                                out_prims[RED][0], out_prims[RED][1],
527 +                                out_prims[GRN][0], out_prims[GRN][1],
528 +                                out_prims[BLU][0], out_prims[BLU][1],
529 +                                out_prims[WHT][0], out_prims[WHT][1]);
530          printf("-pa %f\t\t\t# pixel aspect ratio\n", pixaspect);
531          printf("-pj %f\t\t\t# pixel jitter\n", dstrpix);
532          printf("-pm %f\t\t\t# pixel motion\n", mblur);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines