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.16 by greg, Tue Feb 24 19:39:27 2015 UTC vs.
Revision 2.32 by greg, Fri Apr 5 16:41:17 2024 UTC

# Line 52 | Line 52 | extern double  mblur;                  /* motion blur parameter */
52  
53   extern double  dblur;                   /* depth-of-field blur parameter */
54  
55 + RGBPRIMP  out_prims = stdprims;         /* output color primitives */
56 + static RGBPRIMS  our_prims;             /* private output color primitives */
57 +
58   static void onsig(int signo);
59   static void sigdie(int  signo, char  *msg);
60   static void printdefaults(void);
61 +                                        /* rpict additional features */
62 + #ifdef PERSIST
63 + #define RPICT_FEATURES  "Persist\nParallelPersist\n" \
64 +                "ParticipatingMedia=Mist\n" \
65 +                "Recovery\nIrradianceCalc\nViewTypes=v,l,a,h,s,c\n" \
66 +                "HessianAmbientCache\nAmbientAveraging\nAmbientValueSharing\n" \
67 +                "PixelJitter\nPixelSampling\nPixelMotion\nPixelDepthOfField\n" \
68 +                "SmallSourceDrawing\nViewSequence\nProgressReporting\n" \
69 +                "AdaptiveShadowTesting\nOutputs=v,l\n" \
70 +                "OutputCS=RGB,XYZ,Y,S,M,prims\n"
71 + #else
72 + #define RPICT_FEATURES  "Recovery\nIrradianceCalc\nViewTypes=v,l,a,h,s,c\n" \
73 +                "ParticipatingMedia=Mist\n" \
74 +                "HessianAmbientCache\nAmbientAveraging\nAmbientValueSharing\n" \
75 +                "PixelJitter\nPixelSampling\nPixelMotion\nPixelDepthOfField\n" \
76 +                "SmallSourceDrawing\nViewSequence\nProgressReporting\n" \
77 +                "AdaptiveShadowTesting\nOutputs=v,l\n" \
78 +                "OutputCS=RGB,XYZ,Y,S,M,prims\n"
79 + #endif
80  
81  
82   int
# Line 63 | Line 85 | main(int  argc, char  *argv[])
85   #define  check(ol,al)           if (argv[i][ol] || \
86                                  badarg(argc-i-1,argv+i+1,al)) \
87                                  goto badopt
88 < #define  bool(olen,var)         switch (argv[i][olen]) { \
88 > #define  check_bool(olen,var)           switch (argv[i][olen]) { \
89                                  case '\0': var = !var; break; \
90                                  case 'y': case 'Y': case 't': case 'T': \
91                                  case '+': case '1': var = 1; break; \
# Line 84 | Line 106 | main(int  argc, char  *argv[])
106          tstart = time((time_t *)NULL);
107                                          /* global program name */
108          progname = argv[0] = fixargv0(argv[0]);
109 +                                        /* feature check only? */
110 +        strcat(RFeatureList, RPICT_FEATURES);
111 +        if (argc > 1 && !strcmp(argv[1], "-features"))
112 +                return feature_status(argc-2, argv+2);
113                                          /* option city */
114          for (i = 1; i < argc; i++) {
115                                                  /* expand arguments */
# Line 159 | 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 209 | Line 260 | main(int  argc, char  *argv[])
260   #endif
261                  case 'w':                               /* warnings */
262                          rval = erract[WARNING].pf != NULL;
263 <                        bool(2,rval);
263 >                        check_bool(2,rval);
264                          if (rval) erract[WARNING].pf = wputs;
265                          else erract[WARNING].pf = NULL;
266                          break;
# Line 221 | 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 286 | Line 341 | main(int  argc, char  *argv[])
341   #endif
342          if (outfile != NULL)
343                  openheader();
289 #ifdef  _WIN32
344          SET_FILE_BINARY(stdout);
345          if (octname == NULL)
346                  SET_FILE_BINARY(stdin);
293 #endif
347          readoct(octname, loadflags, &thescene, NULL);
348          nsceneobjs = nobjects;
349  
# Line 305 | Line 358 | main(int  argc, char  *argv[])
358  
359          setambient();                   /* initialize ambient calculation */
360          
361 +        fflush(stdout);                 /* in case we're duplicating header */
362 +
363   #ifdef  PERSIST
364          if (persist) {
310                fflush(stdout);
365                  if (outfile == NULL) {          /* reconnect stdout */
366                          dup2(duped1, fileno(stdout));
367                          close(duped1);
# Line 371 | Line 425 | badopt:
425          return 1; /* pro forma return */
426  
427   #undef  check
428 < #undef  bool
428 > #undef  check_bool
429   }
430  
431  
432   void
433   wputs(                          /* warning output function */
434 <        char    *s
434 >        const char      *s
435   )
436   {
437          int  lasterrno = errno;
# Line 388 | Line 442 | wputs(                         /* warning output function */
442  
443   void
444   eputs(                          /* put string to stderr */
445 <        register char  *s
445 >        const char  *s
446   )
447   {
448          static int  midline = 0;
# Line 465 | 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