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.30 by greg, Fri Apr 7 15:00:11 2023 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 + #if defined(_WIN32) || defined(_WIN64)
57 + #define RCONTRIB_FEATURES       "Accumulation\nSummation\nRecovery\n" \
58 +                                "ValueContribution\nImmediateIrradiance\n" \
59 +                                "ProgressReporting\nDistanceLimiting\n" \
60 +                                "Outputs=V,W\n"
61 + #else
62 + #define RCONTRIB_FEATURES       "Multiprocessing\n" \
63 +                                "Accumulation\nSummation\nRecovery\n" \
64 +                                "ValueContribution\nImmediateIrradiance\n" \
65 +                                "ProgressReporting\nDistanceLimiting\n" \
66 +                                "Outputs=V,W\n"
67 + #endif
68  
69   static void
70   printdefaults(void)                     /* print default values to stdout */
# Line 161 | Line 178 | main(int argc, char *argv[])
178   #define  check(ol,al)           if (argv[i][ol] || \
179                                  badarg(argc-i-1,argv+i+1,al)) \
180                                  goto badopt
181 < #define  bool(olen,var)         switch (argv[i][olen]) { \
181 > #define  check_bool(olen,var)           switch (argv[i][olen]) { \
182                                  case '\0': var = !var; break; \
183                                  case 'y': case 'Y': case 't': case 'T': \
184                                  case '+': case '1': var = 1; break; \
# Line 178 | Line 195 | main(int argc, char *argv[])
195          progname = argv[0] = fixargv0(argv[0]);
196          gargv = argv;
197          gargc = argc;
198 +                                        /* feature check only? */
199 +        strcat(RFeatureList, RCONTRIB_FEATURES);
200 +        if (argc > 1 && !strcmp(argv[1], "-features"))
201 +                return feature_status(argc-2, argv+2);
202 + #if defined(_WIN32) || defined(_WIN64)  /* increase file limit to maximum */
203 +        for (i = 8192; i > _IOB_ENTRIES; i >>= 1)
204 +                if (_setmaxstdio(i) == i)
205 +                        break;
206 + #endif
207                                          /* initialize calcomp routines early */
208          initfunc();
209 <        setcontext(RCCONTEXT);
209 >        calcontext(RCCONTEXT);
210                                          /* option city */
211          for (i = 1; i < argc; i++) {
212                                                  /* expand arguments */
# Line 215 | Line 241 | main(int argc, char *argv[])
241                                  error(USER, "bad number of processes");
242                          break;
243                  case 'V':                       /* output contributions */
244 <                        bool(2,contrib);
244 >                        check_bool(2,contrib);
245                          break;
246                  case 'x':                       /* x resolution */
247                          check(2,"i");
# Line 227 | Line 253 | main(int argc, char *argv[])
253                          break;
254                  case 'w':                       /* warnings */
255                          rval = (erract[WARNING].pf != NULL);
256 <                        bool(2,rval);
256 >                        check_bool(2,rval);
257                          if (rval) erract[WARNING].pf = wputs;
258                          else erract[WARNING].pf = NULL;
259                          break;
# Line 238 | Line 264 | main(int argc, char *argv[])
264                  case 'l':                       /* limit distance */
265                          if (argv[i][2] != 'd')
266                                  goto badopt;
267 <                        bool(3,lim_dist);
267 >                        check_bool(3,lim_dist);
268                          break;
269                  case 'I':                       /* immed. irradiance */
270 <                        bool(2,imm_irrad);
270 >                        check_bool(2,imm_irrad);
271                          break;
272                  case 'f':                       /* file or force or format */
273                          if (!argv[i][2]) {
# Line 250 | Line 276 | main(int argc, char *argv[])
276                                  break;
277                          }
278                          if (argv[i][2] == 'o') {
279 <                                bool(3,force_open);
279 >                                check_bool(3,force_open);
280                                  break;
281                          }
282                          setformat(argv[i]+2);
# Line 264 | Line 290 | main(int argc, char *argv[])
290                          accumulate = atoi(argv[++i]);
291                          break;
292                  case 'r':                       /* recover output */
293 <                        bool(2,recover);
293 >                        check_bool(2,recover);
294                          break;
295                  case 'h':                       /* header output */
296 <                        bool(2,header);
296 >                        check_bool(2,header);
297                          break;
298                  case 'p':                       /* parameter setting(s) */
299                          check(2,"s");
300 <                        prms = argv[++i];
300 >                        set_eparams(prms = argv[++i]);
301                          break;
302                  case 'b':                       /* bin expression/count */
303                          if (argv[i][2] == 'n') {
# Line 290 | Line 316 | main(int argc, char *argv[])
316                          check(2,"s");
317                          addmodfile(argv[++i], curout, prms, binval, bincnt);
318                          break;
319 +                case 't':                       /* reporting interval */
320 +                        check(2,"i");
321 +                        report_intvl = atoi(argv[++i]);
322 +                        break;
323                  default:
324                          goto badopt;
325                  }
# Line 340 | Line 370 | main(int argc, char *argv[])
370          readoct(octname, ~(IO_FILES|IO_INFO), &thescene, NULL);
371          nsceneobjs = nobjects;
372  
373 +        /* PMAP: set up & load photon maps */
374 +        ray_init_pmap();    
375 +        
376          marksources();                  /* find and mark sources */
377 +        
378 +        /* PMAP: init photon map for light source contributions */
379 +        initPmapContrib(&modconttab, nmods);
380  
381          setambient();                   /* initialize ambient calculation */
382 <
382 >        
383          rcontrib();                     /* trace ray contributions (loop) */
384  
385          ambsync();                      /* flush ambient file */
386  
387 +        /* PMAP: free photon maps */
388 +        ray_done_pmap();    
389 +        
390          quit(0);        /* exit clean */
391  
392   badopt:
393          fprintf(stderr,
394 < "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",
394 > "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",
395                          progname);
396          sprintf(errmsg, "command line error at '%s'", argv[i]);
397          error(USER, errmsg);
398          return(1);      /* pro forma return */
399  
400   #undef  check
401 < #undef  bool
401 > #undef  check_bool
402   }
403  
404  
405   void
406   wputs(                          /* warning output function */
407 <        char    *s
407 >        const char      *s
408   )
409   {
410          int  lasterrno = errno;
# Line 376 | Line 415 | wputs(                         /* warning output function */
415  
416   void
417   eputs(                          /* put string to stderr */
418 <        char  *s
418 >        const char  *s
419   )
420   {
421          static int  midline = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines