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.22 by greg, Wed Oct 19 23:10:34 2022 UTC vs.
Revision 2.39 by greg, Wed Apr 23 01:57:04 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 30 | Line 31 | static const char      RCSid[] = "$Id$";
31   char  *progname;                        /* argv[0] */
32   char  *octname;                         /* octree name */
33   char  *sigerr[NSIG];                    /* signal error messages */
33 char  *shm_boundary = NULL;             /* boundary of shared memory */
34   char  *errfile = NULL;                  /* error output file */
35  
36 extern time_t  time();
36   extern time_t  tstart;                  /* start time */
37  
38   extern int  ralrm;                      /* seconds between reports */
# 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\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\n"
76 >                "AdaptiveShadowTesting\nOutputs=v,l\n" \
77 >                "OutputCS=RGB,XYZ,prims\n"
78   #endif
79  
80  
# Line 101 | Line 107 | main(int  argc, char  *argv[])
107          progname = argv[0] = fixargv0(argv[0]);
108                                          /* feature check only? */
109          strcat(RFeatureList, RPICT_FEATURES);
110 <        if (!strcmp(argv[1], "-features"))
110 >        if (argc > 1 && !strcmp(argv[1], "-features"))
111                  return feature_status(argc-2, argv+2);
112 +                                        /* initialize calcomp routines */
113 +        initfunc();
114                                          /* option city */
115          for (i = 1; i < argc; i++) {
116                                                  /* expand arguments */
# Line 178 | Line 186 | main(int  argc, char  *argv[])
186                                  check(3,"f");
187                                  dblur = atof(argv[++i]);
188                                  break;
189 +                        case 'R':                               /* standard RGB output */
190 +                                if (strcmp(argv[i]+2, "RGB"))
191 +                                        goto badopt;
192 +                                out_prims = stdprims;
193 +                                break;
194 +                        case 'X':                               /* XYZ output */
195 +                                if (strcmp(argv[i]+2, "XYZ"))
196 +                                        goto badopt;
197 +                                out_prims = xyzprims;
198 +                                break;
199 +                        case 'c': {                             /* chromaticities */
200 +                                int     j;
201 +                                check(3,"ffffffff");
202 +                                rval = 0;
203 +                                for (j = 0; j < 8; j++) {
204 +                                        our_prims[0][j] = atof(argv[++i]);
205 +                                        rval |= fabs(our_prims[0][j]-stdprims[0][j]) > .001;
206 +                                }
207 +                                if (rval) {
208 +                                        if (!colorprimsOK(our_prims))
209 +                                                error(USER, "illegal primary chromaticities");
210 +                                        out_prims = our_prims;
211 +                                } else
212 +                                        out_prims = stdprims;
213 +                                } break;
214                          default:
215                                  goto badopt;
216                          }
# Line 210 | Line 243 | main(int  argc, char  *argv[])
243                                  check(2,"s");
244                          recover = argv[++i];
245                          break;
213                case 't':                               /* timer */
214                        check(2,"i");
215                        ralrm = atoi(argv[++i]);
216                        break;
246   #ifdef  PERSIST
247                  case 'P':                               /* persist file */
248                          if (argv[i][2] == 'P') {
# Line 226 | Line 255 | main(int  argc, char  *argv[])
255                          persistfile(argv[++i]);
256                          break;
257   #endif
258 +                case 't':                               /* timer */
259 +                        check(2,"i");
260 +                        ralrm = atoi(argv[++i]);
261 +                        break;
262                  case 'w':                               /* warnings */
263                          rval = erract[WARNING].pf != NULL;
264                          check_bool(2,rval);
# Line 240 | Line 273 | main(int  argc, char  *argv[])
273                          goto badopt;
274                  }
275          }
276 +                                        /* set/check spectral sampling */
277 +        if (setspectrsamp(CNDX, WLPART) <= 0)
278 +                error(USER, "unsupported spectral sampling");
279 +
280          err = setview(&ourview);        /* set viewing parameters */
281          if (err != NULL)
282                  error(USER, err);
# Line 319 | Line 356 | main(int  argc, char  *argv[])
356          ray_init_pmap();     /* PMAP: set up & load photon maps */
357  
358          marksources();                  /* find and mark sources */
322
359          setambient();                   /* initialize ambient calculation */
360          
361          fflush(stdout);                 /* in case we're duplicating header */
# Line 331 | Line 367 | main(int  argc, char  *argv[])
367                          close(duped1);
368                  }
369                  if (persist == PARALLEL) {      /* multiprocessing */
370 <                        preload_objs();         /* preload scene */
335 <                        shm_boundary = (char *)malloc(16);
336 <                        strcpy(shm_boundary, "SHM_BOUNDARY");
370 >                        cow_memshare();         /* preloads scene */
371                          while ((rval=fork()) == 0) {    /* keep on forkin' */
372                                  pflock(1);
373                                  pfhold();
# Line 395 | Line 429 | badopt:
429  
430   void
431   wputs(                          /* warning output function */
432 <        char    *s
432 >        const char      *s
433   )
434   {
435          int  lasterrno = errno;
436 +        if (erract[WARNING].pf == NULL)
437 +                return;         /* called by calcomp or someone */
438          eputs(s);
439          errno = lasterrno;
440   }
# Line 406 | Line 442 | wputs(                         /* warning output function */
442  
443   void
444   eputs(                          /* put string to stderr */
445 <        char  *s
445 >        const char  *s
446   )
447   {
448          static int  midline = 0;
# Line 483 | Line 519 | printdefaults(void)                    /* print default values to stdou
519          printf("-vl %f\t\t\t# view lift\n", ourview.voff);
520          printf("-x  %-9d\t\t\t# x resolution\n", hresolu);
521          printf("-y  %-9d\t\t\t# y resolution\n", vresolu);
522 +        if (out_prims == stdprims)
523 +                printf("-pRGB\t\t\t\t# standard RGB color output\n");
524 +        else if (out_prims == xyzprims)
525 +                printf("-pXYZ\t\t\t\t# CIE XYZ color output\n");
526 +        else if (out_prims != NULL)
527 +                printf("-pc %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f\t# output color primaries and white point\n",
528 +                                out_prims[RED][0], out_prims[RED][1],
529 +                                out_prims[GRN][0], out_prims[GRN][1],
530 +                                out_prims[BLU][0], out_prims[BLU][1],
531 +                                out_prims[WHT][0], out_prims[WHT][1]);
532          printf("-pa %f\t\t\t# pixel aspect ratio\n", pixaspect);
533          printf("-pj %f\t\t\t# pixel jitter\n", dstrpix);
534          printf("-pm %f\t\t\t# pixel motion\n", mblur);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines