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.28 by greg, Tue Nov 13 19:58:33 2018 UTC vs.
Revision 2.39 by greg, Wed Oct 19 23:10:34 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\n" \
73 +                        "AmbientValueSharing\nAdaptiveShadowTesting\n"
74 + #else
75 + #define RTRACE_FEATURES "IrradianceCalc\nIrradianceCalc\nDistanceLimiting\n" \
76 +                        "HessianAmbientCache\nAmbientAveraging\n" \
77 +                        "AmbientValueSharing\nAdaptiveShadowTesting\n"
78 + #endif
79  
80 +
81   int
82   main(int  argc, char  *argv[])
83   {
# Line 85 | Line 100 | main(int  argc, char  *argv[])
100          int  i;
101                                          /* global program name */
102          progname = argv[0] = fixargv0(argv[0]);
103 +                                        /* feature check only? */
104 +        strcat(RFeatureList, RTRACE_FEATURES);
105 +        if (!strcmp(argv[1], "-features"))
106 +                return feature_status(argc-2, argv+2);
107                                          /* add trace notify function */
108          for (i = 0; addobjnotify[i] != NULL; i++)
109                  ;
110          addobjnotify[i] = tranotify;
92                                        /* set our defaults */
93        rand_samp = 1;
94        maxdepth = -10;
95        minweight = 2e-3;
111                                          /* option city */
112          for (i = 1; i < argc; i++) {
113                                                  /* expand arguments */
# Line 251 | Line 266 | main(int  argc, char  *argv[])
266                          goto badopt;
267                  }
268          }
269 <        if (nproc > 1) {
270 <                if (persist)
256 <                        error(USER, "multiprocessing incompatible with persist file");
257 <                if (!vresolu && hresolu > 0 && hresolu < nproc)
258 <                        error(WARNING, "number of cores should not exceed horizontal resolution");
259 <                if (trace != NULL)
260 <                        error(WARNING, "multiprocessing does not work properly with trace mode");
261 <        }
269 >        if (nproc > 1 && persist)
270 >                error(USER, "multiprocessing incompatible with persist file");
271                                          /* initialize object types */
272          initotypes();
273                                          /* initialize urand */
# Line 316 | Line 325 | main(int  argc, char  *argv[])
325   #endif
326          if (outform != 'a')
327                  SET_FILE_BINARY(stdout);
328 +        rval = setrtoutput();
329          readoct(octname = octnm, loadflags, &thescene, NULL);
330          nsceneobjs = nobjects;
331  
# Line 323 | Line 333 | main(int  argc, char  *argv[])
333                  printargs(i, argv, stdout);
334                  printf("SOFTWARE= %s\n", VersionID);
335                  fputnow(stdout);
336 +                if (rval > 0)           /* saved from setrtoutput() call */
337 +                        printf("NCOMP=%d\n", rval);
338 +                if ((outform == 'f') | (outform == 'd'))
339 +                        fputendian(stdout);
340                  fputformat(formstr(outform), stdout);
341                  putchar('\n');
342          }
329        
330        ray_init_pmap();     /* PMAP: set up & load photon maps */
331        
332        marksources();                  /* find and mark sources */
343  
344 <        setambient();                   /* initialize ambient calculation */
345 <        
344 >        if (!castonly) {        /* any actual ray traversal to do? */
345 >
346 >                ray_init_pmap();        /* PMAP: set up & load photon maps */
347 >                
348 >                marksources();          /* find and mark sources */
349 >
350 >                setambient();           /* initialize ambient calculation */
351 >        } else
352 >                distantsources();       /* else mark only distant sources */
353 >
354 >        fflush(stdout);                 /* in case we're duplicating header */
355 >
356   #ifdef  PERSIST
357          if (persist) {
338                fflush(stdout);
358                                                  /* reconnect stdout */
359                  dup2(duped1, fileno(stdout));
360                  close(duped1);
# Line 406 | Line 425 | wputs(                         /* warning output function */
425  
426   void
427   eputs(                          /* put string to stderr */
428 <        register char  *s
428 >        char  *s
429   )
430   {
431          static int  midline = 0;
# Line 461 | Line 480 | sigdie(                        /* set fatal signal */
480   static void
481   printdefaults(void)                     /* print default values to stdout */
482   {
483 <        register char  *cp;
483 >        char  *cp;
484  
485          if (imm_irrad)
486                  printf("-I+\t\t\t\t# immediate irradiance on\n");
# Line 497 | Line 516 | printdefaults(void)                    /* print default values to stdou
516                  case 'W': printf(" coefficient"); break;
517                  case 'm': printf(" modifier"); break;
518                  case 'M': printf(" material"); break;
519 <                case '-': printf(" stroke"); break;
519 >                case '~': printf(" tilde"); break;
520                  }
521          putchar('\n');
522          printf(erract[WARNING].pf != NULL ?

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines