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.45 by greg, Tue Aug 15 00:46:56 2023 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 int  setrtoutput(void);          /* set output values */
39 >
40   int  inform = 'a';                      /* input format */
41   int  outform = 'a';                     /* output format */
42   char  *outvals = "v";                   /* output specification */
# Line 43 | Line 44 | char  *outvals = "v";                  /* output specification */
44   int  hresolu = 0;                       /* horizontal (scan) size */
45   int  vresolu = 0;                       /* vertical resolution */
46  
47 + extern int  castonly;                   /* only doing ray-casting? */
48 +
49   int  imm_irrad = 0;                     /* compute immediate irradiance? */
50   int  lim_dist = 0;                      /* limit distance? */
51  
# Line 62 | Line 65 | static void onsig(int  signo);
65   static void sigdie(int  signo, char  *msg);
66   static void printdefaults(void);
67  
68 + #ifdef PERSIST
69 + #define RTRACE_FEATURES "Persist\nParallelPersist\nMultiprocessing\n" \
70 +                        "IrradianceCalc\nImmediateIrradiance\nDistanceLimiting\n" \
71 +                        "HessianAmbientCache\nAmbientAveraging\n" \
72 +                        "AmbientValueSharing\nAdaptiveShadowTesting\n" \
73 +                        "InputFormats=a,f,d\nOutputFormats=a,f,d,c\n" \
74 +                        "Outputs=o,d,v,V,w,W,l,L,c,p,n,N,s,m,M,r,x,R,X,~\n"
75 + #else
76 + #define RTRACE_FEATURES "IrradianceCalc\nIrradianceCalc\nDistanceLimiting\n" \
77 +                        "HessianAmbientCache\nAmbientAveraging\n" \
78 +                        "AmbientValueSharing\nAdaptiveShadowTesting\n" \
79 +                        "InputFormats=a,f,d\nOutputFormats=a,f,d,c\n" \
80 +                        "Outputs=o,d,v,V,w,W,l,L,c,p,n,N,s,m,M,r,x,R,X,~\n"
81 + #endif
82  
83 +
84   int
85   main(int  argc, char  *argv[])
86   {
# Line 85 | Line 103 | main(int  argc, char  *argv[])
103          int  i;
104                                          /* global program name */
105          progname = argv[0] = fixargv0(argv[0]);
106 +                                        /* feature check only? */
107 +        strcat(RFeatureList, RTRACE_FEATURES);
108 +        if (argc > 1 && !strcmp(argv[1], "-features"))
109 +                return feature_status(argc-2, argv+2);
110                                          /* add trace notify function */
111          for (i = 0; addobjnotify[i] != NULL; i++)
112                  ;
# Line 247 | Line 269 | main(int  argc, char  *argv[])
269                          goto badopt;
270                  }
271          }
272 <        if (nproc > 1) {
273 <                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 <        }
272 >        if (nproc > 1 && persist)
273 >                error(USER, "multiprocessing incompatible with persist file");
274                                          /* initialize object types */
275          initotypes();
276                                          /* initialize urand */
# Line 312 | Line 328 | main(int  argc, char  *argv[])
328   #endif
329          if (outform != 'a')
330                  SET_FILE_BINARY(stdout);
331 <        readoct(octname = octnm, loadflags, &thescene, NULL);
331 >        rval = setrtoutput();
332 >        octname = savqstr(octnm);
333 >        readoct(octname, loadflags, &thescene, NULL);
334          nsceneobjs = nobjects;
335  
336          if (loadflags & IO_INFO) {      /* print header */
337                  printargs(i, argv, stdout);
338                  printf("SOFTWARE= %s\n", VersionID);
339                  fputnow(stdout);
340 +                if (rval > 0)           /* saved from setrtoutput() call */
341 +                        printf("NCOMP=%d\n", rval);
342                  if ((outform == 'f') | (outform == 'd'))
343                          fputendian(stdout);
344                  fputformat(formstr(outform), stdout);
345                  putchar('\n');
346          }
327        
328        ray_init_pmap();     /* PMAP: set up & load photon maps */
329        
330        marksources();                  /* find and mark sources */
347  
348 <        setambient();                   /* initialize ambient calculation */
349 <        
348 >        if (!castonly) {        /* any actual ray traversal to do? */
349 >
350 >                ray_init_pmap();        /* PMAP: set up & load photon maps */
351 >                
352 >                marksources();          /* find and mark sources */
353 >
354 >                setambient();           /* initialize ambient calculation */
355 >        } else
356 >                distantsources();       /* else mark only distant sources */
357 >
358 >        fflush(stdout);                 /* in case we're duplicating header */
359 >
360   #ifdef  PERSIST
361          if (persist) {
336                fflush(stdout);
362                                                  /* reconnect stdout */
363                  dup2(duped1, fileno(stdout));
364                  close(duped1);
# Line 393 | Line 418 | badopt:
418  
419   void
420   wputs(                          /* warning output function */
421 <        char    *s
421 >        const char      *s
422   )
423   {
424          int  lasterrno = errno;
# Line 404 | Line 429 | wputs(                         /* warning output function */
429  
430   void
431   eputs(                          /* put string to stderr */
432 <        register char  *s
432 >        const char  *s
433   )
434   {
435          static int  midline = 0;
# Line 459 | Line 484 | sigdie(                        /* set fatal signal */
484   static void
485   printdefaults(void)                     /* print default values to stdout */
486   {
487 <        register char  *cp;
487 >        char  *cp;
488  
489          if (imm_irrad)
490                  printf("-I+\t\t\t\t# immediate irradiance on\n");
# Line 495 | Line 520 | printdefaults(void)                    /* print default values to stdou
520                  case 'W': printf(" coefficient"); break;
521                  case 'm': printf(" modifier"); break;
522                  case 'M': printf(" material"); break;
523 <                case '-': printf(" stroke"); break;
523 >                case '~': printf(" tilde"); break;
524                  }
525          putchar('\n');
526          printf(erract[WARNING].pf != NULL ?

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines