| 21 |
|
int inpfmt = 'a'; /* input format */ |
| 22 |
|
int outfmt = 'f'; /* output format */ |
| 23 |
|
|
| 24 |
– |
int contrib = 0; /* computing contributions? */ |
| 25 |
– |
|
| 26 |
– |
int xres = 0; /* horizontal (scan) size */ |
| 27 |
– |
int yres = 0; /* vertical resolution */ |
| 28 |
– |
|
| 29 |
– |
int imm_irrad = 0; /* compute immediate irradiance? */ |
| 30 |
– |
int lim_dist = 0; /* limit distance? */ |
| 31 |
– |
|
| 24 |
|
int report_intvl = 0; /* reporting interval (seconds) */ |
| 25 |
|
|
| 26 |
|
extern char * progname; // global argv[0] |
| 30 |
|
#define RCONTRIB_FEATURES "Multiprocessing\n" \ |
| 31 |
|
"Accumulation\nRecovery\n" \ |
| 32 |
|
"ImmediateIrradiance\n" \ |
| 33 |
< |
"ProgressReporting?\nDistanceLimiting\n" \ |
| 33 |
> |
"ProgressReporting\nDistanceLimiting\n" \ |
| 34 |
|
"InputFormats=a,f,d\nOutputFormats=f,d,c\n" \ |
| 35 |
|
"Outputs=V,W\n" \ |
| 36 |
|
"OutputCS=RGB,spec\n" |
| 43 |
|
printf("-c %-5d\t\t\t# accumulated rays per record\n", myRCmanager.accum); |
| 44 |
|
printf("-V%c\t\t\t\t# output %s\n", contrib ? '+' : '-', |
| 45 |
|
contrib ? "contributions" : "coefficients"); |
| 46 |
< |
if (imm_irrad) |
| 46 |
> |
if (myRCmanager.HasFlag(RTimmIrrad)) |
| 47 |
|
printf("-I+\t\t\t\t# immediate irradiance on\n"); |
| 48 |
|
printf("-n %-2d\t\t\t\t# number of rendering processes\n", nproc); |
| 49 |
|
if (xres > 0) |
| 50 |
|
printf("-x %-9d\t\t\t# x resolution\n", xres); |
| 51 |
|
printf("-y %-9d\t\t\t# y resolution\n", yres); |
| 52 |
< |
printf(lim_dist ? "-ld+\t\t\t\t# limit distance on\n" : |
| 52 |
> |
printf(myRCmanager.HasFlag(RTlimDist) ? |
| 53 |
> |
"-ld+\t\t\t\t# limit distance on\n" : |
| 54 |
|
"-ld-\t\t\t\t# limit distance off\n"); |
| 55 |
|
printf("-f%c%c\t\t\t\t# format input/output = %s/%s\n", |
| 56 |
|
inpfmt, outfmt, formstr(inpfmt), formstr(outfmt)); |
| 211 |
|
continue; |
| 212 |
|
} |
| 213 |
|
switch (argv[i][1]) { |
| 214 |
< |
case 'n': /* number of cores */ |
| 214 |
> |
case 'n': /* number of processes */ |
| 215 |
|
check(2,"i"); |
| 216 |
|
nproc = atoi(argv[++i]); |
| 217 |
|
if (nproc < 0 && (nproc += RadSimulManager::GetNCores()) <= 0) |
| 218 |
|
nproc = 1; |
| 219 |
|
break; |
| 220 |
< |
case 'V': /* output contributions */ |
| 220 |
> |
case 'V': /* output contributions? */ |
| 221 |
|
check_bool(2,contrib); |
| 222 |
|
break; |
| 223 |
|
case 'x': /* x resolution */ |
| 228 |
|
check(2,"i"); |
| 229 |
|
yres = atoi(argv[++i]); |
| 230 |
|
break; |
| 231 |
< |
case 'w': /* warnings */ |
| 231 |
> |
case 'w': /* warnings on/off */ |
| 232 |
|
rval = (erract[WARNING].pf != NULL); |
| 233 |
|
check_bool(2,rval); |
| 234 |
|
if (rval) erract[WARNING].pf = wputs; |
| 235 |
|
else erract[WARNING].pf = NULL; |
| 236 |
|
break; |
| 237 |
< |
case 'e': /* expression */ |
| 237 |
> |
case 'e': /* .cal expression */ |
| 238 |
|
check(2,"s"); |
| 239 |
|
scompile(argv[++i], NULL, 0); |
| 240 |
|
break; |
| 241 |
|
case 'l': /* limit distance */ |
| 242 |
|
if (argv[i][2] != 'd') |
| 243 |
|
goto badopt; |
| 244 |
< |
check_bool(3,lim_dist); |
| 244 |
> |
rval = myRCmanager.HasFlag(RTlimDist); |
| 245 |
> |
check_bool(3,rval); |
| 246 |
> |
myRCmanager.SetFlag(RTlimDist, rval); |
| 247 |
|
break; |
| 248 |
|
case 'I': /* immed. irradiance */ |
| 249 |
< |
check_bool(2,imm_irrad); |
| 249 |
> |
rval = myRCmanager.HasFlag(RTimmIrrad); |
| 250 |
> |
check_bool(2,rval); |
| 251 |
> |
myRCmanager.SetFlag(RTimmIrrad, rval); |
| 252 |
|
break; |
| 253 |
< |
case 'f': /* file or force or format */ |
| 253 |
> |
case 'f': /* .cal file or force or format */ |
| 254 |
|
if (!argv[i][2]) { |
| 255 |
|
check(2,"s"); |
| 256 |
|
loadfunc(argv[++i]); |
| 263 |
|
setformat(argv[i]+2); |
| 264 |
|
myRCmanager.SetDataFormat(outfmt); |
| 265 |
|
break; |
| 266 |
< |
case 'o': /* output */ |
| 266 |
> |
case 'o': /* output file */ |
| 267 |
|
check(2,"s"); |
| 268 |
|
curout = argv[++i]; |
| 269 |
|
break; |
| 291 |
|
check(2,"s"); |
| 292 |
|
myRCmanager.AddModifier(argv[++i], curout, prms, binval, bincnt); |
| 293 |
|
break; |
| 294 |
< |
case 'M': /* modifier file */ |
| 294 |
> |
case 'M': /* file of modifier names */ |
| 295 |
|
check(2,"s"); |
| 296 |
|
myRCmanager.AddModFile(argv[++i], curout, prms, binval, bincnt); |
| 297 |
|
break; |
| 305 |
|
} |
| 306 |
|
if (i != argc-1) |
| 307 |
|
error(USER, "expected single octree argument"); |
| 308 |
+ |
|
| 309 |
+ |
override_options(); /* override some option settings */ |
| 310 |
+ |
|
| 311 |
+ |
if (!myRCmanager.GetOutput()) // check that we have work to do |
| 312 |
+ |
error(USER, "missing required modifier argument"); |
| 313 |
|
// get ready to rock... |
| 314 |
|
if (setspectrsamp(CNDX, WLPART) < 0) |
| 315 |
|
error(USER, "unsupported spectral sampling"); |
| 314 |
– |
|
| 315 |
– |
if (!myRCmanager.GetOutputs(NULL)) // check that we're ready |
| 316 |
– |
error(USER, "missing required modifier argument"); |
| 317 |
– |
/* override some option settings */ |
| 318 |
– |
override_options(); |
| 316 |
|
/* set up signal handling */ |
| 317 |
|
sigdie(SIGINT, "Interrupt"); |
| 318 |
|
#ifdef SIGHUP |
| 345 |
|
myRCmanager.outOp = RCOnew; |
| 346 |
|
// rval = # rows recovered |
| 347 |
|
rval = myRCmanager.PrepOutput(); |
| 348 |
< |
// check if all done |
| 348 |
> |
// check if recovered everything |
| 349 |
|
if (recover && rval >= myRCmanager.GetRowMax()) { |
| 350 |
|
error(WARNING, "nothing left to compute"); |
| 351 |
|
quit(0); |
| 548 |
|
} |
| 549 |
|
|
| 550 |
|
|
| 551 |
< |
/* Quit program */ |
| 551 |
> |
/* Exit program */ |
| 552 |
|
void |
| 553 |
|
quit( |
| 554 |
|
int code |