| 59 |
|
char *tralist[MAXMODLIST]; /* list of modifers to trace (or no) */ |
| 60 |
|
int traincl = -1; /* include == 1, exclude == 0 */ |
| 61 |
|
|
| 62 |
+ |
double (*sens_curve)(SCOLOR scol) = NULL; /* spectral conversion for 1-channel */ |
| 63 |
+ |
double out_scalefactor = 1; /* output calibration scale factor */ |
| 64 |
+ |
RGBPRIMP out_prims = stdprims; /* output color primitives (NULL if spectral) */ |
| 65 |
+ |
static RGBPRIMS our_prims; /* private output color primitives */ |
| 66 |
+ |
|
| 67 |
|
static int loadflags = ~IO_FILES; /* what to load from octree */ |
| 68 |
|
|
| 69 |
|
static void onsig(int signo); |
| 73 |
|
#ifdef PERSIST |
| 74 |
|
#define RTRACE_FEATURES "Persist\nParallelPersist\nMultiprocessing\n" \ |
| 75 |
|
"IrradianceCalc\nImmediateIrradiance\nDistanceLimiting\n" \ |
| 76 |
< |
"ParticipatingMedia=Mist\n" \ |
| 76 |
> |
"Hyperspectral\nParticipatingMedia=Mist\n" \ |
| 77 |
|
"HessianAmbientCache\nAmbientAveraging\n" \ |
| 78 |
|
"AmbientValueSharing\nAdaptiveShadowTesting\n" \ |
| 79 |
|
"InputFormats=a,f,d\nOutputFormats=a,f,d,c\n" \ |
| 80 |
|
"Outputs=o,d,v,V,w,W,l,L,c,p,n,N,s,m,M,r,x,R,X,~\n" |
| 81 |
|
#else |
| 82 |
|
#define RTRACE_FEATURES "IrradianceCalc\nIrradianceCalc\nDistanceLimiting\n" \ |
| 83 |
< |
"ParticipatingMedia=Mist\n" \ |
| 83 |
> |
"Hyperspectral\nParticipatingMedia=Mist\n" \ |
| 84 |
|
"HessianAmbientCache\nAmbientAveraging\n" \ |
| 85 |
|
"AmbientValueSharing\nAdaptiveShadowTesting\n" \ |
| 86 |
|
"InputFormats=a,f,d\nOutputFormats=a,f,d,c\n" \ |
| 158 |
|
check(2,"i"); |
| 159 |
|
vresolu = atoi(argv[++i]); |
| 160 |
|
break; |
| 161 |
< |
case 'w': /* warnings */ |
| 161 |
> |
case 'w': /* warnings & spectral */ |
| 162 |
|
rval = erract[WARNING].pf != NULL; |
| 163 |
|
check_bool(2,rval); |
| 164 |
|
if (rval) erract[WARNING].pf = wputs; |
| 260 |
|
goto badopt; |
| 261 |
|
} |
| 262 |
|
break; |
| 263 |
+ |
case 'p': /* value output */ |
| 264 |
+ |
switch (argv[i][2]) { |
| 265 |
+ |
case 'R': /* standard RGB output */ |
| 266 |
+ |
if (strcmp(argv[i]+2, "RGB")) |
| 267 |
+ |
goto badopt; |
| 268 |
+ |
out_prims = stdprims; |
| 269 |
+ |
out_scalefactor = 1; |
| 270 |
+ |
sens_curve = NULL; |
| 271 |
+ |
break; |
| 272 |
+ |
case 'X': /* XYZ output */ |
| 273 |
+ |
if (strcmp(argv[i]+2, "XYZ")) |
| 274 |
+ |
goto badopt; |
| 275 |
+ |
out_prims = xyzprims; |
| 276 |
+ |
out_scalefactor = WHTEFFICACY; |
| 277 |
+ |
sens_curve = NULL; |
| 278 |
+ |
break; |
| 279 |
+ |
case 'c': { |
| 280 |
+ |
int j; |
| 281 |
+ |
check(3,"ffffffff"); |
| 282 |
+ |
rval = 0; |
| 283 |
+ |
for (j = 0; j < 8; j++) { |
| 284 |
+ |
our_prims[0][j] = atof(argv[++i]); |
| 285 |
+ |
rval |= fabs(our_prims[0][j]-stdprims[0][j]) > .001; |
| 286 |
+ |
} |
| 287 |
+ |
if (rval) { |
| 288 |
+ |
if (!colorprimsOK(our_prims)) |
| 289 |
+ |
error(USER, "illegal primary chromaticities"); |
| 290 |
+ |
out_prims = our_prims; |
| 291 |
+ |
} else |
| 292 |
+ |
out_prims = stdprims; |
| 293 |
+ |
out_scalefactor = 1; |
| 294 |
+ |
sens_curve = NULL; |
| 295 |
+ |
} break; |
| 296 |
+ |
case 'Y': /* photopic response */ |
| 297 |
+ |
sens_curve = scolor_photopic; |
| 298 |
+ |
out_scalefactor = WHTEFFICACY; |
| 299 |
+ |
break; |
| 300 |
+ |
case 'S': /* scotopic response */ |
| 301 |
+ |
sens_curve = scolor_scotopic; |
| 302 |
+ |
out_scalefactor = WHTSCOTOPIC; |
| 303 |
+ |
break; |
| 304 |
+ |
case 'M': /* melanopic response */ |
| 305 |
+ |
sens_curve = scolor_melanopic; |
| 306 |
+ |
out_scalefactor = WHTMELANOPIC; |
| 307 |
+ |
break; |
| 308 |
+ |
default: |
| 309 |
+ |
goto badopt; |
| 310 |
+ |
} |
| 311 |
+ |
break; |
| 312 |
+ |
#if MAXCSAMP>3 |
| 313 |
+ |
case 'c': /* spectral sampling */ |
| 314 |
+ |
switch (argv[i][2]) { |
| 315 |
+ |
case 's': /* spectral bin count */ |
| 316 |
+ |
check(3,"i"); |
| 317 |
+ |
NCSAMP = atoi(argv[++i]); |
| 318 |
+ |
break; |
| 319 |
+ |
case 'w': /* wavelength extrema */ |
| 320 |
+ |
check(3,"ff"); |
| 321 |
+ |
WLPART[0] = atof(argv[++i]); |
| 322 |
+ |
WLPART[3] = atof(argv[++i]); |
| 323 |
+ |
break; |
| 324 |
+ |
case 'o': /* output spectral results */ |
| 325 |
+ |
rval = (out_prims == NULL); |
| 326 |
+ |
check_bool(3,rval); |
| 327 |
+ |
if (rval) out_prims = NULL; |
| 328 |
+ |
else if (out_prims == NULL) out_prims = stdprims; |
| 329 |
+ |
break; |
| 330 |
+ |
default: |
| 331 |
+ |
goto badopt; |
| 332 |
+ |
} |
| 333 |
+ |
break; |
| 334 |
+ |
#endif |
| 335 |
|
#ifdef PERSIST |
| 336 |
|
case 'P': /* persist file */ |
| 337 |
|
if (argv[i][2] == 'P') { |
| 348 |
|
goto badopt; |
| 349 |
|
} |
| 350 |
|
} |
| 351 |
+ |
/* set/check spectral sampling */ |
| 352 |
+ |
rval = setspectrsamp(CNDX, WLPART); |
| 353 |
+ |
if (rval < 0) |
| 354 |
+ |
error(USER, "unsupported spectral sampling"); |
| 355 |
+ |
if (out_prims != NULL) { |
| 356 |
+ |
if (!rval) |
| 357 |
+ |
error(WARNING, "spectral range incompatible with color output"); |
| 358 |
+ |
} else if (NCSAMP == 3) |
| 359 |
+ |
out_prims = stdprims; /* 3 samples do not a spectrum make */ |
| 360 |
|
if (nproc > 1 && persist) |
| 361 |
|
error(USER, "multiprocessing incompatible with persist file"); |
| 362 |
|
/* initialize object types */ |
| 426 |
|
printf("SOFTWARE= %s\n", VersionID); |
| 427 |
|
fputnow(stdout); |
| 428 |
|
if (rval > 0) /* saved from setrtoutput() call */ |
| 429 |
< |
printf("NCOMP=%d\n", rval); |
| 429 |
> |
fputncomp(rval, stdout); |
| 430 |
> |
if (NCSAMP > 3) |
| 431 |
> |
fputwlsplit(WLPART, stdout); |
| 432 |
> |
if ((out_prims != stdprims) & (out_prims != NULL)) |
| 433 |
> |
fputprims(out_prims, stdout); |
| 434 |
|
if ((outform == 'f') | (outform == 'd')) |
| 435 |
|
fputendian(stdout); |
| 436 |
|
fputformat(formstr(outform), stdout); |
| 437 |
< |
putchar('\n'); |
| 437 |
> |
fputc('\n', stdout); /* end of header */ |
| 438 |
|
} |
| 439 |
|
|
| 440 |
|
if (!castonly) { /* any actual ray traversal to do? */ |
| 586 |
|
printf("-y %-9d\t\t\t# y resolution\n", vresolu); |
| 587 |
|
printf(lim_dist ? "-ld+\t\t\t\t# limit distance on\n" : |
| 588 |
|
"-ld-\t\t\t\t# limit distance off\n"); |
| 589 |
< |
printf("-h%c\t\t\t\t# %s header\n", loadflags & IO_INFO ? '+' : '-', |
| 590 |
< |
loadflags & IO_INFO ? "output" : "no"); |
| 589 |
> |
printf(loadflags & IO_INFO ? "-h+\t\t\t\t# output header\n" : |
| 590 |
> |
"-h-\t\t\t\t# no header\n"); |
| 591 |
|
printf("-f%c%c\t\t\t\t# format input/output = %s/%s\n", |
| 592 |
|
inform, outform, formstr(inform), formstr(outform)); |
| 593 |
|
printf("-o%-9s\t\t\t# output", outvals); |
| 614 |
|
case 'M': printf(" material"); break; |
| 615 |
|
case '~': printf(" tilde"); break; |
| 616 |
|
} |
| 617 |
< |
putchar('\n'); |
| 617 |
> |
fputc('\n', stdout); |
| 618 |
> |
if (NCSAMP > 3) { |
| 619 |
> |
printf("-cs %-2d\t\t\t\t# number of spectral bins\n", NCSAMP); |
| 620 |
> |
printf("-cw %3.0f %3.0f\t\t\t# wavelength limits (nm)\n", |
| 621 |
> |
WLPART[3], WLPART[0]); |
| 622 |
> |
printf(out_prims != NULL ? "-co-\t\t\t\t# output tristimulus colors\n" : |
| 623 |
> |
"-co+\t\t\t\t# output spectral values\n"); |
| 624 |
> |
} |
| 625 |
> |
if (sens_curve == scolor_photopic) |
| 626 |
> |
printf("-pY\t\t\t\t# photopic output\n"); |
| 627 |
> |
else if (sens_curve == scolor_scotopic) |
| 628 |
> |
printf("-pS\t\t\t\t# scotopic output\n"); |
| 629 |
> |
else if (sens_curve == scolor_melanopic) |
| 630 |
> |
printf("-pM\t\t\t\t# melanopic output\n"); |
| 631 |
> |
else if (out_prims == stdprims) |
| 632 |
> |
printf("-pRGB\t\t\t\t# standard RGB color output\n"); |
| 633 |
> |
else if (out_prims == xyzprims) |
| 634 |
> |
printf("-pXYZ\t\t\t\t# CIE XYZ color output\n"); |
| 635 |
> |
else if (out_prims != NULL) |
| 636 |
> |
printf("-pc %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f\t# output color primaries and white point\n", |
| 637 |
> |
out_prims[RED][0], out_prims[RED][1], |
| 638 |
> |
out_prims[GRN][0], out_prims[GRN][1], |
| 639 |
> |
out_prims[BLU][0], out_prims[BLU][1], |
| 640 |
> |
out_prims[WHT][0], out_prims[WHT][1]); |
| 641 |
|
printf(erract[WARNING].pf != NULL ? |
| 642 |
|
"-w+\t\t\t\t# warning messages on\n" : |
| 643 |
|
"-w-\t\t\t\t# warning messages off\n"); |