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.8 by greg, Wed Jun 27 15:32:58 2012 UTC vs.
Revision 2.19 by greg, Wed Sep 9 21:28:19 2020 UTC

# Line 8 | Line 8 | static const char      RCSid[] = "$Id$";
8   #include "copyright.h"
9  
10   #include <signal.h>
11 + #include <time.h>
12   #include "rcontrib.h"
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 40 | 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 + int     report_intvl = 0;               /* reporting interval (seconds) */
47 +
48   const char      *modname[MAXMODLIST];   /* ordered modifier name list */
49   int             nmods = 0;              /* number of modifiers */
50  
51   void    (*addobjnotify[8])() = {ambnotify, NULL};
52  
53 < char    RCCONTEXT[] = "RCONTRIB";       /* our special evaluation context */
53 > char    RCCONTEXT[] = "RC.";            /* our special evaluation context */
54  
55  
56   static void
57   printdefaults(void)                     /* print default values to stdout */
58   {
54        char  *cp;
55
59          printf("-c %-5d\t\t\t# accumulated rays per record\n", accumulate);
60          printf("-V%c\t\t\t\t# output %s\n", contrib ? '+' : '-',
61                          contrib ? "contributions" : "coefficients");
# Line 162 | Line 165 | main(int argc, char *argv[])
165   #define  check(ol,al)           if (argv[i][ol] || \
166                                  badarg(argc-i-1,argv+i+1,al)) \
167                                  goto badopt
168 < #define  bool(olen,var)         switch (argv[i][olen]) { \
168 > #define  check_bool(olen,var)           switch (argv[i][olen]) { \
169                                  case '\0': var = !var; break; \
170                                  case 'y': case 'Y': case 't': case 'T': \
171                                  case '+': case '1': var = 1; break; \
# Line 170 | Line 173 | main(int argc, char *argv[])
173                                  case '-': case '0': var = 0; break; \
174                                  default: goto badopt; }
175          char    *curout = NULL;
176 +        char    *prms = NULL;
177          char    *binval = NULL;
178          int     bincnt = 0;
179          int     rval;
# Line 178 | Line 182 | main(int argc, char *argv[])
182          progname = argv[0] = fixargv0(argv[0]);
183          gargv = argv;
184          gargc = argc;
185 + #if defined(_WIN32) || defined(_WIN64)
186 +        _setmaxstdio(2048);             /* increase file limit to maximum */
187 + #endif
188                                          /* initialize calcomp routines early */
189          initfunc();
190          setcontext(RCCONTEXT);
# Line 215 | Line 222 | main(int argc, char *argv[])
222                                  error(USER, "bad number of processes");
223                          break;
224                  case 'V':                       /* output contributions */
225 <                        bool(2,contrib);
225 >                        check_bool(2,contrib);
226                          break;
227                  case 'x':                       /* x resolution */
228                          check(2,"i");
# Line 227 | Line 234 | main(int argc, char *argv[])
234                          break;
235                  case 'w':                       /* warnings */
236                          rval = (erract[WARNING].pf != NULL);
237 <                        bool(2,rval);
237 >                        check_bool(2,rval);
238                          if (rval) erract[WARNING].pf = wputs;
239                          else erract[WARNING].pf = NULL;
240                          break;
# Line 238 | Line 245 | main(int argc, char *argv[])
245                  case 'l':                       /* limit distance */
246                          if (argv[i][2] != 'd')
247                                  goto badopt;
248 <                        bool(3,lim_dist);
248 >                        check_bool(3,lim_dist);
249                          break;
250                  case 'I':                       /* immed. irradiance */
251 <                        bool(2,imm_irrad);
251 >                        check_bool(2,imm_irrad);
252                          break;
253                  case 'f':                       /* file or force or format */
254                          if (!argv[i][2]) {
# Line 250 | Line 257 | main(int argc, char *argv[])
257                                  break;
258                          }
259                          if (argv[i][2] == 'o') {
260 <                                bool(3,force_open);
260 >                                check_bool(3,force_open);
261                                  break;
262                          }
263                          setformat(argv[i]+2);
# Line 264 | Line 271 | main(int argc, char *argv[])
271                          accumulate = atoi(argv[++i]);
272                          break;
273                  case 'r':                       /* recover output */
274 <                        bool(2,recover);
274 >                        check_bool(2,recover);
275                          break;
276                  case 'h':                       /* header output */
277 <                        bool(2,header);
277 >                        check_bool(2,header);
278                          break;
279 +                case 'p':                       /* parameter setting(s) */
280 +                        check(2,"s");
281 +                        set_eparams(prms = argv[++i]);
282 +                        break;
283                  case 'b':                       /* bin expression/count */
284                          if (argv[i][2] == 'n') {
285                                  check(3,"s");
# Line 280 | Line 291 | main(int argc, char *argv[])
291                          break;
292                  case 'm':                       /* modifier name */
293                          check(2,"s");
294 <                        addmodifier(argv[++i], curout, binval, bincnt);
294 >                        addmodifier(argv[++i], curout, prms, binval, bincnt);
295                          break;
296                  case 'M':                       /* modifier file */
297                          check(2,"s");
298 <                        addmodfile(argv[++i], curout, binval, bincnt);
298 >                        addmodfile(argv[++i], curout, prms, binval, bincnt);
299                          break;
300 +                case 't':                       /* reporting interval */
301 +                        check(2,"i");
302 +                        report_intvl = atoi(argv[++i]);
303 +                        break;
304                  default:
305                          goto badopt;
306                  }
307          }
308 +        if (nmods <= 0)
309 +                error(USER, "missing required modifier argument");
310                                          /* override some option settings */
311          override_options();
312                                          /* initialize object types */
# Line 334 | Line 351 | main(int argc, char *argv[])
351          readoct(octname, ~(IO_FILES|IO_INFO), &thescene, NULL);
352          nsceneobjs = nobjects;
353  
354 +        /* PMAP: set up & load photon maps */
355 +        ray_init_pmap();    
356 +        
357          marksources();                  /* find and mark sources */
358 +        
359 +        /* PMAP: init photon map for light source contributions */
360 +        initPmapContrib(&modconttab, nmods);
361  
362          setambient();                   /* initialize ambient calculation */
363 <
363 >        
364          rcontrib();                     /* trace ray contributions (loop) */
365  
366          ambsync();                      /* flush ambient file */
367  
368 +        /* PMAP: free photon maps */
369 +        ray_done_pmap();    
370 +        
371          quit(0);        /* exit clean */
372  
373   badopt:
374          fprintf(stderr,
375 < "Usage: %s [-n nprocs][-V][-r][-e expr][-f source][-o ospec][-b binv][-bn N] {-m mod | -M file} [rtrace options] octree\n",
375 > "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",
376                          progname);
377          sprintf(errmsg, "command line error at '%s'", argv[i]);
378          error(USER, errmsg);
379          return(1);      /* pro forma return */
380  
381   #undef  check
382 < #undef  bool
382 > #undef  check_bool
383   }
384  
385  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines