20 |
|
|
21 |
|
#include "pmap.h" |
22 |
|
#include "pmapmat.h" |
23 |
+ |
#include "pmapsrc.h" |
24 |
|
#include "pmapcontrib.h" |
25 |
|
#include "pmaprand.h" |
26 |
|
#include "paths.h" |
31 |
|
#include <sys/stat.h> |
32 |
|
|
33 |
|
|
34 |
+ |
/* Enable options for Ze Ekspertz only! */ |
35 |
+ |
#define PMAP_EKSPERTZ |
36 |
+ |
|
37 |
+ |
|
38 |
|
extern char VersionID []; |
39 |
|
|
40 |
|
|
50 |
|
COLOR cextinction = BLKCOLOR; /* global extinction coefficient */ |
51 |
|
COLOR salbedo = BLKCOLOR; /* global scattering albedo */ |
52 |
|
double seccg = 0; /* global scattering eccentricity */ |
53 |
< |
int ambincl = -1; /* photon port flag */ |
54 |
< |
char *amblist [AMBLLEN + 1]; /* photon port list */ |
53 |
> |
char *amblist [AMBLLEN + 1]; /* ambient include/exclude list */ |
54 |
> |
int ambincl = -1; /* include == 1, exclude == 0 */ |
55 |
|
char *diagFile = NULL; /* diagnostics output file */ |
56 |
|
int rand_samp = 1; /* uncorrelated random sampling */ |
57 |
|
unsigned nproc = 1; /* number of parallel processes */ |
76 |
|
void printdefaults() |
77 |
|
/* print default values to stdout */ |
78 |
|
{ |
74 |
– |
puts("-apg file nPhotons\t\t# global photon map"); |
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"); |
78 |
– |
puts("-apv file nPhotons\t\t# volume photon map"); |
79 |
– |
puts("-apC file nPhotons\t\t# contribution photon map"); |
80 |
– |
|
81 |
– |
printf("-apD %f\t\t\t# predistribution factor\n", preDistrib); |
82 |
– |
printf("-apM %d\t\t\t\t# max predistrib passes\n", maxPreDistrib); |
83 |
– |
printf("-apm %ld\t\t\t# max photon bounces\n", photonMaxBounce); |
84 |
– |
puts("-apo mod\t\t\t# photon port modifier"); |
85 |
– |
puts("-apO file\t\t\t# photon port file"); |
86 |
– |
printf("-apP %f\t\t\t# precomputation factor\n", finalGather); |
87 |
– |
printf("-apr %d\t\t\t\t# random seed\n", randSeed); |
88 |
– |
puts("-aps mod\t\t\t# antimatter sensor modifier"); |
89 |
– |
puts("-apS file\t\t\t# antimatter sensor file"); |
79 |
|
|
80 |
< |
printf(backvis ? "-bv+\t\t\t\t# back face visibility on\n" |
81 |
< |
: "-bv-\t\t\t\t# back face visibility off\n"); |
82 |
< |
printf("-dp %.1f\t\t\t# PDF samples / sr\n", pdfSamples); |
83 |
< |
printf("-ds %f\t\t\t# source partition size ratio\n", srcsizerat); |
84 |
< |
printf("-e %s\t\t\t# diagnostics output file\n", diagFile); |
85 |
< |
printf(clobber ? "-fo+\t\t\t\t# force overwrite\n" |
86 |
< |
: "-fo-\t\t\t\t# do not overwrite\n"); |
87 |
< |
printf("-ma %.2f %.2f %.2f\t\t# scattering albedo\n", |
80 |
> |
#ifdef EVALDRC_HACK |
81 |
> |
/* EvalDRC support */ |
82 |
> |
puts("-A\t\t\t\t# angular source file"); |
83 |
> |
#endif |
84 |
> |
puts("-ae mod\t\t\t\t# exclude modifier"); |
85 |
> |
puts("-aE file\t\t\t\t# exclude modifiers from file"); |
86 |
> |
puts("-ai mod\t\t\t\t# include modifier"); |
87 |
> |
puts("-aI file\t\t\t\t# include modifiers from file"); |
88 |
> |
#ifdef PMAP_EKSPERTZ |
89 |
> |
puts("-api xmin ymin zmin xmax ymax zmax\t# region of interest"); |
90 |
> |
#endif |
91 |
> |
puts("-apg file nPhotons\t\t\t# global photon map"); |
92 |
> |
puts("-apc file nPhotons\t\t\t# caustic photon map"); |
93 |
> |
puts("-apd file nPhotons\t\t\t# direct photon map"); |
94 |
> |
puts("-app file nPhotons bwidth\t\t# precomputed global photon map"); |
95 |
> |
puts("-apv file nPhotons\t\t\t# volume photon map"); |
96 |
> |
puts("-apC file nPhotons\t\t\t# contribution photon map"); |
97 |
> |
printf("-apD %f\t\t\t\t# predistribution factor\n", preDistrib); |
98 |
> |
printf("-apM %d\t\t\t\t\t# max predistrib passes\n", maxPreDistrib); |
99 |
> |
#if 1 |
100 |
> |
/* Kept for backwards compat, will be gradually phased out by -lD, -lr */ |
101 |
> |
printf("-apm %ld\t\t\t\t# limit photon bounces\n", photonMaxBounce); |
102 |
> |
#endif |
103 |
> |
puts("-apo mod\t\t\t\t# photon port modifier"); |
104 |
> |
puts("-apO file\t\t\t\t# photon ports from file"); |
105 |
> |
printf("-apP %f\t\t\t\t# precomputation factor\n", finalGather); |
106 |
> |
printf("-apr %d\t\t\t\t\t# random seed\n", randSeed); |
107 |
> |
puts("-aps mod\t\t\t\t# antimatter sensor modifier"); |
108 |
> |
puts("-apS file\t\t\t\t# antimatter sensors from file"); |
109 |
> |
|
110 |
> |
printf(backvis ? "-bv+\t\t\t\t\t# back face visibility on\n" |
111 |
> |
: "-bv-\t\t\t\t\t# back face visibility off\n"); |
112 |
> |
printf("-dp %.1f\t\t\t\t# PDF samples / sr\n", pdfSamples); |
113 |
> |
printf("-ds %f\t\t\t\t# source partition size ratio\n", srcsizerat); |
114 |
> |
printf("-e %s\t\t\t\t# diagnostics output file\n", diagFile); |
115 |
> |
printf(clobber ? "-fo+\t\t\t\t\t# force overwrite\n" |
116 |
> |
: "-fo-\t\t\t\t\t# do not overwrite\n"); |
117 |
> |
#ifdef PMAP_EKSPERTZ |
118 |
> |
/* NU STUFF for Ze Exspertz! */ |
119 |
> |
printf("-ld %.1f\t\t\t\t\t# limit photon distance\n", photonMaxDist); |
120 |
> |
printf("-lr %ld\t\t\t\t# limit photon bounces\n", photonMaxBounce); |
121 |
> |
#endif |
122 |
> |
printf("-ma %.2f %.2f %.2f\t\t\t# scattering albedo\n", |
123 |
|
colval(salbedo,RED), colval(salbedo,GRN), colval(salbedo,BLU)); |
124 |
< |
printf("-me %.2e %.2e %.2e\t# extinction coefficient\n", |
124 |
> |
printf("-me %.2e %.2e %.2e\t\t# extinction coefficient\n", |
125 |
|
colval(cextinction,RED), colval(cextinction,GRN), |
126 |
|
colval(cextinction,BLU)); |
127 |
< |
printf("-mg %.2f\t\t\t# scattering eccentricity\n", seccg); |
127 |
> |
printf("-mg %.2f\t\t\t\t# scattering eccentricity\n", seccg); |
128 |
|
#if NIX |
129 |
|
/* Multiprocessing on NIX only */ |
130 |
< |
printf("-n %d\t\t\t\t# number of parallel processes\n", nproc); |
130 |
> |
printf("-n %d\t\t\t\t\t# number of parallel processes\n", nproc); |
131 |
|
#endif |
132 |
< |
printf("-t %-9d\t\t\t# time between reports\n", photonRepTime); |
133 |
< |
printf(verbose ? "-v+\t\t\t\t# verbose console output\n" |
134 |
< |
: "-v-\t\t\t\t# terse console output\n"); |
111 |
< |
#ifdef PMAP_ROI |
112 |
< |
/* Ziss option for ze egg-spurtz only! */ |
113 |
< |
puts("-api xmin ymin zmin\n xmax ymax zmax\t\t# region of interest"); |
114 |
< |
#endif |
115 |
< |
#ifdef EVALDRC_HACK |
116 |
< |
/* ... and ziss one... */ |
117 |
< |
puts("-A\t\t\t\t# angular source file"); |
118 |
< |
#endif |
132 |
> |
printf("-t %-9d\t\t\t\t# time between reports\n", photonRepTime); |
133 |
> |
printf(verbose ? "-v+\t\t\t\t\t# verbose console output\n" |
134 |
> |
: "-v-\t\t\t\t\t# terse console output\n"); |
135 |
|
} |
136 |
|
|
137 |
|
|
150 |
|
default: goto badopt; \ |
151 |
|
} |
152 |
|
|
153 |
< |
int loadflags = IO_CHECK | IO_SCENE | IO_TREE | IO_BOUNDS, rval, i; |
154 |
< |
char **portLp = NULL, **sensLp = photonSensorList; |
153 |
> |
int loadflags = IO_CHECK | IO_SCENE | IO_TREE | IO_BOUNDS, rval, i, j, n; |
154 |
> |
char **portLp = photonPortList, **sensLp = photonSensorList, |
155 |
> |
**amblp = NULL; |
156 |
|
struct stat pmstat; |
157 |
|
|
158 |
|
/* Global program name */ |
189 |
|
} |
190 |
|
|
191 |
|
switch (argv [i][1]) { |
192 |
< |
case 'a': |
193 |
< |
if (!strcmp(argv [i] + 2, "pg")) { |
194 |
< |
/* Global photon map */ |
195 |
< |
check(4, "ss"); |
196 |
< |
globalPmapParams.fileName = argv [++i]; |
197 |
< |
globalPmapParams.distribTarget = |
198 |
< |
parseMultiplier(argv [++i]); |
199 |
< |
if (!globalPmapParams.distribTarget) |
200 |
< |
goto badopt; |
201 |
< |
globalPmapParams.minGather = globalPmapParams.maxGather = 0; |
202 |
< |
} |
203 |
< |
|
204 |
< |
else if (!strcmp(argv [i] + 2, "pm")) { |
205 |
< |
/* Max photon bounces */ |
206 |
< |
check(4, "i"); |
207 |
< |
photonMaxBounce = atol(argv [++i]); |
208 |
< |
if (photonMaxBounce <= 0) |
209 |
< |
error(USER, "max photon bounces must be > 0"); |
210 |
< |
} |
192 |
> |
case 'a': /* Ambient */ |
193 |
> |
switch (argv [i][2]) { |
194 |
> |
case 'i': /* Ambient include */ |
195 |
> |
case 'I': |
196 |
> |
check(3, "s"); |
197 |
> |
if (ambincl != 1) { |
198 |
> |
ambincl = 1; |
199 |
> |
amblp = amblist; |
200 |
> |
} |
201 |
> |
if (argv [i][2] == 'I') { |
202 |
> |
/* Add modifiers from file */ |
203 |
> |
rval = wordfile(amblp, AMBLLEN - (amblp - amblist), |
204 |
> |
getpath(argv [++i], |
205 |
> |
getrlibpath(), R_OK)); |
206 |
> |
if (rval < 0) { |
207 |
> |
sprintf(errmsg, |
208 |
> |
"cannot open ambient include file \"%s\"", |
209 |
> |
argv [i]); |
210 |
> |
error(SYSTEM, errmsg); |
211 |
> |
} |
212 |
> |
amblp += rval; |
213 |
> |
} |
214 |
> |
else { |
215 |
> |
/* Add modifier from next arg */ |
216 |
> |
*amblp++ = savqstr(argv [++i]); |
217 |
> |
*amblp = NULL; |
218 |
> |
} |
219 |
> |
break; |
220 |
> |
|
221 |
> |
case 'e': /* Ambient exclude */ |
222 |
> |
case 'E': |
223 |
> |
check(3, "s"); |
224 |
> |
if (ambincl != 0) { |
225 |
> |
ambincl = 0; |
226 |
> |
amblp = amblist; |
227 |
> |
} |
228 |
> |
if (argv [i][2] == 'E') { |
229 |
> |
/* Add modifiers from file */ |
230 |
> |
rval = wordfile(amblp, AMBLLEN - (amblp - amblist), |
231 |
> |
getpath(argv [++i], |
232 |
> |
getrlibpath(), R_OK)); |
233 |
> |
if (rval < 0) { |
234 |
> |
sprintf(errmsg, |
235 |
> |
"cannot open ambient exclude file \"%s\"", |
236 |
> |
argv [i]); |
237 |
> |
error(SYSTEM, errmsg); |
238 |
> |
} |
239 |
> |
amblp += rval; |
240 |
> |
} |
241 |
> |
else { |
242 |
> |
/* Add modifier from next arg */ |
243 |
> |
*amblp++ = savqstr(argv [++i]); |
244 |
> |
*amblp = NULL; |
245 |
> |
} |
246 |
> |
break; |
247 |
|
|
248 |
< |
else if (!strcmp(argv [i] + 2, "pp")) { |
249 |
< |
/* Precomputed global photon map */ |
250 |
< |
check(4, "ssi"); |
251 |
< |
preCompPmapParams.fileName = argv [++i]; |
252 |
< |
preCompPmapParams.distribTarget = |
253 |
< |
parseMultiplier(argv [++i]); |
254 |
< |
if (!preCompPmapParams.distribTarget) |
255 |
< |
goto badopt; |
256 |
< |
preCompPmapParams.minGather = preCompPmapParams.maxGather = |
257 |
< |
atoi(argv [++i]); |
258 |
< |
if (!preCompPmapParams.maxGather) |
259 |
< |
goto badopt; |
207 |
< |
} |
248 |
> |
case 'p': /* Pmap-specific */ |
249 |
> |
switch (argv [i][3]) { |
250 |
> |
case 'g': /* Global photon map */ |
251 |
> |
check(4, "ss"); |
252 |
> |
globalPmapParams.fileName = argv [++i]; |
253 |
> |
globalPmapParams.distribTarget = |
254 |
> |
parseMultiplier(argv [++i]); |
255 |
> |
if (!globalPmapParams.distribTarget) |
256 |
> |
goto badopt; |
257 |
> |
globalPmapParams.minGather = |
258 |
> |
globalPmapParams.maxGather = 0; |
259 |
> |
break; |
260 |
|
|
261 |
< |
else if (!strcmp(argv [i] + 2, "pc")) { |
262 |
< |
/* Caustic photon map */ |
263 |
< |
check(4, "ss"); |
264 |
< |
causticPmapParams.fileName = argv [++i]; |
265 |
< |
causticPmapParams.distribTarget = |
266 |
< |
parseMultiplier(argv [++i]); |
267 |
< |
if (!causticPmapParams.distribTarget) |
268 |
< |
goto badopt; |
269 |
< |
} |
261 |
> |
case 'p': /* Precomputed global photon map */ |
262 |
> |
check(4, "ssi"); |
263 |
> |
preCompPmapParams.fileName = argv [++i]; |
264 |
> |
preCompPmapParams.distribTarget = |
265 |
> |
parseMultiplier(argv [++i]); |
266 |
> |
if (!preCompPmapParams.distribTarget) |
267 |
> |
goto badopt; |
268 |
> |
preCompPmapParams.minGather = |
269 |
> |
preCompPmapParams.maxGather = atoi(argv [++i]); |
270 |
> |
if (!preCompPmapParams.maxGather) |
271 |
> |
goto badopt; |
272 |
> |
break; |
273 |
|
|
274 |
< |
else if (!strcmp(argv [i] + 2, "pv")) { |
275 |
< |
/* Volume photon map */ |
276 |
< |
check(4, "ss"); |
277 |
< |
volumePmapParams.fileName = argv [++i]; |
278 |
< |
volumePmapParams.distribTarget = |
279 |
< |
parseMultiplier(argv [++i]); |
280 |
< |
if (!volumePmapParams.distribTarget) |
281 |
< |
goto badopt; |
227 |
< |
} |
228 |
< |
|
229 |
< |
else if (!strcmp(argv [i] + 2, "pd")) { |
230 |
< |
/* Direct photon map */ |
231 |
< |
check(4, "ss"); |
232 |
< |
directPmapParams.fileName = argv [++i]; |
233 |
< |
directPmapParams.distribTarget = |
234 |
< |
parseMultiplier(argv [++i]); |
235 |
< |
if (!directPmapParams.distribTarget) |
236 |
< |
goto badopt; |
237 |
< |
} |
238 |
< |
|
239 |
< |
else if (!strcmp(argv [i] + 2, "pC")) { |
240 |
< |
/* Light source contribution photon map */ |
241 |
< |
check(4, "ss"); |
242 |
< |
contribPmapParams.fileName = argv [++i]; |
243 |
< |
contribPmapParams.distribTarget = |
244 |
< |
parseMultiplier(argv [++i]); |
245 |
< |
if (!contribPmapParams.distribTarget) |
246 |
< |
goto badopt; |
247 |
< |
} |
248 |
< |
|
249 |
< |
else if (!strcmp(argv [i] + 2, "pD")) { |
250 |
< |
/* Predistribution factor */ |
251 |
< |
check(4, "f"); |
252 |
< |
preDistrib = atof(argv [++i]); |
253 |
< |
if (preDistrib <= 0) |
254 |
< |
error(USER, "predistribution factor must be > 0"); |
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 |
< |
/* Add region of interest; for ze egg-spurtz only! */ |
267 |
< |
else if (!strcmp(argv [i] + 2, "pi")) { |
268 |
< |
unsigned j, n = pmapNumROI; |
269 |
< |
check(4, "ffffff"); |
270 |
< |
|
271 |
< |
pmapROI = realloc(pmapROI, |
272 |
< |
++pmapNumROI * sizeof(PhotonMapROI)); |
273 |
< |
if (!pmapROI) |
274 |
< |
1 error(SYSTEM, "failed to allocate ROI"); |
274 |
> |
case 'c': /* Caustic photon map */ |
275 |
> |
check(4, "ss"); |
276 |
> |
causticPmapParams.fileName = argv [++i]; |
277 |
> |
causticPmapParams.distribTarget = |
278 |
> |
parseMultiplier(argv [++i]); |
279 |
> |
if (!causticPmapParams.distribTarget) |
280 |
> |
goto badopt; |
281 |
> |
break; |
282 |
|
|
283 |
< |
pmapROI [n].min [0] = atof(argv [++i]); |
284 |
< |
pmapROI [n].min [1] = atof(argv [++i]); |
285 |
< |
pmapROI [n].min [2] = atof(argv [++i]); |
286 |
< |
pmapROI [n].max [0] = atof(argv [++i]); |
287 |
< |
pmapROI [n].max [1] = atof(argv [++i]); |
288 |
< |
pmapROI [n].max [2] = atof(argv [++i]); |
289 |
< |
|
290 |
< |
for (j = 0; j < 3; j++) |
291 |
< |
if (pmapROI [n].min [j] >= pmapROI [n].max [j]) |
292 |
< |
error(USER, |
293 |
< |
"invalid region of interest (swapped min/max?)"); |
294 |
< |
} |
283 |
> |
case 'v': /* Volume photon map */ |
284 |
> |
check(4, "ss"); |
285 |
> |
volumePmapParams.fileName = argv [++i]; |
286 |
> |
volumePmapParams.distribTarget = |
287 |
> |
parseMultiplier(argv [++i]); |
288 |
> |
if (!volumePmapParams.distribTarget) |
289 |
> |
goto badopt; |
290 |
> |
break; |
291 |
> |
|
292 |
> |
case 'd': /* Direct photon map */ |
293 |
> |
check(4, "ss"); |
294 |
> |
directPmapParams.fileName = argv [++i]; |
295 |
> |
directPmapParams.distribTarget = |
296 |
> |
parseMultiplier(argv [++i]); |
297 |
> |
if (!directPmapParams.distribTarget) |
298 |
> |
goto badopt; |
299 |
> |
break; |
300 |
> |
|
301 |
> |
case 'C': /* Contribution photon map */ |
302 |
> |
check(4, "ss"); |
303 |
> |
contribPmapParams.fileName = argv [++i]; |
304 |
> |
contribPmapParams.distribTarget = |
305 |
> |
parseMultiplier(argv [++i]); |
306 |
> |
if (!contribPmapParams.distribTarget) |
307 |
> |
goto badopt; |
308 |
> |
break; |
309 |
> |
|
310 |
> |
case 'D': /* Predistribution factor */ |
311 |
> |
check(4, "f"); |
312 |
> |
preDistrib = atof(argv [++i]); |
313 |
> |
if (preDistrib <= 0) |
314 |
> |
error(USER, "predistrib factor must be > 0"); |
315 |
> |
break; |
316 |
> |
|
317 |
> |
case 'M': /* Max predistribution passes */ |
318 |
> |
check(4, "i"); |
319 |
> |
maxPreDistrib = atoi(argv [++i]); |
320 |
> |
if (maxPreDistrib <= 0) |
321 |
> |
error(USER, "max predistrib passes must be > 0"); |
322 |
> |
break; |
323 |
> |
|
324 |
> |
#if 1 |
325 |
> |
/* Kept for backwards compat, to be phased out by -lr */ |
326 |
> |
case 'm': /* Max photon bounces */ |
327 |
> |
check(4, "i"); |
328 |
> |
photonMaxBounce = atol(argv [++i]); |
329 |
> |
if (photonMaxBounce <= 0) |
330 |
> |
error(USER, "max photon bounces must be > 0"); |
331 |
> |
break; |
332 |
|
#endif |
289 |
– |
|
290 |
– |
else if (!strcmp(argv [i] + 2, "pP")) { |
291 |
– |
/* Global photon precomputation factor */ |
292 |
– |
check(4, "f"); |
293 |
– |
finalGather = atof(argv [++i]); |
294 |
– |
if (finalGather <= 0 || finalGather > 1) |
295 |
– |
error(USER, "global photon precomputation factor " |
296 |
– |
"must be in range ]0, 1]"); |
297 |
– |
} |
298 |
– |
|
299 |
– |
else if (!strcmp(argv [i] + 2, "po") || |
300 |
– |
!strcmp(argv [i] + 2, "pO")) { |
301 |
– |
/* Photon port */ |
302 |
– |
check(4, "s"); |
303 |
– |
|
304 |
– |
if (ambincl != 1) { |
305 |
– |
ambincl = 1; |
306 |
– |
portLp = amblist; |
307 |
– |
} |
308 |
– |
|
309 |
– |
if (argv[i][3] == 'O') { |
310 |
– |
/* Get port modifiers from file */ |
311 |
– |
rval = wordfile(portLp, AMBLLEN-(portLp-amblist), |
312 |
– |
getpath(argv [++i], getrlibpath(), R_OK)); |
313 |
– |
|
314 |
– |
if (rval < 0) { |
315 |
– |
sprintf(errmsg, "cannot open photon port file %s", |
316 |
– |
argv [i]); |
317 |
– |
error(SYSTEM, errmsg); |
318 |
– |
} |
319 |
– |
|
320 |
– |
portLp += rval; |
321 |
– |
} |
322 |
– |
|
323 |
– |
else { |
324 |
– |
/* Append modifier to port list */ |
325 |
– |
*portLp++ = argv [++i]; |
326 |
– |
*portLp = NULL; |
327 |
– |
} |
328 |
– |
} |
329 |
– |
|
330 |
– |
else if (!strcmp(argv [i] + 2, "pr")) { |
331 |
– |
/* Random seed */ |
332 |
– |
check(4, "i"); |
333 |
– |
randSeed = atoi(argv [++i]); |
334 |
– |
} |
333 |
|
|
334 |
< |
else if (!strcmp(argv [i] + 2, "ps") || |
335 |
< |
!strcmp(argv [i] + 2, "pS")) { |
336 |
< |
/* Antimatter sensor */ |
337 |
< |
check(4, "s"); |
338 |
< |
|
339 |
< |
if (argv[i][3] == 'S') { |
340 |
< |
/* Get sensor modifiers from file */ |
341 |
< |
rval = wordfile(sensLp, MAXSET-(sensLp-photonSensorList), |
342 |
< |
getpath(argv [++i], getrlibpath(), R_OK)); |
343 |
< |
|
344 |
< |
if (rval < 0) { |
345 |
< |
sprintf(errmsg, "cannot open antimatter sensor file %s", |
346 |
< |
argv [i]); |
347 |
< |
error(SYSTEM, errmsg); |
334 |
> |
#ifdef PMAP_EKSPERTZ |
335 |
> |
case 'i': /* Add region of interest */ |
336 |
> |
check(4, "ffffff"); |
337 |
> |
n = pmapNumROI; |
338 |
> |
pmapROI = realloc(pmapROI, |
339 |
> |
++pmapNumROI * sizeof(PhotonMapROI)); |
340 |
> |
if (!pmapROI) |
341 |
> |
error(SYSTEM, "failed to allocate ROI"); |
342 |
> |
pmapROI [n].min [0] = atof(argv [++i]); |
343 |
> |
pmapROI [n].min [1] = atof(argv [++i]); |
344 |
> |
pmapROI [n].min [2] = atof(argv [++i]); |
345 |
> |
pmapROI [n].max [0] = atof(argv [++i]); |
346 |
> |
pmapROI [n].max [1] = atof(argv [++i]); |
347 |
> |
pmapROI [n].max [2] = atof(argv [++i]); |
348 |
> |
for (j = 0; j < 3; j++) |
349 |
> |
if (pmapROI [n].min [j] >= pmapROI [n].max [j]) |
350 |
> |
error(USER, "invalid region of interest " |
351 |
> |
"(swapped min/max?)"); |
352 |
> |
break; |
353 |
> |
#endif |
354 |
> |
|
355 |
> |
case 'P': /* Global photon precomp ratio */ |
356 |
> |
check(4, "f"); |
357 |
> |
finalGather = atof(argv [++i]); |
358 |
> |
if (finalGather <= 0 || finalGather > 1) |
359 |
> |
error(USER, "global photon precomputation ratio " |
360 |
> |
"must be in range ]0, 1]"); |
361 |
> |
break; |
362 |
> |
|
363 |
> |
case 'o': /* Photon port */ |
364 |
> |
case 'O': |
365 |
> |
check(4, "s"); |
366 |
> |
if (argv [i][3] == 'O') { |
367 |
> |
/* Add port modifiers from file */ |
368 |
> |
rval = wordfile(portLp, |
369 |
> |
MAXSET - (portLp - photonPortList), |
370 |
> |
getpath(argv [++i], |
371 |
> |
getrlibpath(), R_OK)); |
372 |
> |
if (rval < 0) { |
373 |
> |
sprintf(errmsg, |
374 |
> |
"cannot open photon port file %s", |
375 |
> |
argv [i]); |
376 |
> |
error(SYSTEM, errmsg); |
377 |
> |
} |
378 |
> |
portLp += rval; |
379 |
> |
} |
380 |
> |
else { |
381 |
> |
/* Add port modifier from next arg, mark end with |
382 |
> |
* NULL */ |
383 |
> |
*portLp++ = savqstr(argv [++i]); |
384 |
> |
*portLp = NULL; |
385 |
> |
} |
386 |
> |
break; |
387 |
> |
|
388 |
> |
case 'r': /* Random seed */ |
389 |
> |
check(4, "i"); |
390 |
> |
randSeed = atoi(argv [++i]); |
391 |
> |
break; |
392 |
> |
|
393 |
> |
case 's': /* Antimatter sensor */ |
394 |
> |
case 'S': |
395 |
> |
check(4, "s"); |
396 |
> |
if (argv[i][3] == 'S') { |
397 |
> |
/* Add sensor modifiers from file */ |
398 |
> |
rval = wordfile(sensLp, |
399 |
> |
MAXSET - (sensLp - photonSensorList), |
400 |
> |
getpath(argv [++i], |
401 |
> |
getrlibpath(), R_OK)); |
402 |
> |
if (rval < 0) { |
403 |
> |
sprintf(errmsg, |
404 |
> |
"cannot open antimatter sensor file %s", |
405 |
> |
argv [i]); |
406 |
> |
error(SYSTEM, errmsg); |
407 |
> |
} |
408 |
> |
sensLp += rval; |
409 |
> |
} |
410 |
> |
else { |
411 |
> |
/* Append modifier to sensor list, mark end with |
412 |
> |
* NULL */ |
413 |
> |
*sensLp++ = savqstr(argv [++i]); |
414 |
> |
*sensLp = NULL; |
415 |
> |
} |
416 |
> |
break; |
417 |
> |
|
418 |
> |
default: goto badopt; |
419 |
|
} |
420 |
+ |
break; |
421 |
|
|
422 |
< |
sensLp += rval; |
353 |
< |
} |
354 |
< |
|
355 |
< |
else { |
356 |
< |
/* Append modifier to sensor list */ |
357 |
< |
*sensLp++ = argv [++i]; |
358 |
< |
*sensLp = NULL; |
359 |
< |
} |
422 |
> |
default: goto badopt; |
423 |
|
} |
361 |
– |
|
362 |
– |
else goto badopt; |
424 |
|
break; |
425 |
< |
|
426 |
< |
case 'b': |
425 |
> |
|
426 |
> |
case 'b': /* Back face visibility */ |
427 |
|
if (argv [i][2] == 'v') { |
367 |
– |
/* Back face visibility */ |
428 |
|
check_bool(3, backvis); |
429 |
|
} |
370 |
– |
|
430 |
|
else goto badopt; |
431 |
|
break; |
432 |
|
|
451 |
|
diagFile = argv [++i]; |
452 |
|
break; |
453 |
|
|
454 |
< |
case 'f': |
454 |
> |
case 'f': /* Force overwrite */ |
455 |
|
if (argv [i][2] == 'o') { |
397 |
– |
/* Force overwrite */ |
456 |
|
check_bool(3, clobber); |
457 |
|
} |
400 |
– |
|
458 |
|
else goto badopt; |
459 |
|
break; |
460 |
|
|
461 |
+ |
#ifdef PMAP_EKSPERTZ |
462 |
+ |
case 'l': /* Limits */ |
463 |
+ |
switch (argv [i][2]) { |
464 |
+ |
case 'd': /* Limit photon path distance */ |
465 |
+ |
check(3, "f"); |
466 |
+ |
photonMaxDist = atof(argv [++i]); |
467 |
+ |
if (photonMaxDist <= 0) |
468 |
+ |
error(USER, "max photon distance must be > 0"); |
469 |
+ |
break; |
470 |
+ |
|
471 |
+ |
case 'r': /* Limit photon bounces */ |
472 |
+ |
check(3, "i"); |
473 |
+ |
photonMaxBounce = atol(argv [++i]); |
474 |
+ |
if (photonMaxBounce <= 0) |
475 |
+ |
error(USER, "max photon bounces must be > 0"); |
476 |
+ |
break; |
477 |
+ |
|
478 |
+ |
default: goto badopt; |
479 |
+ |
} |
480 |
+ |
break; |
481 |
+ |
#endif |
482 |
+ |
|
483 |
|
case 'm': /* Medium */ |
484 |
|
switch (argv[i][2]) { |
485 |
|
case 'e': /* Eggs-tinction coefficient */ |
504 |
|
default: goto badopt; |
505 |
|
} |
506 |
|
break; |
507 |
+ |
|
508 |
|
#if NIX |
509 |
|
case 'n': /* Num parallel processes (NIX only) */ |
510 |
|
check(2, "i"); |
517 |
|
error(WARNING, errmsg); |
518 |
|
} |
519 |
|
break; |
520 |
< |
#endif |
520 |
> |
#endif |
521 |
> |
|
522 |
|
case 't': /* Timer */ |
523 |
|
check(2, "i"); |
524 |
|
photonRepTime = atoi(argv [++i]); |
526 |
|
|
527 |
|
case 'v': /* Verbosity */ |
528 |
|
check_bool(2, verbose); |
529 |
< |
break; |
529 |
> |
break; |
530 |
> |
|
531 |
|
#ifdef EVALDRC_HACK |
532 |
|
case 'A': /* Angular source file */ |
533 |
|
check(2,"s"); |
534 |
|
angsrcfile = argv[++i]; |
535 |
|
break; |
536 |
< |
#endif |
537 |
< |
default: goto badopt; |
536 |
> |
#endif |
537 |
> |
|
538 |
> |
default: goto badopt; |
539 |
|
} |
540 |
|
} |
541 |
|
|