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

Comparing ray/src/rt/rtmain.c (file contents):
Revision 2.1 by greg, Sat Feb 22 02:07:29 2003 UTC vs.
Revision 2.56 by greg, Wed Oct 30 16:47:03 2024 UTC

# Line 5 | Line 5 | static const char      RCSid[] = "$Id$";
5   *  rtmain.c - main for rtrace per-ray calculation program
6   */
7  
8 < /* ====================================================================
9 < * The Radiance Software License, Version 1.0
10 < *
11 < * Copyright (c) 1990 - 2002 The Regents of the University of California,
12 < * through Lawrence Berkeley National Laboratory.   All rights reserved.
13 < *
14 < * Redistribution and use in source and binary forms, with or without
15 < * modification, are permitted provided that the following conditions
16 < * are met:
17 < *
18 < * 1. Redistributions of source code must retain the above copyright
19 < *         notice, this list of conditions and the following disclaimer.
20 < *
21 < * 2. Redistributions in binary form must reproduce the above copyright
22 < *       notice, this list of conditions and the following disclaimer in
23 < *       the documentation and/or other materials provided with the
24 < *       distribution.
25 < *
26 < * 3. The end-user documentation included with the redistribution,
27 < *           if any, must include the following acknowledgment:
28 < *             "This product includes Radiance software
29 < *                 (http://radsite.lbl.gov/)
30 < *                 developed by the Lawrence Berkeley National Laboratory
31 < *               (http://www.lbl.gov/)."
32 < *       Alternately, this acknowledgment may appear in the software itself,
33 < *       if and wherever such third-party acknowledgments normally appear.
34 < *
35 < * 4. The names "Radiance," "Lawrence Berkeley National Laboratory"
36 < *       and "The Regents of the University of California" must
37 < *       not be used to endorse or promote products derived from this
38 < *       software without prior written permission. For written
39 < *       permission, please contact [email protected].
40 < *
41 < * 5. Products derived from this software may not be called "Radiance",
42 < *       nor may "Radiance" appear in their name, without prior written
43 < *       permission of Lawrence Berkeley National Laboratory.
44 < *
45 < * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
46 < * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
47 < * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
48 < * DISCLAIMED.   IN NO EVENT SHALL Lawrence Berkeley National Laboratory OR
49 < * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
50 < * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
51 < * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
52 < * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
53 < * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
54 < * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
55 < * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
56 < * SUCH DAMAGE.
57 < * ====================================================================
58 < *
59 < * This software consists of voluntary contributions made by many
60 < * individuals on behalf of Lawrence Berkeley National Laboratory.   For more
61 < * information on Lawrence Berkeley National Laboratory, please see
62 < * <http://www.lbl.gov/>.
63 < */
8 > #include "copyright.h"
9  
10 < #include  "ray.h"
10 > #include  <signal.h>
11  
12 + #include  "platform.h"
13 + #include  "rtprocess.h" /* getpid() */
14 + #include  "resolu.h"
15 + #include  "ray.h"
16   #include  "source.h"
68
17   #include  "ambient.h"
70
18   #include  "random.h"
72
19   #include  "paths.h"
20 + #include  "pmapray.h"
21  
22 < #include  <sys/types.h>
22 > extern char     *progname;              /* global argv[0] */
23  
77 #include  <signal.h>
24                                          /* persistent processes define */
25   #ifdef  F_SETLKW
26   #define  PERSIST        1               /* normal persist */
# Line 82 | Line 28 | static const char      RCSid[] = "$Id$";
28   #define  PCHILD         3               /* child of normal persist */
29   #endif
30  
31 < char  *progname;                        /* argv[0] */
31 > char  *sigerr[NSIG];                    /* signal error messages */
32 > char  *errfile = NULL;                  /* error output file */
33  
34 < char  *octname;                         /* octree name */
34 > int  nproc = 1;                         /* number of processes */
35  
36 < char  *sigerr[NSIG];                    /* signal error messages */
36 > extern int  setrtoutput(void);          /* set output values */
37  
38 < char  *shm_boundary = NULL;             /* boundary of shared memory */
38 > int  inform = 'a';                      /* input format */
39 > int  outform = 'a';                     /* output format */
40 > char  *outvals = "v";                   /* output specification */
41  
42 < char  *errfile = NULL;                  /* error output file */
42 > int  hresolu = 0;                       /* horizontal (scan) size */
43 > int  vresolu = 0;                       /* vertical resolution */
44  
45 < extern char  *formstr();                /* string from format */
96 < extern int  inform;                     /* input format */
97 < extern int  outform;                    /* output format */
98 < extern char  *outvals;                  /* output values */
45 > extern int  castonly;                   /* only doing ray-casting? */
46  
47 < extern int  hresolu;                    /* horizontal resolution */
48 < extern int  vresolu;                    /* vertical resolution */
47 > int  imm_irrad = 0;                     /* compute immediate irradiance? */
48 > int  lim_dist = 0;                      /* limit distance? */
49  
50 < extern int  imm_irrad;                  /* compute immediate irradiance? */
51 < extern int  lim_dist;                   /* limit distance? */
50 > #ifndef MAXMODLIST
51 > #define MAXMODLIST      1024            /* maximum modifiers we'll track */
52 > #endif
53  
54 < extern char  *tralist[];                /* list of modifers to trace (or no) */
55 < extern int  traincl;                    /* include == 1, exclude == 0 */
54 > extern void  (*addobjnotify[])();       /* object notification calls */
55 > extern void  tranotify(OBJECT obj);
56  
57 < void    onsig();
58 < void    sigdie();
111 < void    printdefaults();
57 > char  *tralist[MAXMODLIST];             /* list of modifers to trace (or no) */
58 > int  traincl = -1;                      /* include == 1, exclude == 0 */
59  
60 + double  (*sens_curve)(const SCOLOR scol) = NULL;        /* spectral conversion for 1-channel */
61 + double  out_scalefactor = 1;            /* output calibration scale factor */
62 + RGBPRIMP  out_prims = stdprims;         /* output color primitives (NULL if spectral) */
63 + static RGBPRIMS  our_prims;             /* private output color primitives */
64  
65 + static int  loadflags = ~IO_FILES;      /* what to load from octree */
66 +
67 + static void onsig(int  signo);
68 + static void sigdie(int  signo, char  *msg);
69 + static void printdefaults(void);
70 +
71 + #ifdef PERSIST
72 + #define RTRACE_FEATURES "Persist\nParallelPersist\nMultiprocessing\n" \
73 +                        "IrradianceCalc\nImmediateIrradiance\nDistanceLimiting\n" \
74 +                        "ParticipatingMedia=Mist\n" \
75 +                        "HessianAmbientCache\nAmbientAveraging\n" \
76 +                        "AmbientValueSharing\nAdaptiveShadowTesting\n" \
77 +                        "InputFormats=a,f,d\nOutputFormats=a,f,d,c\n" \
78 +                        "Outputs=o,d,v,V,w,W,l,L,c,p,n,N,s,m,M,r,x,R,X,~\n" \
79 +                        "OutputCS=RGB,XYZ,Y,S,M,prims,spec\n"
80 + #else
81 + #define RTRACE_FEATURES "IrradianceCalc\nIrradianceCalc\nDistanceLimiting\n" \
82 +                        "ParticipatingMedia=Mist\n" \
83 +                        "HessianAmbientCache\nAmbientAveraging\n" \
84 +                        "AmbientValueSharing\nAdaptiveShadowTesting\n" \
85 +                        "InputFormats=a,f,d\nOutputFormats=a,f,d,c\n" \
86 +                        "Outputs=o,d,v,V,w,W,l,L,c,p,n,N,s,m,M,r,x,R,X,~\n" \
87 +                        "OutputCS=RGB,XYZ,Y,S,M,prims,spec\n"
88 + #endif
89 +
90 +
91   int
92 < main(argc, argv)
116 < int  argc;
117 < char  *argv[];
92 > main(int  argc, char  *argv[])
93   {
94   #define  check(ol,al)           if (argv[i][ol] || \
95                                  badarg(argc-i-1,argv+i+1,al)) \
96                                  goto badopt
97 < #define  bool(olen,var)         switch (argv[i][olen]) { \
97 > #define  check_bool(olen,var)           switch (argv[i][olen]) { \
98                                  case '\0': var = !var; break; \
99                                  case 'y': case 'Y': case 't': case 'T': \
100                                  case '+': case '1': var = 1; break; \
101                                  case 'n': case 'N': case 'f': case 'F': \
102                                  case '-': case '0': var = 0; break; \
103                                  default: goto badopt; }
104 <        int  loadflags = ~IO_FILES;
104 >        extern char  *octname;
105          int  persist = 0;
106 <        char  **tralp;
107 <        int  duped1;
106 >        char  *octnm = NULL;
107 >        char  **tralp = NULL;
108 >        int  duped1 = -1;
109          int  rval;
110          int  i;
111                                          /* global program name */
112          progname = argv[0] = fixargv0(argv[0]);
113 +                                        /* feature check only? */
114 +        strcat(RFeatureList, RTRACE_FEATURES);
115 +        if (argc > 1 && !strcmp(argv[1], "-features"))
116 +                return feature_status(argc-2, argv+2);
117 +                                        /* add trace notify function */
118 +        for (i = 0; addobjnotify[i] != NULL; i++)
119 +                ;
120 +        addobjnotify[i] = tranotify;
121                                          /* option city */
122          for (i = 1; i < argc; i++) {
123                                                  /* expand arguments */
# Line 160 | Line 144 | char  *argv[];
144                          continue;
145                  }
146                  switch (argv[i][1]) {
147 +                case 'n':                               /* number of cores */
148 +                        check(2,"i");
149 +                        nproc = atoi(argv[++i]);
150 +                        if (nproc <= 0)
151 +                                error(USER, "bad number of processes");
152 +                        break;
153                  case 'x':                               /* x resolution */
154                          check(2,"i");
155                          hresolu = atoi(argv[++i]);
# Line 168 | Line 158 | char  *argv[];
158                          check(2,"i");
159                          vresolu = atoi(argv[++i]);
160                          break;
161 <                case 'w':                               /* warnings */
161 >                case 'w':                               /* warnings & spectral */
162                          rval = erract[WARNING].pf != NULL;
163 <                        bool(2,rval);
163 >                        check_bool(2,rval);
164                          if (rval) erract[WARNING].pf = wputs;
165                          else erract[WARNING].pf = NULL;
166                          break;
# Line 181 | Line 171 | char  *argv[];
171                  case 'l':                               /* limit distance */
172                          if (argv[i][2] != 'd')
173                                  goto badopt;
174 <                        bool(3,lim_dist);
174 >                        check_bool(3,lim_dist);
175                          break;
176                  case 'I':                               /* immed. irradiance */
177 <                        bool(2,imm_irrad);
177 >                        check_bool(2,imm_irrad);
178                          break;
179                  case 'f':                               /* format i/o */
180                          switch (argv[i][2]) {
# Line 216 | Line 206 | char  *argv[];
206                          break;
207                  case 'h':                               /* header output */
208                          rval = loadflags & IO_INFO;
209 <                        bool(2,rval);
209 >                        check_bool(2,rval);
210                          loadflags = rval ? loadflags | IO_INFO :
211                                          loadflags & ~IO_INFO;
212                          break;
# Line 230 | Line 220 | char  *argv[];
220                                          tralp = tralist;
221                                  }
222                                  if (argv[i][2] == 'I') {        /* file */
223 <                                        rval = wordfile(tralp,
224 <                                        getpath(argv[++i],getlibpath(),R_OK));
223 >                                        rval = wordfile(tralp, MAXMODLIST-(tralp-tralist),
224 >                                        getpath(argv[++i],getrlibpath(),R_OK));
225                                          if (rval < 0) {
226                                                  sprintf(errmsg,
227                                  "cannot open trace include file \"%s\"",
# Line 252 | Line 242 | char  *argv[];
242                                          tralp = tralist;
243                                  }
244                                  if (argv[i][2] == 'E') {        /* file */
245 <                                        rval = wordfile(tralp,
246 <                                        getpath(argv[++i],getlibpath(),R_OK));
245 >                                        rval = wordfile(tralp, MAXMODLIST-(tralp-tralist),
246 >                                        getpath(argv[++i],getrlibpath(),R_OK));
247                                          if (rval < 0) {
248                                                  sprintf(errmsg,
249                                  "cannot open trace exclude file \"%s\"",
# Line 270 | Line 260 | char  *argv[];
260                                  goto badopt;
261                          }
262                          break;
263 +                case 'p':                               /* value output */
264 +                        switch (argv[i][2]) {
265 +                        case 'R':                       /* standard RGB output */
266 +                                if (strcmp(argv[i]+2, "RGB"))
267 +                                        goto badopt;
268 +                                out_prims = stdprims;
269 +                                out_scalefactor = 1;
270 +                                sens_curve = NULL;
271 +                                break;
272 +                        case 'X':                       /* XYZ output */
273 +                                if (strcmp(argv[i]+2, "XYZ"))
274 +                                        goto badopt;
275 +                                out_prims = xyzprims;
276 +                                out_scalefactor = WHTEFFICACY;
277 +                                sens_curve = NULL;
278 +                                break;
279 +                        case 'c': {
280 +                                int     j;
281 +                                check(3,"ffffffff");
282 +                                rval = 0;
283 +                                for (j = 0; j < 8; j++) {
284 +                                        our_prims[0][j] = atof(argv[++i]);
285 +                                        rval |= fabs(our_prims[0][j]-stdprims[0][j]) > .001;
286 +                                }
287 +                                if (rval) {
288 +                                        if (!colorprimsOK(our_prims))
289 +                                                error(USER, "illegal primary chromaticities");
290 +                                        out_prims = our_prims;
291 +                                } else
292 +                                        out_prims = stdprims;
293 +                                out_scalefactor = 1;
294 +                                sens_curve = NULL;
295 +                                } break;
296 +                        case 'Y':                       /* photopic response */
297 +                                if (argv[i][3])
298 +                                        goto badopt;
299 +                                sens_curve = scolor_photopic;
300 +                                out_scalefactor = WHTEFFICACY;
301 +                                break;
302 +                        case 'S':                       /* scotopic response */
303 +                                if (argv[i][3])
304 +                                        goto badopt;
305 +                                sens_curve = scolor_scotopic;
306 +                                out_scalefactor = WHTSCOTOPIC;
307 +                                break;
308 +                        case 'M':                       /* melanopic response */
309 +                                if (argv[i][3])
310 +                                        goto badopt;
311 +                                sens_curve = scolor_melanopic;
312 +                                out_scalefactor = WHTMELANOPIC;
313 +                                break;
314 +                        default:
315 +                                goto badopt;
316 +                        }
317 +                        break;
318 + #if MAXCSAMP>3
319 +                case 'c':                               /* output spectral results */
320 +                        if (argv[i][2] != 'o')
321 +                                goto badopt;
322 +                        rval = (out_prims == NULL) & (sens_curve == NULL);
323 +                        check_bool(3,rval);
324 +                        if (rval) {
325 +                                out_prims = NULL;
326 +                                sens_curve = NULL;
327 +                        } else if (out_prims == NULL)
328 +                                out_prims = stdprims;
329 +                        break;
330 + #endif
331   #ifdef  PERSIST
332                  case 'P':                               /* persist file */
333                          if (argv[i][2] == 'P') {
# Line 286 | Line 344 | char  *argv[];
344                          goto badopt;
345                  }
346          }
347 +                                        /* set/check spectral sampling */
348 +        rval = setspectrsamp(CNDX, WLPART);
349 +        if (rval < 0)
350 +                error(USER, "unsupported spectral sampling");
351 +        if (out_prims != NULL) {
352 +                if (!rval)
353 +                        error(WARNING, "spectral range incompatible with color output");
354 +        } else if (NCSAMP == 3)
355 +                out_prims = stdprims;   /* 3 samples do not a spectrum make */
356 +        if (nproc > 1 && persist)
357 +                error(USER, "multiprocessing incompatible with persist file");
358                                          /* initialize object types */
359          initotypes();
360                                          /* initialize urand */
361 <        initurand(2048);
361 >        if (rand_samp) {
362 >                srandom((long)time(0));
363 >                initurand(0);
364 >        } else {
365 >                srandom(0L);
366 >                initurand(2048);
367 >        }
368                                          /* set up signal handling */
369          sigdie(SIGINT, "Interrupt");
370 + #ifdef SIGHUP
371          sigdie(SIGHUP, "Hangup");
372 + #endif
373          sigdie(SIGTERM, "Terminate");
374 + #ifdef SIGPIPE
375          sigdie(SIGPIPE, "Broken pipe");
376 + #endif
377 + #ifdef SIGALRM
378          sigdie(SIGALRM, "Alarm clock");
379 + #endif
380   #ifdef  SIGXCPU
381          sigdie(SIGXCPU, "CPU limit exceeded");
382          sigdie(SIGXFSZ, "File size exceeded");
# Line 315 | Line 396 | char  *argv[];
396   #endif
397                                          /* get octree */
398          if (i == argc)
399 <                octname = NULL;
399 >                octnm = NULL;
400          else if (i == argc-1)
401 <                octname = argv[i];
401 >                octnm = argv[i];
402          else
403                  goto badopt;
404 <        if (octname == NULL)
404 >        if (octnm == NULL)
405                  error(USER, "missing octree argument");
406                                          /* set up output */
407   #ifdef  PERSIST
# Line 329 | Line 410 | char  *argv[];
410                  openheader();
411          }
412   #endif
332 #ifdef  MSDOS
413          if (outform != 'a')
414 <                setmode(fileno(stdout), O_BINARY);
415 <        if (octname == NULL)
416 <                setmode(fileno(stdin), O_BINARY);
337 < #endif
414 >                SET_FILE_BINARY(stdout);
415 >        rval = setrtoutput();
416 >        octname = savqstr(octnm);
417          readoct(octname, loadflags, &thescene, NULL);
418          nsceneobjs = nobjects;
419  
# Line 342 | Line 421 | char  *argv[];
421                  printargs(i, argv, stdout);
422                  printf("SOFTWARE= %s\n", VersionID);
423                  fputnow(stdout);
424 +                if (rval > 0)           /* saved from setrtoutput() call */
425 +                        fputncomp(rval, stdout);
426 +                if (NCSAMP > 3)
427 +                        fputwlsplit(WLPART, stdout);
428 +                if ((out_prims != stdprims) & (out_prims != NULL))
429 +                        fputprims(out_prims, stdout);
430 +                if ((outform == 'f') | (outform == 'd'))
431 +                        fputendian(stdout);
432                  fputformat(formstr(outform), stdout);
433 <                putchar('\n');
433 >                fputc('\n', stdout);    /* end of header */
434          }
435  
436 <        marksources();                  /* find and mark sources */
436 >        if (!castonly) {        /* any actual ray traversal to do? */
437  
438 <        setambient();                   /* initialize ambient calculation */
438 >                ray_init_pmap();        /* PMAP: set up & load photon maps */
439 >                
440 >                marksources();          /* find and mark sources */
441  
442 +                setambient();           /* initialize ambient calculation */
443 +        } else
444 +                distantsources();       /* else mark only distant sources */
445 +
446 +        fflush(stdout);                 /* in case we're duplicating header */
447 +
448   #ifdef  PERSIST
449          if (persist) {
355                fflush(stdout);
450                                                  /* reconnect stdout */
451                  dup2(duped1, fileno(stdout));
452                  close(duped1);
453                  if (persist == PARALLEL) {      /* multiprocessing */
454 <                        preload_objs();         /* preload scene */
361 <                        shm_boundary = (char *)malloc(16);
362 <                        strcpy(shm_boundary, "SHM_BOUNDARY");
454 >                        cow_memshare();         /* preloads scene */
455                          while ((rval=fork()) == 0) {    /* keep on forkin' */
456                                  pflock(1);
457                                  pfhold();
458 +                                ambsync();              /* load new values */
459                          }
460                          if (rval < 0)
461                                  error(SYSTEM, "cannot fork child for persist function");
462 <                        pfdetach();             /* parent exits */
462 >                        pfdetach();             /* parent will run then exit */
463                  }
464          }
465   runagain:
# Line 374 | Line 467 | runagain:
467                  dupheader();                    /* send header to stdout */
468   #endif
469                                          /* trace rays */
470 <        rtrace(NULL);
470 >        rtrace(NULL, nproc);
471                                          /* flush ambient file */
472          ambsync();
473   #ifdef  PERSIST
# Line 389 | Line 482 | runagain:
482                  }
483          }
484          if (persist == PCHILD) {        /* wait for a signal then go again */
392                close(duped1);                  /* release output handle */
485                  pfhold();
486                  raynum = nrays = 0;             /* reinitialize */
487                  goto runagain;
488          }
489   #endif
490 +
491 +        ray_done_pmap();           /* PMAP: free photon maps */
492 +        
493          quit(0);
494  
495   badopt:
496          sprintf(errmsg, "command line error at '%s'", argv[i]);
497          error(USER, errmsg);
498 +        return 1; /* pro forma return */
499  
500   #undef  check
501 < #undef  bool
501 > #undef  check_bool
502   }
503  
504  
505   void
506 < wputs(s)                                /* warning output function */
507 < char    *s;
506 > wputs(                          /* warning output function */
507 >        const char      *s
508 > )
509   {
510          int  lasterrno = errno;
511 +        if (erract[WARNING].pf == NULL)
512 +                return;         /* called by calcomp or someone */
513          eputs(s);
514          errno = lasterrno;
515   }
516  
517  
518   void
519 < eputs(s)                                /* put string to stderr */
520 < register char  *s;
519 > eputs(                          /* put string to stderr */
520 >        const char  *s
521 > )
522   {
523          static int  midline = 0;
524  
# Line 436 | Line 536 | register char  *s;
536   }
537  
538  
539 < void
540 < onsig(signo)                            /* fatal signal */
541 < int  signo;
539 > static void
540 > onsig(                          /* fatal signal */
541 >        int  signo
542 > )
543   {
544          static int  gotsig = 0;
545  
546          if (gotsig++)                   /* two signals and we're gone! */
547                  _exit(signo);
548  
549 + #ifdef SIGALRM
550          alarm(15);                      /* allow 15 seconds to clean up */
551          signal(SIGALRM, SIG_DFL);       /* make certain we do die */
552 + #endif
553          eputs("signal - ");
554          eputs(sigerr[signo]);
555          eputs("\n");
# Line 454 | Line 557 | int  signo;
557   }
558  
559  
560 < void
561 < sigdie(signo, msg)                      /* set fatal signal */
562 < int  signo;
563 < char  *msg;
560 > static void
561 > sigdie(                 /* set fatal signal */
562 >        int  signo,
563 >        char  *msg
564 > )
565   {
566          if (signal(signo, onsig) == SIG_IGN)
567                  signal(signo, SIG_IGN);
# Line 465 | Line 569 | char  *msg;
569   }
570  
571  
572 < void
573 < printdefaults()                 /* print default values to stdout */
572 > static void
573 > printdefaults(void)                     /* print default values to stdout */
574   {
575 <        register char  *cp;
575 >        char  *cp;
576  
577 +        printf(erract[WARNING].pf != NULL ?
578 +                        "-w+\t\t\t\t# warning messages on\n" :
579 +                        "-w-\t\t\t\t# warning messages off\n");
580          if (imm_irrad)
581                  printf("-I+\t\t\t\t# immediate irradiance on\n");
582 <        printf("-x  %-9d\t\t\t# x resolution\n", hresolu);
583 <        printf("-y  %-9d\t\t\t# y resolution\n", vresolu);
582 >        printf("-n %-2d\t\t\t\t# number of rendering processes\n", nproc);
583 >        printf("-x %-9d\t\t\t# %s\n", hresolu,
584 >                        vresolu && hresolu ? "x resolution" : "flush interval");
585 >        printf("-y %-9d\t\t\t# y resolution\n", vresolu);
586          printf(lim_dist ? "-ld+\t\t\t\t# limit distance on\n" :
587                          "-ld-\t\t\t\t# limit distance off\n");
588 +        printf(loadflags & IO_INFO ? "-h+\t\t\t\t# output header\n" :
589 +                        "-h-\t\t\t\t# no header\n");
590          printf("-f%c%c\t\t\t\t# format input/output = %s/%s\n",
591                          inform, outform, formstr(inform), formstr(outform));
592 <        printf("-o%s\t\t\t\t# output", outvals);
592 >        printf("-o%-9s\t\t\t# output", outvals);
593          for (cp = outvals; *cp; cp++)
594                  switch (*cp) {
595 <                case 't': printf(" trace"); break;
595 >                case 't': case 'T': printf(" trace"); break;
596                  case 'o': printf(" origin"); break;
597                  case 'd': printf(" direction"); break;
598 +                case 'r': printf(" reflect_contrib"); break;
599 +                case 'R': printf(" reflect_length"); break;
600 +                case 'x': printf(" unreflect_contrib"); break;
601 +                case 'X': printf(" unreflect_length"); break;
602                  case 'v': printf(" value"); break;
603 +                case 'V': printf(" contribution"); break;
604                  case 'l': printf(" length"); break;
605                  case 'L': printf(" first_length"); break;
606                  case 'p': printf(" point"); break;
# Line 492 | Line 608 | printdefaults()                        /* print default values to stdout */
608                  case 'N': printf(" unperturbed_normal"); break;
609                  case 's': printf(" surface"); break;
610                  case 'w': printf(" weight"); break;
611 +                case 'W': printf(" coefficient"); break;
612                  case 'm': printf(" modifier"); break;
613 +                case 'M': printf(" material"); break;
614 +                case '~': printf(" tilde"); break;
615                  }
616 <        putchar('\n');
617 <        printf(erract[WARNING].pf != NULL ?
618 <                        "-w+\t\t\t\t# warning messages on\n" :
619 <                        "-w-\t\t\t\t# warning messages off\n");
616 >        fputc('\n', stdout);
617 >        if (sens_curve == scolor_photopic)
618 >                printf("-pY\t\t\t\t# photopic output\n");
619 >        else if (sens_curve == scolor_scotopic)
620 >                printf("-pS\t\t\t\t# scotopic output\n");
621 >        else if (sens_curve == scolor_melanopic)
622 >                printf("-pM\t\t\t\t# melanopic output\n");
623 >        else if (out_prims == stdprims)
624 >                printf("-pRGB\t\t\t\t# standard RGB color output\n");
625 >        else if (out_prims == xyzprims)
626 >                printf("-pXYZ\t\t\t\t# CIE XYZ color output\n");
627 >        else if (out_prims != NULL)
628 >                printf("-pc %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f\t# output color primaries and white point\n",
629 >                                out_prims[RED][0], out_prims[RED][1],
630 >                                out_prims[GRN][0], out_prims[GRN][1],
631 >                                out_prims[BLU][0], out_prims[BLU][1],
632 >                                out_prims[WHT][0], out_prims[WHT][1]);
633 >        if ((sens_curve == NULL) & (NCSAMP > 3))
634 >                printf(out_prims != NULL ? "-co-\t\t\t\t# output tristimulus colors\n" :
635 >                                "-co+\t\t\t\t# output spectral values\n");
636          print_rdefaults();
637   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines