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.19 by greg, Sun Dec 13 19:13:04 2009 UTC vs.
Revision 2.26 by schorsch, Thu Mar 10 18:25:46 2016 UTC

# Line 17 | Line 17 | static const char      RCSid[] = "$Id$";
17   #include  "ambient.h"
18   #include  "random.h"
19   #include  "paths.h"
20 + #include  "pmapray.h"
21  
22   extern char     *progname;              /* global argv[0] */
23  
# Line 68 | Line 69 | main(int  argc, char  *argv[])
69   #define  check(ol,al)           if (argv[i][ol] || \
70                                  badarg(argc-i-1,argv+i+1,al)) \
71                                  goto badopt
72 < #define  bool(olen,var)         switch (argv[i][olen]) { \
72 > #define  check_bool(olen,var)           switch (argv[i][olen]) { \
73                                  case '\0': var = !var; break; \
74                                  case 'y': case 'Y': case 't': case 'T': \
75                                  case '+': case '1': var = 1; break; \
76                                  case 'n': case 'N': case 'f': case 'F': \
77                                  case '-': case '0': var = 0; break; \
78                                  default: goto badopt; }
79 +        extern char  *octname;
80          int  persist = 0;
81          char  *octnm = NULL;
82 <        char  **tralp;
83 <        int  duped1;
82 >        char  **tralp = NULL;
83 >        int  duped1 = -1;
84          int  rval;
85          int  i;
86                                          /* global program name */
# Line 88 | Line 90 | main(int  argc, char  *argv[])
90                  ;
91          addobjnotify[i] = tranotify;
92                                          /* set our defaults */
93 +        rand_samp = 1;
94          maxdepth = -10;
95          minweight = 2e-3;
96                                          /* option city */
# Line 132 | Line 135 | main(int  argc, char  *argv[])
135                          break;
136                  case 'w':                               /* warnings */
137                          rval = erract[WARNING].pf != NULL;
138 <                        bool(2,rval);
138 >                        check_bool(2,rval);
139                          if (rval) erract[WARNING].pf = wputs;
140                          else erract[WARNING].pf = NULL;
141                          break;
# Line 143 | Line 146 | main(int  argc, char  *argv[])
146                  case 'l':                               /* limit distance */
147                          if (argv[i][2] != 'd')
148                                  goto badopt;
149 <                        bool(3,lim_dist);
149 >                        check_bool(3,lim_dist);
150                          break;
151                  case 'I':                               /* immed. irradiance */
152 <                        bool(2,imm_irrad);
152 >                        check_bool(2,imm_irrad);
153                          break;
154                  case 'f':                               /* format i/o */
155                          switch (argv[i][2]) {
# Line 178 | Line 181 | main(int  argc, char  *argv[])
181                          break;
182                  case 'h':                               /* header output */
183                          rval = loadflags & IO_INFO;
184 <                        bool(2,rval);
184 >                        check_bool(2,rval);
185                          loadflags = rval ? loadflags | IO_INFO :
186                                          loadflags & ~IO_INFO;
187                          break;
# Line 251 | Line 254 | main(int  argc, char  *argv[])
254          if (nproc > 1) {
255                  if (persist)
256                          error(USER, "multiprocessing incompatible with persist file");
257 <                if (hresolu > 0 && hresolu < nproc)
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");
# Line 313 | Line 316 | main(int  argc, char  *argv[])
316   #endif
317          if (outform != 'a')
318                  SET_FILE_BINARY(stdout);
319 <        readoct(octnm, loadflags, &thescene, NULL);
319 >        readoct(octname = octnm, loadflags, &thescene, NULL);
320          nsceneobjs = nobjects;
321  
322          if (loadflags & IO_INFO) {      /* print header */
# Line 323 | Line 326 | main(int  argc, char  *argv[])
326                  fputformat(formstr(outform), stdout);
327                  putchar('\n');
328          }
329 <
329 >        
330 >        ray_init_pmap();     /* PMAP: set up & load photon maps */
331 >        
332          marksources();                  /* find and mark sources */
333  
334          setambient();                   /* initialize ambient calculation */
335 <
335 >        
336   #ifdef  PERSIST
337          if (persist) {
338                  fflush(stdout);
# Line 373 | Line 378 | runagain:
378                  goto runagain;
379          }
380   #endif
381 +
382 +        ray_done_pmap();           /* PMAP: free photon maps */
383 +        
384          quit(0);
385  
386   badopt:
# Line 381 | Line 389 | badopt:
389          return 1; /* pro forma return */
390  
391   #undef  check
392 < #undef  bool
392 > #undef  check_bool
393   }
394  
395  
# Line 458 | Line 466 | printdefaults(void)                    /* print default values to stdou
466          if (imm_irrad)
467                  printf("-I+\t\t\t\t# immediate irradiance on\n");
468          printf("-n %-2d\t\t\t\t# number of rendering processes\n", nproc);
469 <        printf("-x %-9d\t\t\t# x resolution (flush interval)\n", hresolu);
469 >        printf("-x %-9d\t\t\t# %s\n", hresolu,
470 >                        vresolu && hresolu ? "x resolution" : "flush interval");
471          printf("-y %-9d\t\t\t# y resolution\n", vresolu);
472          printf(lim_dist ? "-ld+\t\t\t\t# limit distance on\n" :
473                          "-ld-\t\t\t\t# limit distance off\n");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines