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.47 by greg, Wed Nov 15 18:02:53 2023 UTC vs.
Revision 2.59 by greg, Sat Jun 7 05:09:46 2025 UTC

# Line 13 | Line 13 | static const char      RCSid[] = "$Id$";
13   #include  "rtprocess.h" /* getpid() */
14   #include  "resolu.h"
15   #include  "ray.h"
16 + #include  "func.h"
17   #include  "source.h"
18   #include  "ambient.h"
19   #include  "random.h"
19 #include  "paths.h"
20   #include  "pmapray.h"
21  
22   extern char     *progname;              /* global argv[0] */
23  
24 extern char     *shm_boundary;          /* boundary of shared memory */
25
24                                          /* persistent processes define */
25   #ifdef  F_SETLKW
26   #define  PERSIST        1               /* normal persist */
# Line 59 | Line 57 | extern void  tranotify(OBJECT obj);
57   char  *tralist[MAXMODLIST];             /* list of modifers to trace (or no) */
58   int  traincl = -1;                      /* include == 1, exclude == 0 */
59  
60 < double  (*sens_curve)(SCOLOR scol) = NULL;      /* spectral conversion for 1-channel */
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 */
# Line 73 | Line 71 | static void printdefaults(void);
71   #ifdef PERSIST
72   #define RTRACE_FEATURES "Persist\nParallelPersist\nMultiprocessing\n" \
73                          "IrradianceCalc\nImmediateIrradiance\nDistanceLimiting\n" \
74 <                        "Hyperspectral\nParticipatingMedia=Mist\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"
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 <                        "Hyperspectral\nParticipatingMedia=Mist\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"
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  
# Line 114 | Line 114 | main(int  argc, char  *argv[])
114          strcat(RFeatureList, RTRACE_FEATURES);
115          if (argc > 1 && !strcmp(argv[1], "-features"))
116                  return feature_status(argc-2, argv+2);
117 +                                        /* initialize calcomp routines */
118 +        initfunc();
119                                          /* add trace notify function */
120          for (i = 0; addobjnotify[i] != NULL; i++)
121                  ;
# Line 294 | Line 296 | main(int  argc, char  *argv[])
296                                  sens_curve = NULL;
297                                  } break;
298                          case 'Y':                       /* photopic response */
299 +                                if (argv[i][3])
300 +                                        goto badopt;
301                                  sens_curve = scolor_photopic;
302                                  out_scalefactor = WHTEFFICACY;
303                                  break;
304                          case 'S':                       /* scotopic response */
305 +                                if (argv[i][3])
306 +                                        goto badopt;
307                                  sens_curve = scolor_scotopic;
308                                  out_scalefactor = WHTSCOTOPIC;
309                                  break;
310                          case 'M':                       /* melanopic response */
311 +                                if (argv[i][3])
312 +                                        goto badopt;
313                                  sens_curve = scolor_melanopic;
314                                  out_scalefactor = WHTMELANOPIC;
315                                  break;
# Line 310 | Line 318 | main(int  argc, char  *argv[])
318                          }
319                          break;
320   #if MAXCSAMP>3
321 <                case 'c':                               /* spectral sampling */
322 <                        switch (argv[i][2]) {
315 <                        case 's':                       /* spectral bin count */
316 <                                check(3,"i");
317 <                                NCSAMP = atoi(argv[++i]);
318 <                                break;
319 <                        case 'w':                       /* wavelength extrema */
320 <                                check(3,"ff");
321 <                                WLPART[0] = atof(argv[++i]);
322 <                                WLPART[3] = atof(argv[++i]);
323 <                                break;
324 <                        case 'o':                       /* output spectral results */
325 <                                rval = (out_prims == NULL);
326 <                                check_bool(3,rval);
327 <                                if (rval) out_prims = NULL;
328 <                                else if (out_prims == NULL) out_prims = stdprims;
329 <                                break;
330 <                        default:
321 >                case 'c':                               /* output spectral results */
322 >                        if (argv[i][2] != 'o')
323                                  goto badopt;
324 <                        }
324 >                        rval = (out_prims == NULL) & (sens_curve == NULL);
325 >                        check_bool(3,rval);
326 >                        if (rval) {
327 >                                out_prims = NULL;
328 >                                sens_curve = NULL;
329 >                        } else if (out_prims == NULL)
330 >                                out_prims = stdprims;
331                          break;
332   #endif
333   #ifdef  PERSIST
# Line 352 | Line 350 | main(int  argc, char  *argv[])
350          rval = setspectrsamp(CNDX, WLPART);
351          if (rval < 0)
352                  error(USER, "unsupported spectral sampling");
353 <        if (out_prims != NULL) {
353 >        if (sens_curve != NULL)
354 >                out_prims = NULL;
355 >        else if (out_prims != NULL) {
356                  if (!rval)
357                          error(WARNING, "spectral range incompatible with color output");
358          } else if (NCSAMP == 3)
# Line 455 | Line 455 | main(int  argc, char  *argv[])
455                  dup2(duped1, fileno(stdout));
456                  close(duped1);
457                  if (persist == PARALLEL) {      /* multiprocessing */
458 <                        preload_objs();         /* preload scene */
459 <                        shm_boundary = (char *)malloc(16);
460 <                        strcpy(shm_boundary, "SHM_BOUNDARY");
458 >                        cow_memshare();         /* preloads scene */
459                          while ((rval=fork()) == 0) {    /* keep on forkin' */
460                                  pflock(1);
461                                  pfhold();
# Line 514 | Line 512 | wputs(                         /* warning output function */
512   )
513   {
514          int  lasterrno = errno;
515 +        if (erract[WARNING].pf == NULL)
516 +                return;         /* called by calcomp or someone */
517          eputs(s);
518          errno = lasterrno;
519   }
# Line 578 | Line 578 | printdefaults(void)                    /* print default values to stdou
578   {
579          char  *cp;
580  
581 +        printf(erract[WARNING].pf != NULL ?
582 +                        "-w+\t\t\t\t# warning messages on\n" :
583 +                        "-w-\t\t\t\t# warning messages off\n");
584          if (imm_irrad)
585                  printf("-I+\t\t\t\t# immediate irradiance on\n");
586          printf("-n %-2d\t\t\t\t# number of rendering processes\n", nproc);
# Line 615 | Line 618 | printdefaults(void)                    /* print default values to stdou
618                  case '~': printf(" tilde"); break;
619                  }
620          fputc('\n', stdout);
618        if (NCSAMP > 3) {
619                printf("-cs %-2d\t\t\t\t# number of spectral bins\n", NCSAMP);
620                printf("-cw %3.0f %3.0f\t\t\t# wavelength limits (nm)\n",
621                                WLPART[3], WLPART[0]);
622                printf(out_prims != NULL ? "-co-\t\t\t\t# output tristimulus colors\n" :
623                                "-co+\t\t\t\t# output spectral values\n");
624        }
621          if (sens_curve == scolor_photopic)
622                  printf("-pY\t\t\t\t# photopic output\n");
623          else if (sens_curve == scolor_scotopic)
# Line 638 | Line 634 | printdefaults(void)                    /* print default values to stdou
634                                  out_prims[GRN][0], out_prims[GRN][1],
635                                  out_prims[BLU][0], out_prims[BLU][1],
636                                  out_prims[WHT][0], out_prims[WHT][1]);
637 <        printf(erract[WARNING].pf != NULL ?
638 <                        "-w+\t\t\t\t# warning messages on\n" :
639 <                        "-w-\t\t\t\t# warning messages off\n");
637 >        if ((sens_curve == NULL) & (NCSAMP > 3))
638 >                printf(out_prims != NULL ? "-co-\t\t\t\t# output tristimulus colors\n" :
639 >                                "-co+\t\t\t\t# output spectral values\n");
640          print_rdefaults();
641   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines