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

Comparing ray/src/rt/rtmain.c (file contents):
Revision 2.48 by greg, Fri Nov 17 20:02:07 2023 UTC vs.
Revision 2.62 by greg, Fri Dec 5 17:51:34 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
21                                          /* persistent processes define */
22   #ifdef  F_SETLKW
23   #define  PERSIST        1               /* normal persist */
# Line 59 | Line 54 | extern void  tranotify(OBJECT obj);
54   char  *tralist[MAXMODLIST];             /* list of modifers to trace (or no) */
55   int  traincl = -1;                      /* include == 1, exclude == 0 */
56  
57 < double  (*sens_curve)(SCOLOR scol) = NULL;      /* spectral conversion for 1-channel */
57 > double  (*sens_curve)(const SCOLOR scol) = NULL;        /* spectral conversion for 1-channel */
58   double  out_scalefactor = 1;            /* output calibration scale factor */
59   RGBPRIMP  out_prims = stdprims;         /* output color primitives (NULL if spectral) */
60   static RGBPRIMS  our_prims;             /* private output color primitives */
# Line 77 | Line 72 | static void printdefaults(void);
72                          "HessianAmbientCache\nAmbientAveraging\n" \
73                          "AmbientValueSharing\nAdaptiveShadowTesting\n" \
74                          "InputFormats=a,f,d\nOutputFormats=a,f,d,c\n" \
75 <                        "Outputs=o,d,v,V,w,W,l,L,c,p,n,N,s,m,M,r,x,R,X,~\n"
75 >                        "Outputs=o,d,v,V,w,W,l,L,c,p,n,N,s,m,M,r,x,R,X,~\n" \
76 >                        "OutputCS=RGB,XYZ,Y,S,M,prims,spec\n"
77   #else
78   #define RTRACE_FEATURES "IrradianceCalc\nIrradianceCalc\nDistanceLimiting\n" \
79                          "ParticipatingMedia=Mist\n" \
80                          "HessianAmbientCache\nAmbientAveraging\n" \
81                          "AmbientValueSharing\nAdaptiveShadowTesting\n" \
82                          "InputFormats=a,f,d\nOutputFormats=a,f,d,c\n" \
83 <                        "Outputs=o,d,v,V,w,W,l,L,c,p,n,N,s,m,M,r,x,R,X,~\n"
83 >                        "Outputs=o,d,v,V,w,W,l,L,c,p,n,N,s,m,M,r,x,R,X,~\n" \
84 >                        "OutputCS=RGB,XYZ,Y,S,M,prims,spec\n"
85   #endif
86  
87  
# Line 114 | Line 111 | main(int  argc, char  *argv[])
111          strcat(RFeatureList, RTRACE_FEATURES);
112          if (argc > 1 && !strcmp(argv[1], "-features"))
113                  return feature_status(argc-2, argv+2);
114 +                                        /* initialize calcomp routines */
115 +        initfunc();
116                                          /* add trace notify function */
117          for (i = 0; addobjnotify[i] != NULL; i++)
118                  ;
# Line 294 | Line 293 | main(int  argc, char  *argv[])
293                                  sens_curve = NULL;
294                                  } break;
295                          case 'Y':                       /* photopic response */
296 +                                if (argv[i][3])
297 +                                        goto badopt;
298                                  sens_curve = scolor_photopic;
299                                  out_scalefactor = WHTEFFICACY;
300                                  break;
301                          case 'S':                       /* scotopic response */
302 <                                sens_curve = scolor_scotopic;
302 >                                if (argv[i][3])
303 >                                        goto badopt;
304                                  out_scalefactor = WHTSCOTOPIC;
305 +                                sens_curve = scolor_scotopic;
306                                  break;
307                          case 'M':                       /* melanopic response */
308 <                                sens_curve = scolor_melanopic;
308 >                                if (argv[i][3])
309 >                                        goto badopt;
310                                  out_scalefactor = WHTMELANOPIC;
311 +                                sens_curve = scolor_melanopic;
312                                  break;
313 +                        case 'A':                       /* radiometric average */
314 +                                if (argv[i][3])
315 +                                        goto badopt;
316 +                                out_scalefactor = 1;
317 +                                sens_curve = scolor_mean;
318 +                                break;
319                          default:
320                                  goto badopt;
321                          }
# Line 313 | Line 324 | main(int  argc, char  *argv[])
324                  case 'c':                               /* output spectral results */
325                          if (argv[i][2] != 'o')
326                                  goto badopt;
327 <                        rval = (out_prims == NULL);
327 >                        rval = (out_prims == NULL) & (sens_curve == NULL);
328                          check_bool(3,rval);
329 <                        if (rval) out_prims = NULL;
330 <                        else if (out_prims == NULL) out_prims = stdprims;
329 >                        if (rval) {
330 >                                out_prims = NULL;
331 >                                sens_curve = NULL;
332 >                        } else if (out_prims == NULL)
333 >                                out_prims = stdprims;
334                          break;
335   #endif
336   #ifdef  PERSIST
# Line 339 | Line 353 | main(int  argc, char  *argv[])
353          rval = setspectrsamp(CNDX, WLPART);
354          if (rval < 0)
355                  error(USER, "unsupported spectral sampling");
356 <        if (out_prims != NULL) {
356 >        if (sens_curve != NULL)
357 >                out_prims = NULL;
358 >        else if (out_prims != NULL) {
359                  if (!rval)
360                          error(WARNING, "spectral range incompatible with color output");
361          } else if (NCSAMP == 3)
# Line 349 | Line 365 | main(int  argc, char  *argv[])
365                                          /* initialize object types */
366          initotypes();
367                                          /* initialize urand */
368 <        if (rand_samp) {
353 <                srandom((long)time(0));
354 <                initurand(0);
355 <        } else {
356 <                srandom(0L);
357 <                initurand(2048);
358 <        }
368 >        reset_random();
369                                          /* set up signal handling */
370          sigdie(SIGINT, "Interrupt");
371   #ifdef SIGHUP
# Line 442 | Line 452 | main(int  argc, char  *argv[])
452                  dup2(duped1, fileno(stdout));
453                  close(duped1);
454                  if (persist == PARALLEL) {      /* multiprocessing */
455 <                        preload_objs();         /* preload scene */
446 <                        shm_boundary = (char *)malloc(16);
447 <                        strcpy(shm_boundary, "SHM_BOUNDARY");
455 >                        cow_memshare();         /* preloads scene */
456                          while ((rval=fork()) == 0) {    /* keep on forkin' */
457                                  pflock(1);
458                                  pfhold();
# Line 501 | Line 509 | wputs(                         /* warning output function */
509   )
510   {
511          int  lasterrno = errno;
512 +        if (erract[WARNING].pf == NULL)
513 +                return;         /* called by calcomp or someone */
514          eputs(s);
515          errno = lasterrno;
516   }
# Line 565 | Line 575 | printdefaults(void)                    /* print default values to stdou
575   {
576          char  *cp;
577  
578 +        printf(erract[WARNING].pf != NULL ?
579 +                        "-w+\t\t\t\t# warning messages on\n" :
580 +                        "-w-\t\t\t\t# warning messages off\n");
581          if (imm_irrad)
582                  printf("-I+\t\t\t\t# immediate irradiance on\n");
583          printf("-n %-2d\t\t\t\t# number of rendering processes\n", nproc);
# Line 602 | Line 615 | printdefaults(void)                    /* print default values to stdou
615                  case '~': printf(" tilde"); break;
616                  }
617          fputc('\n', stdout);
605        if (NCSAMP > 3)
606                printf(out_prims != NULL ? "-co-\t\t\t\t# output tristimulus colors\n" :
607                                "-co+\t\t\t\t# output spectral values\n");
618          if (sens_curve == scolor_photopic)
619                  printf("-pY\t\t\t\t# photopic output\n");
620          else if (sens_curve == scolor_scotopic)
# Line 621 | Line 631 | printdefaults(void)                    /* print default values to stdou
631                                  out_prims[GRN][0], out_prims[GRN][1],
632                                  out_prims[BLU][0], out_prims[BLU][1],
633                                  out_prims[WHT][0], out_prims[WHT][1]);
634 <        printf(erract[WARNING].pf != NULL ?
635 <                        "-w+\t\t\t\t# warning messages on\n" :
636 <                        "-w-\t\t\t\t# warning messages off\n");
634 >        if ((sens_curve == NULL) & (NCSAMP > 3))
635 >                printf(out_prims != NULL ? "-co-\t\t\t\t# output tristimulus colors\n" :
636 >                                "-co+\t\t\t\t# output spectral values\n");
637          print_rdefaults();
638   }

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)