ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/rcmain.c
(Generate patch)

Comparing ray/src/rt/rcmain.c (file contents):
Revision 2.12 by greg, Sat Jul 19 18:19:33 2014 UTC vs.
Revision 2.20 by greg, Tue Feb 16 20:06:06 2021 UTC

# Line 13 | Line 13 | static const char      RCSid[] = "$Id$";
13   #include "random.h"
14   #include "source.h"
15   #include "ambient.h"
16 + #include "pmapray.h"
17 + #include "pmapcontrib.h"
18  
19   int     gargc;                          /* global argc */
20   char    **gargv;                        /* global argv */
# Line 41 | Line 43 | int    using_stdout = 0;               /* are we using stdout? */
43   int     imm_irrad = 0;                  /* compute immediate irradiance? */
44   int     lim_dist = 0;                   /* limit distance? */
45  
46 < const char      *modname[MAXMODLIST];   /* ordered modifier name list */
45 < int             nmods = 0;              /* number of modifiers */
46 > int     report_intvl = 0;               /* reporting interval (seconds) */
47  
48 + char    **modname = NULL;               /* ordered modifier name list */
49 + int     nmods = 0;                      /* number of modifiers */
50 + int     modasiz = 0;                    /* allocated modifier array size */
51 +
52   void    (*addobjnotify[8])() = {ambnotify, NULL};
53  
54 < char    RCCONTEXT[] = "RC";             /* our special evaluation context */
54 > char    RCCONTEXT[] = "RC.";            /* our special evaluation context */
55  
56  
57   static void
# Line 161 | Line 166 | main(int argc, char *argv[])
166   #define  check(ol,al)           if (argv[i][ol] || \
167                                  badarg(argc-i-1,argv+i+1,al)) \
168                                  goto badopt
169 < #define  bool(olen,var)         switch (argv[i][olen]) { \
169 > #define  check_bool(olen,var)           switch (argv[i][olen]) { \
170                                  case '\0': var = !var; break; \
171                                  case 'y': case 'Y': case 't': case 'T': \
172                                  case '+': case '1': var = 1; break; \
# Line 178 | Line 183 | main(int argc, char *argv[])
183          progname = argv[0] = fixargv0(argv[0]);
184          gargv = argv;
185          gargc = argc;
186 + #if defined(_WIN32) || defined(_WIN64)
187 +        _setmaxstdio(2048);             /* increase file limit to maximum */
188 + #endif
189                                          /* initialize calcomp routines early */
190          initfunc();
191          setcontext(RCCONTEXT);
# Line 215 | Line 223 | main(int argc, char *argv[])
223                                  error(USER, "bad number of processes");
224                          break;
225                  case 'V':                       /* output contributions */
226 <                        bool(2,contrib);
226 >                        check_bool(2,contrib);
227                          break;
228                  case 'x':                       /* x resolution */
229                          check(2,"i");
# Line 227 | Line 235 | main(int argc, char *argv[])
235                          break;
236                  case 'w':                       /* warnings */
237                          rval = (erract[WARNING].pf != NULL);
238 <                        bool(2,rval);
238 >                        check_bool(2,rval);
239                          if (rval) erract[WARNING].pf = wputs;
240                          else erract[WARNING].pf = NULL;
241                          break;
# Line 238 | Line 246 | main(int argc, char *argv[])
246                  case 'l':                       /* limit distance */
247                          if (argv[i][2] != 'd')
248                                  goto badopt;
249 <                        bool(3,lim_dist);
249 >                        check_bool(3,lim_dist);
250                          break;
251                  case 'I':                       /* immed. irradiance */
252 <                        bool(2,imm_irrad);
252 >                        check_bool(2,imm_irrad);
253                          break;
254                  case 'f':                       /* file or force or format */
255                          if (!argv[i][2]) {
# Line 250 | Line 258 | main(int argc, char *argv[])
258                                  break;
259                          }
260                          if (argv[i][2] == 'o') {
261 <                                bool(3,force_open);
261 >                                check_bool(3,force_open);
262                                  break;
263                          }
264                          setformat(argv[i]+2);
# Line 264 | Line 272 | main(int argc, char *argv[])
272                          accumulate = atoi(argv[++i]);
273                          break;
274                  case 'r':                       /* recover output */
275 <                        bool(2,recover);
275 >                        check_bool(2,recover);
276                          break;
277                  case 'h':                       /* header output */
278 <                        bool(2,header);
278 >                        check_bool(2,header);
279                          break;
280                  case 'p':                       /* parameter setting(s) */
281                          check(2,"s");
282 <                        prms = argv[++i];
282 >                        set_eparams(prms = argv[++i]);
283                          break;
284                  case 'b':                       /* bin expression/count */
285                          if (argv[i][2] == 'n') {
# Line 290 | Line 298 | main(int argc, char *argv[])
298                          check(2,"s");
299                          addmodfile(argv[++i], curout, prms, binval, bincnt);
300                          break;
301 +                case 't':                       /* reporting interval */
302 +                        check(2,"i");
303 +                        report_intvl = atoi(argv[++i]);
304 +                        break;
305                  default:
306                          goto badopt;
307                  }
# Line 340 | Line 352 | main(int argc, char *argv[])
352          readoct(octname, ~(IO_FILES|IO_INFO), &thescene, NULL);
353          nsceneobjs = nobjects;
354  
355 +        /* PMAP: set up & load photon maps */
356 +        ray_init_pmap();    
357 +        
358          marksources();                  /* find and mark sources */
359 +        
360 +        /* PMAP: init photon map for light source contributions */
361 +        initPmapContrib(&modconttab, nmods);
362  
363          setambient();                   /* initialize ambient calculation */
364 <
364 >        
365          rcontrib();                     /* trace ray contributions (loop) */
366  
367          ambsync();                      /* flush ambient file */
368  
369 +        /* PMAP: free photon maps */
370 +        ray_done_pmap();    
371 +        
372          quit(0);        /* exit clean */
373  
374   badopt:
375          fprintf(stderr,
376 < "Usage: %s [-n nprocs][-V][-r][-e expr][-f source][-o ospec][-p p1=V1,p2=V2][-b binv][-bn N] {-m mod | -M file} [rtrace options] octree\n",
376 > "Usage: %s [-n nprocs][-V][-c count][-r][-e expr][-f source][-o ospec][-p p1=V1,p2=V2][-b binv][-bn N] {-m mod | -M file} [rtrace options] octree\n",
377                          progname);
378          sprintf(errmsg, "command line error at '%s'", argv[i]);
379          error(USER, errmsg);
380          return(1);      /* pro forma return */
381  
382   #undef  check
383 < #undef  bool
383 > #undef  check_bool
384   }
385  
386  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines