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.31 by greg, Sun Apr 5 15:47:02 2020 UTC vs.
Revision 2.38 by greg, Wed Oct 19 21:25:20 2022 UTC

# Line 37 | Line 37 | int  nproc = 1;                                /* number of processes */
37  
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 44 | 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 63 | 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 86 | 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 248 | Line 264 | main(int  argc, char  *argv[])
264                          goto badopt;
265                  }
266          }
267 <        if (nproc > 1) {
268 <                if (persist)
253 <                        error(USER, "multiprocessing incompatible with persist file");
254 <                if (!vresolu && hresolu > 0 && hresolu < nproc)
255 <                        error(WARNING, "number of cores should not exceed horizontal resolution");
256 <                if (trace != NULL)
257 <                        error(WARNING, "multiprocessing does not work properly with trace mode");
258 <        }
267 >        if (nproc > 1 && persist)
268 >                error(USER, "multiprocessing incompatible with persist file");
269                                          /* initialize object types */
270          initotypes();
271                                          /* initialize urand */
# Line 328 | Line 338 | main(int  argc, char  *argv[])
338                  fputformat(formstr(outform), stdout);
339                  putchar('\n');
340          }
331        
332        ray_init_pmap();     /* PMAP: set up & load photon maps */
333        
334        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) {
340                fflush(stdout);
356                                                  /* reconnect stdout */
357                  dup2(duped1, fileno(stdout));
358                  close(duped1);
# Line 408 | 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 463 | 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 499 | 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