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.30 by greg, Wed Aug 14 20:07:20 2019 UTC vs.
Revision 2.38 by greg, Wed Oct 19 21:25:20 2022 UTC

# Line 35 | Line 35 | char  *errfile = NULL;                 /* error output file */
35  
36   int  nproc = 1;                         /* number of processes */
37  
38 < extern char  *formstr();                /* string from format */
38 > extern char  *formstr(int f);           /* string from format */
39 > extern int  setrtoutput(void);          /* set output values */
40 >
41   int  inform = 'a';                      /* input format */
42   int  outform = 'a';                     /* output format */
43   char  *outvals = "v";                   /* output specification */
# Line 43 | Line 45 | char  *outvals = "v";                  /* output specification */
45   int  hresolu = 0;                       /* horizontal (scan) size */
46   int  vresolu = 0;                       /* vertical resolution */
47  
48 + extern int  castonly;                   /* only doing ray-casting? */
49 +
50   int  imm_irrad = 0;                     /* compute immediate irradiance? */
51   int  lim_dist = 0;                      /* limit distance? */
52  
# Line 62 | Line 66 | static void onsig(int  signo);
66   static void sigdie(int  signo, char  *msg);
67   static void printdefaults(void);
68  
69 + #ifdef PERSIST
70 + #define RTRACE_FEATURES "Persist\nParallelPersist\nMultiProcessing\n" \
71 +                        "IrradianceCalc\nImmediateIrradiance\nDistanceLimiting\n" \
72 +                        "HessianAmbientCache\nAmbientAveraging\nAmbientValueSharing\n"
73 + #else
74 + #define RTRACE_FEATURES "IrradianceCalc\nIrradianceCalc\nDistanceLimiting\n" \
75 +                        "HessianAmbientCache\nAmbientAveraging\nAmbientValueSharing\n"
76 + #endif
77  
78 +
79   int
80   main(int  argc, char  *argv[])
81   {
# Line 85 | Line 98 | main(int  argc, char  *argv[])
98          int  i;
99                                          /* global program name */
100          progname = argv[0] = fixargv0(argv[0]);
101 +                                        /* feature check only? */
102 +        strcat(RFeatureList, RTRACE_FEATURES);
103 +        if (!strcmp(argv[1], "-features"))
104 +                return feature_status(argc-2, argv+2);
105                                          /* add trace notify function */
106          for (i = 0; addobjnotify[i] != NULL; i++)
107                  ;
# Line 247 | Line 264 | main(int  argc, char  *argv[])
264                          goto badopt;
265                  }
266          }
267 <        if (nproc > 1) {
268 <                if (persist)
252 <                        error(USER, "multiprocessing incompatible with persist file");
253 <                if (!vresolu && hresolu > 0 && hresolu < nproc)
254 <                        error(WARNING, "number of cores should not exceed horizontal resolution");
255 <                if (trace != NULL)
256 <                        error(WARNING, "multiprocessing does not work properly with trace mode");
257 <        }
267 >        if (nproc > 1 && persist)
268 >                error(USER, "multiprocessing incompatible with persist file");
269                                          /* initialize object types */
270          initotypes();
271                                          /* initialize urand */
# Line 312 | Line 323 | main(int  argc, char  *argv[])
323   #endif
324          if (outform != 'a')
325                  SET_FILE_BINARY(stdout);
326 +        rval = setrtoutput();
327          readoct(octname = octnm, loadflags, &thescene, NULL);
328          nsceneobjs = nobjects;
329  
# Line 319 | Line 331 | main(int  argc, char  *argv[])
331                  printargs(i, argv, stdout);
332                  printf("SOFTWARE= %s\n", VersionID);
333                  fputnow(stdout);
334 +                if (rval > 0)           /* saved from setrtoutput() call */
335 +                        printf("NCOMP=%d\n", rval);
336                  if ((outform == 'f') | (outform == 'd'))
337                          fputendian(stdout);
338                  fputformat(formstr(outform), stdout);
339                  putchar('\n');
340          }
327        
328        ray_init_pmap();     /* PMAP: set up & load photon maps */
329        
330        marksources();                  /* find and mark sources */
341  
342 <        setambient();                   /* initialize ambient calculation */
343 <        
342 >        if (!castonly) {        /* any actual ray traversal to do? */
343 >
344 >                ray_init_pmap();        /* PMAP: set up & load photon maps */
345 >                
346 >                marksources();          /* find and mark sources */
347 >
348 >                setambient();           /* initialize ambient calculation */
349 >        } else
350 >                distantsources();       /* else mark only distant sources */
351 >
352 >        fflush(stdout);                 /* in case we're duplicating header */
353 >
354   #ifdef  PERSIST
355          if (persist) {
336                fflush(stdout);
356                                                  /* reconnect stdout */
357                  dup2(duped1, fileno(stdout));
358                  close(duped1);
# Line 404 | Line 423 | wputs(                         /* warning output function */
423  
424   void
425   eputs(                          /* put string to stderr */
426 <        register char  *s
426 >        char  *s
427   )
428   {
429          static int  midline = 0;
# Line 459 | Line 478 | sigdie(                        /* set fatal signal */
478   static void
479   printdefaults(void)                     /* print default values to stdout */
480   {
481 <        register char  *cp;
481 >        char  *cp;
482  
483          if (imm_irrad)
484                  printf("-I+\t\t\t\t# immediate irradiance on\n");
# Line 495 | Line 514 | printdefaults(void)                    /* print default values to stdou
514                  case 'W': printf(" coefficient"); break;
515                  case 'm': printf(" modifier"); break;
516                  case 'M': printf(" material"); break;
517 <                case '-': printf(" stroke"); break;
517 >                case '~': printf(" tilde"); break;
518                  }
519          putchar('\n');
520          printf(erract[WARNING].pf != NULL ?

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines