9 |
|
|
10 |
|
Roland Schregle (roland.schregle@{hslu.ch, gmail.com}) |
11 |
|
(c) Fraunhofer Institute for Solar Energy Systems, |
12 |
< |
Lucerne University of Applied Sciences & Arts |
12 |
> |
supported by the German Research Foundation |
13 |
> |
(DFG LU-204/10-2, "Fassadenintegrierte Regelsysteme" (FARESYS)) |
14 |
|
(c) Lucerne University of Applied Sciences and Arts, |
15 |
< |
supported by the Swiss National Science Foundation (SNSF, #147053) |
15 |
> |
supported by the Swiss National Science Foundation |
16 |
> |
(SNSF #147053, "Daylight Redirecting Components") |
17 |
> |
(c) Tokyo University of Science, |
18 |
> |
supported by the JSPS Grants-in-Aid for Scientific Research |
19 |
> |
(KAKENHI JP19KK0115, "Three-Dimensional Light Flow") |
20 |
|
====================================================================== |
21 |
|
|
22 |
|
$Id$ |
32 |
|
#include "ambient.h" |
33 |
|
#include "resolu.h" |
34 |
|
#include "source.h" |
35 |
+ |
#include "func.h" |
36 |
+ |
#include <ctype.h> |
37 |
|
#include <string.h> |
38 |
|
#include <sys/stat.h> |
39 |
|
|
70 |
|
/* Dummies for linkage */ |
71 |
|
|
72 |
|
COLOR ambval = BLKCOLOR; |
73 |
< |
double shadthresh = .05, ambacc = 0.2, shadcert = .5, minweight = 5e-3, |
74 |
< |
ssampdist = 0, dstrsrc = 0.0, specthresh = 0.15, specjitter = 1.0, |
75 |
< |
avgrefl = 0.5; |
76 |
< |
int ambvwt = 0, ambssamp = 0, ambres = 32, ambounce = 0, directrelay = 1, |
77 |
< |
directvis = 1, samplendx, do_irrad = 0, ambdiv = 128, vspretest = 512, |
78 |
< |
maxdepth = 6, contrib = 0; |
79 |
< |
char *shm_boundary = NULL, *ambfile = NULL, *RCCONTEXT = NULL; |
80 |
< |
void (*trace)() = NULL, (*addobjnotify [])() = {ambnotify, NULL}; |
73 |
> |
double shadthresh = .05, ambacc = 0.2, shadcert = .5, minweight = 5e-3, |
74 |
> |
ssampdist = 0, dstrsrc = 0.0, specthresh = 0.15, specjitter = 1.0, |
75 |
> |
avgrefl = 0.5; |
76 |
> |
int ambvwt = 0, ambssamp = 0, ambres = 32, ambounce = 0, |
77 |
> |
directrelay = 1, directvis = 1, samplendx, do_irrad = 0, |
78 |
> |
ambdiv = 128, vspretest = 512, maxdepth = 6, contrib = 0; |
79 |
> |
char *ambfile = NULL, *RCCONTEXT = NULL; |
80 |
> |
void (*trace)() = NULL, (*addobjnotify [])() = {ambnotify, NULL}; |
81 |
|
|
82 |
|
|
83 |
|
void printdefaults() |
84 |
|
/* print default values to stdout */ |
85 |
|
{ |
79 |
– |
|
86 |
|
#ifdef EVALDRC_HACK |
87 |
|
/* EvalDRC support */ |
88 |
|
puts("-A\t\t\t\t# angular source file"); |
92 |
|
puts("-ai mod\t\t\t\t# include modifier"); |
93 |
|
puts("-aI file\t\t\t\t# include modifiers from file"); |
94 |
|
#ifdef PMAP_EKSPERTZ |
95 |
< |
puts("-api xmin ymin zmin xmax ymax zmax\t# region of interest"); |
95 |
> |
puts("-api xmin ymin zmin xmax ymax zmax\t# rectangular region of interest"); |
96 |
> |
puts("-apI xpos ypos zpos radius\t\t# spherical region of interest"); |
97 |
|
#endif |
98 |
|
puts("-apg file nPhotons\t\t\t# global photon map"); |
99 |
< |
puts("-apc file nPhotons\t\t\t# caustic photon map"); |
99 |
> |
puts("-apc file nPhotons\t\t\t# caustic photon map"); |
100 |
|
puts("-apd file nPhotons\t\t\t# direct photon map"); |
101 |
|
puts("-app file nPhotons bwidth\t\t# precomputed global photon map"); |
102 |
|
puts("-apv file nPhotons\t\t\t# volume photon map"); |
104 |
|
printf("-apD %f\t\t\t\t# predistribution factor\n", preDistrib); |
105 |
|
printf("-apM %d\t\t\t\t\t# max predistrib passes\n", maxPreDistrib); |
106 |
|
#if 1 |
107 |
< |
/* Kept for backwards compat, will be gradually phased out by -lD, -lr */ |
107 |
> |
/* Kept for backwards compat, will be gradually phased out by -ld, -lr */ |
108 |
|
printf("-apm %ld\t\t\t\t# limit photon bounces\n", photonMaxBounce); |
109 |
|
#endif |
110 |
< |
puts("-apo mod\t\t\t\t# photon port modifier"); |
111 |
< |
puts("-apO file\t\t\t\t# photon ports from file"); |
110 |
> |
puts("-apo+ mod\t\t\t\t# photon port modifier"); |
111 |
> |
puts("-apO+ file\t\t\t\t# photon ports from file"); |
112 |
|
printf("-apP %f\t\t\t\t# precomputation factor\n", finalGather); |
113 |
|
printf("-apr %d\t\t\t\t\t# random seed\n", randSeed); |
114 |
|
puts("-aps mod\t\t\t\t# antimatter sensor modifier"); |
115 |
|
puts("-apS file\t\t\t\t# antimatter sensors from file"); |
116 |
|
|
117 |
< |
printf(backvis ? "-bv+\t\t\t\t\t# back face visibility on\n" |
118 |
< |
: "-bv-\t\t\t\t\t# back face visibility off\n"); |
117 |
> |
printf(backvis |
118 |
> |
? "-bv+\t\t\t\t\t# back face visibility on\n" |
119 |
> |
: "-bv-\t\t\t\t\t# back face visibility off\n" |
120 |
> |
); |
121 |
|
printf("-dp %.1f\t\t\t\t# PDF samples / sr\n", pdfSamples); |
122 |
|
printf("-ds %f\t\t\t\t# source partition size ratio\n", srcsizerat); |
123 |
|
printf("-e %s\t\t\t\t# diagnostics output file\n", diagFile); |
124 |
< |
printf(clobber ? "-fo+\t\t\t\t\t# force overwrite\n" |
125 |
< |
: "-fo-\t\t\t\t\t# do not overwrite\n"); |
124 |
> |
printf(clobber |
125 |
> |
? "-fo+\t\t\t\t\t# force overwrite\n" |
126 |
> |
: "-fo-\t\t\t\t\t# do not overwrite\n" |
127 |
> |
); |
128 |
|
#ifdef PMAP_EKSPERTZ |
129 |
< |
/* NU STUFF for Ze Exspertz! */ |
129 |
> |
/* (Formerly) NU STUFF for Ze Exspertz! */ |
130 |
|
printf("-ld %.1f\t\t\t\t\t# limit photon distance\n", photonMaxDist); |
131 |
|
printf("-lr %ld\t\t\t\t# limit photon bounces\n", photonMaxBounce); |
132 |
|
#endif |
133 |
< |
printf("-ma %.2f %.2f %.2f\t\t\t# scattering albedo\n", |
134 |
< |
colval(salbedo,RED), colval(salbedo,GRN), colval(salbedo,BLU)); |
135 |
< |
printf("-me %.2e %.2e %.2e\t\t# extinction coefficient\n", |
136 |
< |
colval(cextinction,RED), colval(cextinction,GRN), |
137 |
< |
colval(cextinction,BLU)); |
133 |
> |
printf( |
134 |
> |
"-ma %.2f %.2f %.2f\t\t\t# scattering albedo\n", |
135 |
> |
colval(salbedo,RED), colval(salbedo,GRN), colval(salbedo,BLU) |
136 |
> |
); |
137 |
> |
printf( |
138 |
> |
"-me %.2e %.2e %.2e\t\t# extinction coefficient\n", |
139 |
> |
colval(cextinction,RED), colval(cextinction,GRN), |
140 |
> |
colval(cextinction,BLU) |
141 |
> |
); |
142 |
|
printf("-mg %.2f\t\t\t\t# scattering eccentricity\n", seccg); |
143 |
|
#if NIX |
144 |
< |
/* Multiprocessing on NIX only */ |
144 |
> |
/* Multiprocessing on NIX only; so tuff luck, Windoze Weenies! */ |
145 |
|
printf("-n %d\t\t\t\t\t# number of parallel processes\n", nproc); |
146 |
|
#endif |
147 |
|
printf("-t %-9d\t\t\t\t# time between reports\n", photonRepTime); |
148 |
< |
printf(verbose ? "-v+\t\t\t\t\t# verbose console output\n" |
149 |
< |
: "-v-\t\t\t\t\t# terse console output\n"); |
148 |
> |
printf(verbose |
149 |
> |
? "-v+\t\t\t\t\t# verbose console output\n" |
150 |
> |
: "-v-\t\t\t\t\t# terse console output\n" |
151 |
> |
); |
152 |
|
} |
153 |
|
|
154 |
|
|
155 |
|
int main (int argc, char* argv []) |
156 |
|
{ |
157 |
< |
#define check(ol, al) if (argv [i][ol] || \ |
158 |
< |
badarg(argc - i - 1,argv + i + 1, al)) \ |
159 |
< |
goto badopt |
160 |
< |
|
157 |
> |
#define check(ol, al) if ( \ |
158 |
> |
argv [i][ol] || badarg(argc - i - 1,argv + i + 1, al) \ |
159 |
> |
) goto badopt |
160 |
> |
|
161 |
> |
/* Evaluate boolean option, setting var accordingly */ |
162 |
|
#define check_bool(olen, var) switch (argv [i][olen]) { \ |
163 |
< |
case '\0': var = !var; break; \ |
164 |
< |
case 'y': case 'Y': case 't': case 'T': \ |
165 |
< |
case '+': case '1': var = 1; break; \ |
166 |
< |
case 'n': case 'N': case 'f': case 'F': \ |
167 |
< |
case '-': case '0': var = 0; break; \ |
168 |
< |
default: goto badopt; \ |
169 |
< |
} |
163 |
> |
case '\0': \ |
164 |
> |
var = !var; break; \ |
165 |
> |
case 'y': case 'Y': case 't': case 'T': case '+': case '1': \ |
166 |
> |
var = 1; break; \ |
167 |
> |
case 'n': case 'N': case 'f': case 'F': case '-': case '0': \ |
168 |
> |
var = 0; break; \ |
169 |
> |
default: \ |
170 |
> |
goto badopt; \ |
171 |
> |
} |
172 |
> |
|
173 |
> |
/* Evaluate trinary option, setting bits v1 and v2 in var accordingly */ |
174 |
> |
#define check_tri(olen, v1, v2, var) switch (argv [i][olen]) { \ |
175 |
> |
case '\0': case '+': \ |
176 |
> |
var = v1; break; \ |
177 |
> |
case '-': \ |
178 |
> |
var = v2; break;\ |
179 |
> |
case '0': \ |
180 |
> |
var = v1 | v2; break; \ |
181 |
> |
default: \ |
182 |
> |
goto badopt; \ |
183 |
> |
} |
184 |
|
|
185 |
< |
int loadflags = IO_CHECK | IO_SCENE | IO_TREE | IO_BOUNDS, rval, i, j, n; |
186 |
< |
char **portLp = photonPortList, **sensLp = photonSensorList, |
187 |
< |
**amblp = NULL; |
188 |
< |
struct stat pmstat; |
185 |
> |
int loadflags = IO_CHECK | IO_SCENE | IO_TREE | IO_BOUNDS, |
186 |
> |
rval, i, j, n; |
187 |
> |
char **portLp = photonPortList, **sensLp = photonSensorList, |
188 |
> |
**amblp = NULL, sbuf [MAXSTR], portFlags [2] = "\0\0"; |
189 |
> |
struct stat pmstat; |
190 |
|
|
191 |
|
/* Global program name */ |
192 |
|
progname = fixargv0(argv [0]); |
193 |
|
/* Initialize object types */ |
194 |
|
initotypes(); |
195 |
< |
|
195 |
> |
/* initialize calcomp routines */ |
196 |
> |
initfunc(); |
197 |
> |
|
198 |
|
/* Parse options */ |
199 |
|
for (i = 1; i < argc; i++) { |
200 |
|
/* Eggs-pand arguments */ |
233 |
|
ambincl = 1; |
234 |
|
amblp = amblist; |
235 |
|
} |
236 |
< |
if (argv [i][2] == 'I') { |
236 |
> |
if (isupper(argv [i][2])) { |
237 |
|
/* Add modifiers from file */ |
238 |
< |
rval = wordfile(amblp, AMBLLEN - (amblp - amblist), |
239 |
< |
getpath(argv [++i], |
240 |
< |
getrlibpath(), R_OK)); |
238 |
> |
rval = wordfile( |
239 |
> |
amblp, AMBLLEN - (amblp - amblist), |
240 |
> |
getpath(argv [++i], getrlibpath(), R_OK) |
241 |
> |
); |
242 |
|
if (rval < 0) { |
243 |
< |
sprintf(errmsg, |
244 |
< |
"cannot open ambient include file \"%s\"", |
245 |
< |
argv [i]); |
243 |
> |
sprintf( |
244 |
> |
errmsg, "cannot open ambient include file \"%s\"", |
245 |
> |
argv [i] |
246 |
> |
); |
247 |
|
error(SYSTEM, errmsg); |
248 |
|
} |
249 |
|
amblp += rval; |
262 |
|
ambincl = 0; |
263 |
|
amblp = amblist; |
264 |
|
} |
265 |
< |
if (argv [i][2] == 'E') { |
265 |
> |
if (isupper(argv [i][2])) { |
266 |
|
/* Add modifiers from file */ |
267 |
< |
rval = wordfile(amblp, AMBLLEN - (amblp - amblist), |
268 |
< |
getpath(argv [++i], |
269 |
< |
getrlibpath(), R_OK)); |
267 |
> |
rval = wordfile( |
268 |
> |
amblp, AMBLLEN - (amblp - amblist), |
269 |
> |
getpath(argv [++i], getrlibpath(), R_OK) |
270 |
> |
); |
271 |
|
if (rval < 0) { |
272 |
< |
sprintf(errmsg, |
273 |
< |
"cannot open ambient exclude file \"%s\"", |
274 |
< |
argv [i]); |
272 |
> |
sprintf( |
273 |
> |
errmsg, "cannot open ambient exclude file \"%s\"", |
274 |
> |
argv [i] |
275 |
> |
); |
276 |
|
error(SYSTEM, errmsg); |
277 |
|
} |
278 |
|
amblp += rval; |
285 |
|
break; |
286 |
|
|
287 |
|
case 'p': /* Pmap-specific */ |
288 |
< |
switch (argv [i][3]) { |
288 |
> |
switch (argv [i][3]) { |
289 |
|
case 'g': /* Global photon map */ |
290 |
|
check(4, "ss"); |
291 |
|
globalPmapParams.fileName = argv [++i]; |
292 |
|
globalPmapParams.distribTarget = |
293 |
|
parseMultiplier(argv [++i]); |
294 |
|
if (!globalPmapParams.distribTarget) |
295 |
< |
goto badopt; |
295 |
> |
goto badopt; |
296 |
|
globalPmapParams.minGather = |
297 |
|
globalPmapParams.maxGather = 0; |
298 |
|
break; |
325 |
|
volumePmapParams.distribTarget = |
326 |
|
parseMultiplier(argv [++i]); |
327 |
|
if (!volumePmapParams.distribTarget) |
328 |
< |
goto badopt; |
328 |
> |
goto badopt; |
329 |
|
break; |
330 |
|
|
331 |
|
case 'd': /* Direct photon map */ |
370 |
|
break; |
371 |
|
#endif |
372 |
|
|
373 |
< |
#ifdef PMAP_EKSPERTZ |
374 |
< |
case 'i': /* Add region of interest */ |
375 |
< |
check(4, "ffffff"); |
373 |
> |
#ifdef PMAP_EKSPERTZ |
374 |
> |
case 'i': /* Add rectangular region of interest */ |
375 |
> |
case 'I': /* Add spherical region of interest */ |
376 |
> |
check(4, isupper(argv [j=i][3]) ? "ffff" : "ffffff"); |
377 |
|
n = pmapNumROI; |
378 |
< |
pmapROI = realloc(pmapROI, |
379 |
< |
++pmapNumROI * sizeof(PhotonMapROI)); |
378 |
> |
|
379 |
> |
pmapROI = realloc( |
380 |
> |
pmapROI, ++pmapNumROI * sizeof(PhotonMapROI) |
381 |
> |
); |
382 |
|
if (!pmapROI) |
383 |
|
error(SYSTEM, "failed to allocate ROI"); |
384 |
< |
pmapROI [n].min [0] = atof(argv [++i]); |
385 |
< |
pmapROI [n].min [1] = atof(argv [++i]); |
386 |
< |
pmapROI [n].min [2] = atof(argv [++i]); |
387 |
< |
pmapROI [n].max [0] = atof(argv [++i]); |
388 |
< |
pmapROI [n].max [1] = atof(argv [++i]); |
389 |
< |
pmapROI [n].max [2] = atof(argv [++i]); |
390 |
< |
for (j = 0; j < 3; j++) |
391 |
< |
if (pmapROI [n].min [j] >= pmapROI [n].max [j]) |
392 |
< |
error(USER, "invalid region of interest " |
393 |
< |
"(swapped min/max?)"); |
384 |
> |
|
385 |
> |
pmapROI [n].pos [0] = atof(argv [++i]); |
386 |
> |
pmapROI [n].pos [1] = atof(argv [++i]); |
387 |
> |
pmapROI [n].pos [2] = atof(argv [++i]); |
388 |
> |
pmapROI [n].siz [0] = atof(argv [++i]); |
389 |
> |
|
390 |
> |
if (isupper(argv [j][3])) { |
391 |
> |
/* Spherical ROI; radius^2 */ |
392 |
> |
pmapROI [n].siz [0] *= pmapROI [n].siz [0]; |
393 |
> |
PMAP_ROI_SETSPHERE(pmapROI + n); |
394 |
> |
if (pmapROI [n].siz [0] <= FTINY) |
395 |
> |
error( |
396 |
> |
USER, |
397 |
> |
"region of interest has invalid radius" |
398 |
> |
); |
399 |
> |
} |
400 |
> |
else { |
401 |
> |
/* Rectangular ROI */ |
402 |
> |
pmapROI [n].siz [1] = atof(argv [++i]); |
403 |
> |
pmapROI [n].siz [2] = atof(argv [++i]); |
404 |
> |
|
405 |
> |
for (j = 0; j < 3; j++) { |
406 |
> |
/* Pos at rectangle centre, siz symmetric */ |
407 |
> |
pmapROI [n].pos [j] = 0.5 * ( |
408 |
> |
pmapROI [n].pos [j] + pmapROI [n].siz [j] |
409 |
> |
); |
410 |
> |
pmapROI [n].siz [j] = fabs( |
411 |
> |
pmapROI [n].siz [j] - pmapROI [n].pos [j] |
412 |
> |
); |
413 |
> |
if (pmapROI [n].siz [j] <= FTINY) |
414 |
> |
error( |
415 |
> |
USER, |
416 |
> |
"region of interest has invalid size" |
417 |
> |
); |
418 |
> |
} |
419 |
> |
} |
420 |
|
break; |
421 |
< |
#endif |
421 |
> |
#endif |
422 |
|
|
423 |
|
case 'P': /* Global photon precomp ratio */ |
424 |
|
check(4, "f"); |
425 |
|
finalGather = atof(argv [++i]); |
426 |
|
if (finalGather <= 0 || finalGather > 1) |
427 |
< |
error(USER, "global photon precomputation ratio " |
428 |
< |
"must be in range ]0, 1]"); |
427 |
> |
error( |
428 |
> |
USER, "global photon precomputation ratio " |
429 |
> |
"must be in range ]0, 1]" |
430 |
> |
); |
431 |
|
break; |
432 |
|
|
433 |
|
case 'o': /* Photon port */ |
434 |
|
case 'O': |
435 |
< |
check(4, "s"); |
436 |
< |
if (argv [i][3] == 'O') { |
435 |
> |
/* Check for bad arg and length, taking into account |
436 |
> |
* default forward orientation if none specified, in |
437 |
> |
* order to maintain previous behaviour */ |
438 |
> |
check(argv [i][4] ? 5 : 4, "s"); |
439 |
> |
/* Get port orientation flags */ |
440 |
> |
check_tri( |
441 |
> |
4, PMAP_PORTFWD, PMAP_PORTBWD, portFlags [0] |
442 |
> |
); |
443 |
> |
|
444 |
> |
if (isupper(argv [i][3])) { |
445 |
|
/* Add port modifiers from file */ |
446 |
< |
rval = wordfile(portLp, |
447 |
< |
MAXSET - (portLp - photonPortList), |
448 |
< |
getpath(argv [++i], |
449 |
< |
getrlibpath(), R_OK)); |
446 |
> |
rval = wordfile( |
447 |
> |
portLp, MAXSET - (portLp - photonPortList), |
448 |
> |
getpath(argv [++i], getrlibpath(), R_OK) |
449 |
> |
); |
450 |
|
if (rval < 0) { |
451 |
< |
sprintf(errmsg, |
452 |
< |
"cannot open photon port file %s", |
453 |
< |
argv [i]); |
451 |
> |
sprintf( |
452 |
> |
errmsg, "cannot open photon port file %s", |
453 |
> |
argv [i] |
454 |
> |
); |
455 |
|
error(SYSTEM, errmsg); |
456 |
|
} |
457 |
< |
portLp += rval; |
457 |
> |
/* HACK: append port orientation flags to every |
458 |
> |
* modifier; note this requires reallocation */ |
459 |
> |
for (; rval--; portLp++) { |
460 |
> |
j = strlen(*portLp); |
461 |
> |
if (!(*portLp = realloc(*portLp, j + 2))) { |
462 |
> |
sprintf( |
463 |
> |
errmsg, |
464 |
> |
"cannot allocate photon port modifiers" |
465 |
> |
" from file %s", argv [i] |
466 |
> |
); |
467 |
> |
error(SYSTEM, errmsg); |
468 |
> |
} |
469 |
> |
strcat(*portLp, portFlags); |
470 |
> |
} |
471 |
|
} |
472 |
|
else { |
473 |
< |
/* Add port modifier from next arg, mark end with |
474 |
< |
* NULL */ |
475 |
< |
*portLp++ = savqstr(argv [++i]); |
473 |
> |
/* Append port flags to port modifier, add to |
474 |
> |
* port list and mark of end list with NULL */ |
475 |
> |
strcpy(sbuf, argv [++i]); |
476 |
> |
strcat(sbuf, portFlags); |
477 |
> |
*portLp++ = savqstr(sbuf); |
478 |
|
*portLp = NULL; |
479 |
|
} |
480 |
|
break; |
487 |
|
case 's': /* Antimatter sensor */ |
488 |
|
case 'S': |
489 |
|
check(4, "s"); |
490 |
< |
if (argv[i][3] == 'S') { |
490 |
> |
if (isupper(argv[i][3])) { |
491 |
|
/* Add sensor modifiers from file */ |
492 |
< |
rval = wordfile(sensLp, |
493 |
< |
MAXSET - (sensLp - photonSensorList), |
494 |
< |
getpath(argv [++i], |
495 |
< |
getrlibpath(), R_OK)); |
492 |
> |
rval = wordfile( |
493 |
> |
sensLp, MAXSET - (sensLp - photonSensorList), |
494 |
> |
getpath(argv [++i], getrlibpath(), R_OK) |
495 |
> |
); |
496 |
|
if (rval < 0) { |
497 |
< |
sprintf(errmsg, |
498 |
< |
"cannot open antimatter sensor file %s", |
499 |
< |
argv [i]); |
500 |
< |
error(SYSTEM, errmsg); |
497 |
> |
sprintf( |
498 |
> |
errmsg, |
499 |
> |
"cannot open antimatter sensor file %s", |
500 |
> |
argv [i] |
501 |
> |
); |
502 |
> |
error(SYSTEM, errmsg); |
503 |
|
} |
504 |
|
sensLp += rval; |
505 |
|
} |
578 |
|
|
579 |
|
case 'm': /* Medium */ |
580 |
|
switch (argv[i][2]) { |
581 |
< |
case 'e': /* Eggs-tinction coefficient */ |
581 |
> |
case 'e': /* Eggs-tinction coefficient */ |
582 |
|
check(3, "fff"); |
583 |
< |
setcolor(cextinction, atof(argv [i + 1]), |
584 |
< |
atof(argv [i + 2]), atof(argv [i + 3])); |
583 |
> |
setcolor( |
584 |
> |
cextinction, atof(argv [i + 1]), |
585 |
> |
atof(argv [i + 2]), atof(argv [i + 3]) |
586 |
> |
); |
587 |
|
i += 3; |
588 |
|
break; |
589 |
|
|
590 |
|
case 'a': /* Albedo */ |
591 |
|
check(3, "fff"); |
592 |
< |
setcolor(salbedo, atof(argv [i + 1]), |
593 |
< |
atof(argv [i + 2]), atof(argv [i + 3])); |
592 |
> |
setcolor( |
593 |
> |
salbedo, atof(argv [i + 1]), |
594 |
> |
atof(argv [i + 2]), atof(argv [i + 3]) |
595 |
> |
); |
596 |
|
i += 3; |
597 |
|
break; |
598 |
|
|
612 |
|
|
613 |
|
if (nproc > PMAP_MAXPROC) { |
614 |
|
nproc = PMAP_MAXPROC; |
615 |
< |
sprintf(errmsg, "too many parallel processes, clamping to " |
616 |
< |
"%d\n", nproc); |
615 |
> |
sprintf( |
616 |
> |
errmsg, "too many parallel processes, clamping to %d\n", |
617 |
> |
nproc |
618 |
> |
); |
619 |
|
error(WARNING, errmsg); |
620 |
< |
} |
621 |
< |
break; |
620 |
> |
} |
621 |
> |
break; |
622 |
|
#endif |
623 |
|
|
624 |
|
case 't': /* Timer */ |
634 |
|
case 'A': /* Angular source file */ |
635 |
|
check(2,"s"); |
636 |
|
angsrcfile = argv[++i]; |
637 |
< |
break; |
637 |
> |
break; |
638 |
|
#endif |
639 |
|
|
640 |
|
default: goto badopt; |
643 |
|
|
644 |
|
/* Open diagnostics file */ |
645 |
|
if (diagFile) { |
646 |
< |
if (!freopen(diagFile, "a", stderr)) quit(2); |
646 |
> |
if (!freopen(diagFile, "a", stderr)) |
647 |
> |
quit(2); |
648 |
|
fprintf(stderr, "**************\n*** PID %5d: ", getpid()); |
649 |
|
printargs(argc, argv, stderr); |
650 |
|
putc('\n', stderr); |
664 |
|
setPmapParam(photonMaps + i, pmapParams + i); |
665 |
|
|
666 |
|
/* Don't overwrite existing photon map unless clobbering enabled */ |
667 |
< |
if (photonMaps [i] && !stat(photonMaps [i] -> fileName, &pmstat) && |
668 |
< |
!clobber) { |
669 |
< |
sprintf(errmsg, "photon map file %s exists, not overwritten", |
670 |
< |
photonMaps [i] -> fileName); |
667 |
> |
if ( |
668 |
> |
photonMaps [i] && !stat(photonMaps [i] -> fileName, &pmstat) && |
669 |
> |
!clobber |
670 |
> |
) { |
671 |
> |
sprintf( |
672 |
> |
errmsg, "photon map file %s exists, not overwritten", |
673 |
> |
photonMaps [i] -> fileName |
674 |
> |
); |
675 |
|
error(USER, errmsg); |
676 |
|
} |
677 |
|
} |
678 |
|
|
679 |
< |
for (i = 0; i < NUM_PMAP_TYPES && !photonMaps [i]; i++); |
679 |
> |
for (i = 0; i < NUM_PMAP_TYPES && !photonMaps [i]; i++); |
680 |
|
if (i >= NUM_PMAP_TYPES) |
681 |
|
error(USER, "no photon maps specified"); |
682 |
|
|
711 |
|
#undef check_bool |
712 |
|
return 0; |
713 |
|
} |
714 |
+ |
|