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

Comparing ray/src/rt/mkpmap.c (file contents):
Revision 2.5 by rschregle, Tue May 17 17:39:47 2016 UTC vs.
Revision 2.6 by rschregle, Mon Aug 14 21:12:10 2017 UTC

# Line 2 | Line 2
2   static const char RCSid[] = "$Id$";
3   #endif
4  
5 +
6   /*
7     ======================================================================
8     Photon map generator
# Line 17 | Line 18 | static const char RCSid[] = "$Id$";
18   */
19  
20  
20
21   #include "pmap.h"
22   #include "pmapmat.h"
23   #include "pmapcontrib.h"
# Line 30 | Line 30 | static const char RCSid[] = "$Id$";
30   #include <sys/stat.h>
31  
32  
33
33   extern char VersionID [];
34  
35  
37
36   char*    progname;                  /* argv[0] */
37   int      dimlist [MAXDIM];          /* sampling dimensions */
38   int      ndims = 0;                 /* number of sampling dimenshunns */
# Line 57 | Line 55 | unsigned nproc = 1;                 /* number of paral
55   #endif
56  
57  
60
58   /* Dummies for linkage */
59  
60   COLOR ambval = BLKCOLOR;
# Line 70 | Line 67 | int ambvwt = 0, ambssamp = 0, ambres = 32, ambounce =
67   char *shm_boundary = NULL, *ambfile = NULL, *RCCONTEXT = NULL;
68   void (*trace)() = NULL, (*addobjnotify [])() = {ambnotify, NULL};
69  
73
70    
71   void printdefaults()
72   /* print default values to stdout */
# Line 79 | Line 75 | void printdefaults()
75     puts("-apc file nPhotons\t\t# caustic photon map");          
76     puts("-apd file nPhotons\t\t# direct photon map");
77     puts("-app file nPhotons bwidth\t# precomputed global photon map");
82 #if 0
83   /* Hide this option as most likely useless and confusing to user */
84   puts("-appb file nPhotons minBw maxBw\t# precomp bias comp global pmap");
85 #endif
78     puts("-apv file nPhotons\t\t# volume photon map");
79     puts("-apC file nPhotons\t\t# contribution photon map");
80    
# Line 101 | Line 93 | void printdefaults()
93     printf("-dp  %.1f\t\t\t# PDF samples / sr\n", pdfSamples);
94     printf("-ds  %f\t\t\t# source partition size ratio\n", srcsizerat);
95     printf("-e   %s\t\t\t# diagnostics output file\n", diagFile);
96 <   printf(clobber ? "-fo+\t\t\t\t# force overwrite"
96 >   printf(clobber ? "-fo+\t\t\t\t# force overwrite\n"
97                    : "-fo-\t\t\t\t# do not overwrite\n");
106 #if 0
107   /* Heap size increment now fixed & defined by macro in pmapkdt.c */
108   printf("-i   %-9ld\t\t\t# photon heap size increment\n",
109          photonHeapSizeInc);
110 #endif          
98     printf("-ma  %.2f %.2f %.2f\t\t# scattering albedo\n",
99            colval(salbedo,RED), colval(salbedo,GRN), colval(salbedo,BLU));
100     printf("-me  %.2e %.2e %.2e\t# extinction coefficient\n",
101            colval(cextinction,RED), colval(cextinction,GRN),
102            colval(cextinction,BLU));          
103     printf("-mg  %.2f\t\t\t# scattering eccentricity\n", seccg);
104 + #if NIX  
105 +   /* Multiprocessing on NIX only */
106     printf("-n   %d\t\t\t\t# number of parallel processes\n", nproc);
107 + #endif  
108     printf("-t   %-9d\t\t\t# time between reports\n", photonRepTime);
109 <
109 >   printf(verbose ? "-v+\t\t\t\t# verbose console output\n"
110 >                  : "-v-\t\t\t\t# terse console output\n");
111   #ifdef PMAP_ROI
112     /* Ziss option for ze egg-spurtz only! */
113 <   printf("-api \t%.0e %.0e %.0e\n\t%.0e %.0e %.0e\t# region of interest\n",
123 <          pmapROI [0], pmapROI [1], pmapROI [2], pmapROI [3],
124 <          pmapROI [4], pmapROI [5]);
113 >   puts("-api xmin ymin zmin\n     xmax ymax zmax\t\t# region of interest");
114   #endif  
126
115   #ifdef EVALDRC_HACK
116     /* ... and ziss one... */
117     puts("-A\t\t\t\t# angular source file");
# Line 131 | Line 119 | void printdefaults()
119   }
120  
121  
134
135
122   int main (int argc, char* argv [])
123   {
124     #define check(ol, al) if (argv [i][ol] || \
# Line 200 | Line 186 | int main (int argc, char* argv [])
186                                
187              else if (!strcmp(argv [i] + 2, "pm")) {
188                 /* Max photon bounces */
189 <               check(4, "i");
189 >               check(4, "i");              
190                 photonMaxBounce = atol(argv [++i]);
191 <               if (!photonMaxBounce)
192 <                  goto badopt;
191 >               if (photonMaxBounce <= 0)
192 >                  error(USER, "max photon bounces must be > 0");
193              }
194              
195              else if (!strcmp(argv [i] + 2, "pp")) {
# Line 220 | Line 206 | int main (int argc, char* argv [])
206                    goto badopt;
207              }
208              
223 #if 0
224            else if (!strcmp(argv [i] + 2, "ppb")) {
225               /* Precomputed global photon map + bias comp. */
226               check(5, "ssii");
227               preCompPmapParams.fileName = argv [++i];
228               preCompPmapParams.distribTarget =
229                  parseMultiplier(argv [++i]);
230               if (!preCompPmapParams.distribTarget)
231                  goto badopt;                      
232               preCompPmapParams.minGather = atoi(argv [++i]);
233               preCompPmapParams.maxGather = atoi(argv [++i]);
234               if (!preCompPmapParams.minGather ||
235                   preCompPmapParams.minGather >=
236                   preCompPmapParams.maxGather)
237                  goto badopt;
238            }
239 #endif
240            
209              else if (!strcmp(argv [i] + 2, "pc")) {
210                 /* Caustic photon map */
211                 check(4, "ss");
# Line 284 | Line 252 | int main (int argc, char* argv [])
252                 preDistrib = atof(argv [++i]);
253                 if (preDistrib <= 0)
254                    error(USER, "predistribution factor must be > 0");
255 <            }  
255 >            }
256 >            
257 >            else if (!strcmp(argv [i] + 2, "pM")) {
258 >               /* Max predistribution passes */
259 >               check(4, "i");
260 >               maxPreDistrib = atoi(argv [++i]);
261 >               if (maxPreDistrib <= 0)
262 >                  error(USER, "max predistribution passes must be > 0");
263 >            }
264  
265   #ifdef PMAP_ROI
266 <            /* Region of interest; ziss option for ze egg-spurtz only! */
266 >            /* Add region of interest; for ze egg-spurtz only! */
267              else if (!strcmp(argv [i] + 2, "pi")) {
268 <               int j;
268 >               unsigned j, n = pmapNumROI;
269                 check(4, "ffffff");
270 <               for (j = 0; j < 6; j++)
271 <                  pmapROI [j] = atof(argv [++i]);
272 <            }              
270 >              
271 >               pmapROI = realloc(pmapROI,
272 >                                 ++pmapNumROI * sizeof(PhotonMapROI));
273 >               if (!pmapROI)
274 > 1                  error(SYSTEM, "failed to allocate ROI");
275 >                  
276 >               pmapROI [n].min [0] = atof(argv [++i]);
277 >               pmapROI [n].min [1] = atof(argv [++i]);
278 >               pmapROI [n].min [2] = atof(argv [++i]);
279 >               pmapROI [n].max [0] = atof(argv [++i]);
280 >               pmapROI [n].max [1] = atof(argv [++i]);
281 >               pmapROI [n].max [2] = atof(argv [++i]);
282 >              
283 >               for (j = 0; j < 3; j++)
284 >                  if (pmapROI [n].min [j] >= pmapROI [n].max [j])
285 >                     error(USER,
286 >                           "invalid region of interest (swapped min/max?)");
287 >            }
288   #endif
289              
290              else if (!strcmp(argv [i] + 2, "pP")) {
# Line 316 | Line 307 | int main (int argc, char* argv [])
307                 }
308                
309                 if (argv[i][3] == 'O') {
310 <                  /* Get port modifiers file */
310 >                  /* Get port modifiers from file */
311                    rval = wordfile(portLp, AMBLLEN-(portLp-amblist),
312                                    getpath(argv [++i], getrlibpath(), R_OK));
313                                    
# Line 410 | Line 401 | int main (int argc, char* argv [])
401              else goto badopt;
402              break;
403  
413 #if 0
414         /* Heap size increment now fixed & defined by macro in pmapkdt.c */            
415         case 'i': /* Photon heap size increment */
416            check(2, "i");
417            photonHeapSizeInc = atol(argv [++i]);
418            break;
419 #endif            
420                  
404           case 'm': /* Medium */
405              switch (argv[i][2]) {
406                 case 'e':        /* Eggs-tinction coefficient */
# Line 442 | Line 425 | int main (int argc, char* argv [])
425                 default: goto badopt;
426              }                  
427              break;
428 <
429 <         case 'n': /* Num parallel processes */
428 > #if NIX
429 >         case 'n': /* Num parallel processes (NIX only) */
430              check(2, "i");
431              nproc = atoi(argv [++i]);
432              
# Line 452 | Line 435 | int main (int argc, char* argv [])
435                 sprintf(errmsg, "too many parallel processes, clamping to "
436                         "%d\n", nproc);
437                 error(WARNING, errmsg);
438 <            }
456 <            
438 >            }            
439              break;                  
440 <            
440 > #endif                        
441           case 't': /* Timer */
442              check(2, "i");
443              photonRepTime = atoi(argv [++i]);
444              break;
445 <
445 >            
446 >         case 'v':   /* Verbosity */
447 >            check_bool(2, verbose);
448 >            break;            
449   #ifdef EVALDRC_HACK
450           case 'A':   /* Angular source file */
451              check(2,"s");
452              angsrcfile = argv[++i];
453              break;                  
454 < #endif
470 <                  
454 > #endif                              
455           default: goto badopt;
456        }
457     }
# Line 507 | Line 491 | int main (int argc, char* argv [])
491        error(USER, "no photon maps specified");
492    
493     readoct(octname, loadflags, &thescene, NULL);
510
494   #ifdef EVALDRC_HACK  
495     if (angsrcfile)
496        readobj(angsrcfile);    /* load angular sources */
497 < #endif      
515 <      
497 > #endif        
498     nsceneobjs = nobjects;
499    
500     /* Get sources */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines