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.29 by greg, Thu Apr 18 23:58:22 2019 UTC vs.
Revision 2.46 by greg, Tue Aug 15 01:19:37 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 +                        "ParticipatingMedia=Mist\n" \
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"
76 + #else
77 + #define RTRACE_FEATURES "IrradianceCalc\nIrradianceCalc\nDistanceLimiting\n" \
78 +                        "ParticipatingMedia=Mist\n" \
79 +                        "HessianAmbientCache\nAmbientAveraging\n" \
80 +                        "AmbientValueSharing\nAdaptiveShadowTesting\n" \
81 +                        "InputFormats=a,f,d\nOutputFormats=a,f,d,c\n" \
82 +                        "Outputs=o,d,v,V,w,W,l,L,c,p,n,N,s,m,M,r,x,R,X,~\n"
83 + #endif
84  
85 +
86   int
87   main(int  argc, char  *argv[])
88   {
# Line 85 | Line 105 | main(int  argc, char  *argv[])
105          int  i;
106                                          /* global program name */
107          progname = argv[0] = fixargv0(argv[0]);
108 +                                        /* feature check only? */
109 +        strcat(RFeatureList, RTRACE_FEATURES);
110 +        if (argc > 1 && !strcmp(argv[1], "-features"))
111 +                return feature_status(argc-2, argv+2);
112                                          /* add trace notify function */
113          for (i = 0; addobjnotify[i] != NULL; i++)
114                  ;
# Line 247 | Line 271 | main(int  argc, char  *argv[])
271                          goto badopt;
272                  }
273          }
274 <        if (nproc > 1) {
275 <                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 <        }
274 >        if (nproc > 1 && persist)
275 >                error(USER, "multiprocessing incompatible with persist file");
276                                          /* initialize object types */
277          initotypes();
278                                          /* initialize urand */
# Line 312 | Line 330 | main(int  argc, char  *argv[])
330   #endif
331          if (outform != 'a')
332                  SET_FILE_BINARY(stdout);
333 <        readoct(octname = octnm, loadflags, &thescene, NULL);
333 >        rval = setrtoutput();
334 >        octname = savqstr(octnm);
335 >        readoct(octname, loadflags, &thescene, NULL);
336          nsceneobjs = nobjects;
337  
338          if (loadflags & IO_INFO) {      /* print header */
339                  printargs(i, argv, stdout);
340                  printf("SOFTWARE= %s\n", VersionID);
341                  fputnow(stdout);
342 +                if (rval > 0)           /* saved from setrtoutput() call */
343 +                        printf("NCOMP=%d\n", rval);
344 +                if ((outform == 'f') | (outform == 'd'))
345 +                        fputendian(stdout);
346                  fputformat(formstr(outform), stdout);
347                  putchar('\n');
348          }
325        
326        ray_init_pmap();     /* PMAP: set up & load photon maps */
327        
328        marksources();                  /* find and mark sources */
349  
350 <        setambient();                   /* initialize ambient calculation */
351 <        
350 >        if (!castonly) {        /* any actual ray traversal to do? */
351 >
352 >                ray_init_pmap();        /* PMAP: set up & load photon maps */
353 >                
354 >                marksources();          /* find and mark sources */
355 >
356 >                setambient();           /* initialize ambient calculation */
357 >        } else
358 >                distantsources();       /* else mark only distant sources */
359 >
360 >        fflush(stdout);                 /* in case we're duplicating header */
361 >
362   #ifdef  PERSIST
363          if (persist) {
334                fflush(stdout);
364                                                  /* reconnect stdout */
365                  dup2(duped1, fileno(stdout));
366                  close(duped1);
# Line 391 | Line 420 | badopt:
420  
421   void
422   wputs(                          /* warning output function */
423 <        char    *s
423 >        const char      *s
424   )
425   {
426          int  lasterrno = errno;
# Line 402 | Line 431 | wputs(                         /* warning output function */
431  
432   void
433   eputs(                          /* put string to stderr */
434 <        register char  *s
434 >        const char  *s
435   )
436   {
437          static int  midline = 0;
# Line 457 | Line 486 | sigdie(                        /* set fatal signal */
486   static void
487   printdefaults(void)                     /* print default values to stdout */
488   {
489 <        register char  *cp;
489 >        char  *cp;
490  
491          if (imm_irrad)
492                  printf("-I+\t\t\t\t# immediate irradiance on\n");
# Line 493 | Line 522 | printdefaults(void)                    /* print default values to stdou
522                  case 'W': printf(" coefficient"); break;
523                  case 'm': printf(" modifier"); break;
524                  case 'M': printf(" material"); break;
525 <                case '-': printf(" stroke"); break;
525 >                case '~': printf(" tilde"); break;
526                  }
527          putchar('\n');
528          printf(erract[WARNING].pf != NULL ?

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines