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.24 by greg, Mon Feb 6 20:34:17 2023 UTC vs.
Revision 2.40 by greg, Thu Jun 5 18:26:46 2025 UTC

# Line 13 | Line 13 | static const char      RCSid[] = "$Id$";
13   #include  "platform.h"
14   #include  "rtprocess.h" /* getpid() */
15   #include  "ray.h"
16 + #include  "func.h"
17   #include  "source.h"
18   #include  "ambient.h"
19   #include  "random.h"
# Line 27 | Line 28 | static const char      RCSid[] = "$Id$";
28   #define  PCHILD         3               /* child of normal persist */
29   #endif
30  
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  
36 extern time_t  time();
35   extern time_t  tstart;                  /* start time */
36  
37   extern int  ralrm;                      /* seconds between reports */
# Line 52 | Line 50 | extern double  mblur;                  /* motion blur parameter */
50  
51   extern double  dblur;                   /* depth-of-field blur parameter */
52  
53 + RGBPRIMP  out_prims = stdprims;         /* output color primitives */
54 + static RGBPRIMS  our_prims;             /* private output color primitives */
55 +
56   static void onsig(int signo);
57   static void sigdie(int  signo, char  *msg);
58   static void printdefaults(void);
59                                          /* rpict additional features */
60   #ifdef PERSIST
61   #define RPICT_FEATURES  "Persist\nParallelPersist\n" \
62 +                "ParticipatingMedia=Mist\n" \
63                  "Recovery\nIrradianceCalc\nViewTypes=v,l,a,h,s,c\n" \
64                  "HessianAmbientCache\nAmbientAveraging\nAmbientValueSharing\n" \
65                  "PixelJitter\nPixelSampling\nPixelMotion\nPixelDepthOfField\n" \
66                  "SmallSourceDrawing\nViewSequence\nProgressReporting\n" \
67 <                "AdaptiveShadowTesting\nOutputs=v,l\n"
67 >                "AdaptiveShadowTesting\nOutputs=v,l\n" \
68 >                "OutputCS=RGB,XYZ,prims\n"
69   #else
70   #define RPICT_FEATURES  "Recovery\nIrradianceCalc\nViewTypes=v,l,a,h,s,c\n" \
71 +                "ParticipatingMedia=Mist\n" \
72                  "HessianAmbientCache\nAmbientAveraging\nAmbientValueSharing\n" \
73                  "PixelJitter\nPixelSampling\nPixelMotion\nPixelDepthOfField\n" \
74                  "SmallSourceDrawing\nViewSequence\nProgressReporting\n" \
75 <                "AdaptiveShadowTesting\nOutputs=v,l\n"
75 >                "AdaptiveShadowTesting\nOutputs=v,l\n" \
76 >                "OutputCS=RGB,XYZ,prims\n"
77   #endif
78  
79  
# Line 101 | Line 106 | main(int  argc, char  *argv[])
106          progname = argv[0] = fixargv0(argv[0]);
107                                          /* feature check only? */
108          strcat(RFeatureList, RPICT_FEATURES);
109 <        if (argc == 2 && !strcmp(argv[1], "-features"))
109 >        if (argc > 1 && !strcmp(argv[1], "-features"))
110                  return feature_status(argc-2, argv+2);
111 +                                        /* initialize calcomp routines */
112 +        initfunc();
113                                          /* option city */
114          for (i = 1; i < argc; i++) {
115                                                  /* expand arguments */
# Line 178 | Line 185 | main(int  argc, char  *argv[])
185                                  check(3,"f");
186                                  dblur = atof(argv[++i]);
187                                  break;
188 +                        case 'R':                               /* standard RGB output */
189 +                                if (strcmp(argv[i]+2, "RGB"))
190 +                                        goto badopt;
191 +                                out_prims = stdprims;
192 +                                break;
193 +                        case 'X':                               /* XYZ output */
194 +                                if (strcmp(argv[i]+2, "XYZ"))
195 +                                        goto badopt;
196 +                                out_prims = xyzprims;
197 +                                break;
198 +                        case 'c': {                             /* chromaticities */
199 +                                int     j;
200 +                                check(3,"ffffffff");
201 +                                rval = 0;
202 +                                for (j = 0; j < 8; j++) {
203 +                                        our_prims[0][j] = atof(argv[++i]);
204 +                                        rval |= fabs(our_prims[0][j]-stdprims[0][j]) > .001;
205 +                                }
206 +                                if (rval) {
207 +                                        if (!colorprimsOK(our_prims))
208 +                                                error(USER, "illegal primary chromaticities");
209 +                                        out_prims = our_prims;
210 +                                } else
211 +                                        out_prims = stdprims;
212 +                                } break;
213                          default:
214                                  goto badopt;
215                          }
# Line 210 | Line 242 | main(int  argc, char  *argv[])
242                                  check(2,"s");
243                          recover = argv[++i];
244                          break;
213                case 't':                               /* timer */
214                        check(2,"i");
215                        ralrm = atoi(argv[++i]);
216                        break;
245   #ifdef  PERSIST
246                  case 'P':                               /* persist file */
247                          if (argv[i][2] == 'P') {
# Line 226 | Line 254 | main(int  argc, char  *argv[])
254                          persistfile(argv[++i]);
255                          break;
256   #endif
257 +                case 't':                               /* timer */
258 +                        check(2,"i");
259 +                        ralrm = atoi(argv[++i]);
260 +                        break;
261                  case 'w':                               /* warnings */
262                          rval = erract[WARNING].pf != NULL;
263                          check_bool(2,rval);
# Line 240 | Line 272 | main(int  argc, char  *argv[])
272                          goto badopt;
273                  }
274          }
275 +                                        /* set/check spectral sampling */
276 +        if (setspectrsamp(CNDX, WLPART) <= 0)
277 +                error(USER, "unsupported spectral sampling");
278 +
279          err = setview(&ourview);        /* set viewing parameters */
280          if (err != NULL)
281                  error(USER, err);
# Line 319 | Line 355 | main(int  argc, char  *argv[])
355          ray_init_pmap();     /* PMAP: set up & load photon maps */
356  
357          marksources();                  /* find and mark sources */
322
358          setambient();                   /* initialize ambient calculation */
359          
360          fflush(stdout);                 /* in case we're duplicating header */
# Line 331 | Line 366 | main(int  argc, char  *argv[])
366                          close(duped1);
367                  }
368                  if (persist == PARALLEL) {      /* multiprocessing */
369 <                        preload_objs();         /* preload scene */
335 <                        shm_boundary = (char *)malloc(16);
336 <                        strcpy(shm_boundary, "SHM_BOUNDARY");
369 >                        cow_memshare();         /* preloads scene */
370                          while ((rval=fork()) == 0) {    /* keep on forkin' */
371                                  pflock(1);
372                                  pfhold();
# Line 395 | Line 428 | badopt:
428  
429   void
430   wputs(                          /* warning output function */
431 <        char    *s
431 >        const char      *s
432   )
433   {
434          int  lasterrno = errno;
435 +        if (erract[WARNING].pf == NULL)
436 +                return;         /* called by calcomp or someone */
437          eputs(s);
438          errno = lasterrno;
439   }
# Line 406 | Line 441 | wputs(                         /* warning output function */
441  
442   void
443   eputs(                          /* put string to stderr */
444 <        char  *s
444 >        const char  *s
445   )
446   {
447          static int  midline = 0;
# Line 483 | Line 518 | printdefaults(void)                    /* print default values to stdou
518          printf("-vl %f\t\t\t# view lift\n", ourview.voff);
519          printf("-x  %-9d\t\t\t# x resolution\n", hresolu);
520          printf("-y  %-9d\t\t\t# y resolution\n", vresolu);
521 +        if (out_prims == stdprims)
522 +                printf("-pRGB\t\t\t\t# standard RGB color output\n");
523 +        else if (out_prims == xyzprims)
524 +                printf("-pXYZ\t\t\t\t# CIE XYZ color output\n");
525 +        else if (out_prims != NULL)
526 +                printf("-pc %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f\t# output color primaries and white point\n",
527 +                                out_prims[RED][0], out_prims[RED][1],
528 +                                out_prims[GRN][0], out_prims[GRN][1],
529 +                                out_prims[BLU][0], out_prims[BLU][1],
530 +                                out_prims[WHT][0], out_prims[WHT][1]);
531          printf("-pa %f\t\t\t# pixel aspect ratio\n", pixaspect);
532          printf("-pj %f\t\t\t# pixel jitter\n", dstrpix);
533          printf("-pm %f\t\t\t# pixel motion\n", mblur);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines