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.10 by greg, Wed Aug 7 05:10:09 2013 UTC vs.
Revision 2.18 by greg, Thu Jan 18 19:43:43 2018 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 46 | Line 48 | int            nmods = 0;              /* number of modifiers */
48  
49   void    (*addobjnotify[8])() = {ambnotify, NULL};
50  
51 < char    RCCONTEXT[] = "RC";             /* our special evaluation context */
51 > char    RCCONTEXT[] = "RC.";            /* our special evaluation context */
52  
53  
54   static void
# Line 161 | Line 163 | main(int argc, char *argv[])
163   #define  check(ol,al)           if (argv[i][ol] || \
164                                  badarg(argc-i-1,argv+i+1,al)) \
165                                  goto badopt
166 < #define  bool(olen,var)         switch (argv[i][olen]) { \
166 > #define  check_bool(olen,var)           switch (argv[i][olen]) { \
167                                  case '\0': var = !var; break; \
168                                  case 'y': case 'Y': case 't': case 'T': \
169                                  case '+': case '1': var = 1; break; \
# Line 169 | Line 171 | main(int argc, char *argv[])
171                                  case '-': case '0': var = 0; break; \
172                                  default: goto badopt; }
173          char    *curout = NULL;
174 +        char    *prms = NULL;
175          char    *binval = NULL;
176          int     bincnt = 0;
177          int     rval;
# Line 177 | Line 180 | main(int argc, char *argv[])
180          progname = argv[0] = fixargv0(argv[0]);
181          gargv = argv;
182          gargc = argc;
183 + #if defined(_WIN32) || defined(_WIN64)
184 +        _setmaxstdio(2048);             /* increase file limit to maximum */
185 + #endif
186                                          /* initialize calcomp routines early */
187          initfunc();
188          setcontext(RCCONTEXT);
# Line 214 | Line 220 | main(int argc, char *argv[])
220                                  error(USER, "bad number of processes");
221                          break;
222                  case 'V':                       /* output contributions */
223 <                        bool(2,contrib);
223 >                        check_bool(2,contrib);
224                          break;
225                  case 'x':                       /* x resolution */
226                          check(2,"i");
# Line 226 | Line 232 | main(int argc, char *argv[])
232                          break;
233                  case 'w':                       /* warnings */
234                          rval = (erract[WARNING].pf != NULL);
235 <                        bool(2,rval);
235 >                        check_bool(2,rval);
236                          if (rval) erract[WARNING].pf = wputs;
237                          else erract[WARNING].pf = NULL;
238                          break;
# Line 237 | Line 243 | main(int argc, char *argv[])
243                  case 'l':                       /* limit distance */
244                          if (argv[i][2] != 'd')
245                                  goto badopt;
246 <                        bool(3,lim_dist);
246 >                        check_bool(3,lim_dist);
247                          break;
248                  case 'I':                       /* immed. irradiance */
249 <                        bool(2,imm_irrad);
249 >                        check_bool(2,imm_irrad);
250                          break;
251                  case 'f':                       /* file or force or format */
252                          if (!argv[i][2]) {
# Line 249 | Line 255 | main(int argc, char *argv[])
255                                  break;
256                          }
257                          if (argv[i][2] == 'o') {
258 <                                bool(3,force_open);
258 >                                check_bool(3,force_open);
259                                  break;
260                          }
261                          setformat(argv[i]+2);
# Line 263 | Line 269 | main(int argc, char *argv[])
269                          accumulate = atoi(argv[++i]);
270                          break;
271                  case 'r':                       /* recover output */
272 <                        bool(2,recover);
272 >                        check_bool(2,recover);
273                          break;
274                  case 'h':                       /* header output */
275 <                        bool(2,header);
275 >                        check_bool(2,header);
276                          break;
277 +                case 'p':                       /* parameter setting(s) */
278 +                        check(2,"s");
279 +                        set_eparams(prms = argv[++i]);
280 +                        break;
281                  case 'b':                       /* bin expression/count */
282                          if (argv[i][2] == 'n') {
283                                  check(3,"s");
# Line 279 | Line 289 | main(int argc, char *argv[])
289                          break;
290                  case 'm':                       /* modifier name */
291                          check(2,"s");
292 <                        addmodifier(argv[++i], curout, binval, bincnt);
292 >                        addmodifier(argv[++i], curout, prms, binval, bincnt);
293                          break;
294                  case 'M':                       /* modifier file */
295                          check(2,"s");
296 <                        addmodfile(argv[++i], curout, binval, bincnt);
296 >                        addmodfile(argv[++i], curout, prms, binval, bincnt);
297                          break;
298                  default:
299                          goto badopt;
300                  }
301          }
302 +        if (nmods <= 0)
303 +                error(USER, "missing required modifier argument");
304                                          /* override some option settings */
305          override_options();
306                                          /* initialize object types */
# Line 333 | Line 345 | main(int argc, char *argv[])
345          readoct(octname, ~(IO_FILES|IO_INFO), &thescene, NULL);
346          nsceneobjs = nobjects;
347  
348 +        /* PMAP: set up & load photon maps */
349 +        ray_init_pmap();    
350 +        
351          marksources();                  /* find and mark sources */
352 +        
353 +        /* PMAP: init photon map for light source contributions */
354 +        initPmapContrib(&modconttab, nmods);
355  
356          setambient();                   /* initialize ambient calculation */
357 <
357 >        
358          rcontrib();                     /* trace ray contributions (loop) */
359  
360          ambsync();                      /* flush ambient file */
361  
362 +        /* PMAP: free photon maps */
363 +        ray_done_pmap();    
364 +        
365          quit(0);        /* exit clean */
366  
367   badopt:
368          fprintf(stderr,
369 < "Usage: %s [-n nprocs][-V][-r][-e expr][-f source][-o ospec][-b binv][-bn N] {-m mod | -M file} [rtrace options] octree\n",
369 > "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",
370                          progname);
371          sprintf(errmsg, "command line error at '%s'", argv[i]);
372          error(USER, errmsg);
373          return(1);      /* pro forma return */
374  
375   #undef  check
376 < #undef  bool
376 > #undef  check_bool
377   }
378  
379  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines