| 13 |
|
#include "rtprocess.h" /* getpid() */ |
| 14 |
|
#include "resolu.h" |
| 15 |
|
#include "ray.h" |
| 16 |
+ |
#include "func.h" |
| 17 |
|
#include "source.h" |
| 18 |
|
#include "ambient.h" |
| 19 |
|
#include "random.h" |
| 22 |
|
|
| 23 |
|
extern char *progname; /* global argv[0] */ |
| 24 |
|
|
| 24 |
– |
extern char *shm_boundary; /* boundary of shared memory */ |
| 25 |
– |
|
| 25 |
|
/* persistent processes define */ |
| 26 |
|
#ifdef F_SETLKW |
| 27 |
|
#define PERSIST 1 /* normal persist */ |
| 58 |
|
char *tralist[MAXMODLIST]; /* list of modifers to trace (or no) */ |
| 59 |
|
int traincl = -1; /* include == 1, exclude == 0 */ |
| 60 |
|
|
| 61 |
< |
double (*sens_curve)(SCOLOR scol) = NULL; /* spectral conversion for 1-channel */ |
| 61 |
> |
double (*sens_curve)(const SCOLOR scol) = NULL; /* spectral conversion for 1-channel */ |
| 62 |
|
double out_scalefactor = 1; /* output calibration scale factor */ |
| 63 |
|
RGBPRIMP out_prims = stdprims; /* output color primitives (NULL if spectral) */ |
| 64 |
|
static RGBPRIMS our_prims; /* private output color primitives */ |
| 76 |
|
"HessianAmbientCache\nAmbientAveraging\n" \ |
| 77 |
|
"AmbientValueSharing\nAdaptiveShadowTesting\n" \ |
| 78 |
|
"InputFormats=a,f,d\nOutputFormats=a,f,d,c\n" \ |
| 79 |
< |
"Outputs=o,d,v,V,w,W,l,L,c,p,n,N,s,m,M,r,x,R,X,~\n" |
| 79 |
> |
"Outputs=o,d,v,V,w,W,l,L,c,p,n,N,s,m,M,r,x,R,X,~\n" \ |
| 80 |
> |
"OutputCS=RGB,XYZ,Y,S,M,prims,spec\n" |
| 81 |
|
#else |
| 82 |
|
#define RTRACE_FEATURES "IrradianceCalc\nIrradianceCalc\nDistanceLimiting\n" \ |
| 83 |
|
"ParticipatingMedia=Mist\n" \ |
| 84 |
|
"HessianAmbientCache\nAmbientAveraging\n" \ |
| 85 |
|
"AmbientValueSharing\nAdaptiveShadowTesting\n" \ |
| 86 |
|
"InputFormats=a,f,d\nOutputFormats=a,f,d,c\n" \ |
| 87 |
< |
"Outputs=o,d,v,V,w,W,l,L,c,p,n,N,s,m,M,r,x,R,X,~\n" |
| 87 |
> |
"Outputs=o,d,v,V,w,W,l,L,c,p,n,N,s,m,M,r,x,R,X,~\n" \ |
| 88 |
> |
"OutputCS=RGB,XYZ,Y,S,M,prims,spec\n" |
| 89 |
|
#endif |
| 90 |
|
|
| 91 |
|
|
| 115 |
|
strcat(RFeatureList, RTRACE_FEATURES); |
| 116 |
|
if (argc > 1 && !strcmp(argv[1], "-features")) |
| 117 |
|
return feature_status(argc-2, argv+2); |
| 118 |
+ |
/* initialize calcomp routines */ |
| 119 |
+ |
initfunc(); |
| 120 |
|
/* add trace notify function */ |
| 121 |
|
for (i = 0; addobjnotify[i] != NULL; i++) |
| 122 |
|
; |
| 297 |
|
sens_curve = NULL; |
| 298 |
|
} break; |
| 299 |
|
case 'Y': /* photopic response */ |
| 300 |
+ |
if (argv[i][3]) |
| 301 |
+ |
goto badopt; |
| 302 |
|
sens_curve = scolor_photopic; |
| 303 |
|
out_scalefactor = WHTEFFICACY; |
| 304 |
|
break; |
| 305 |
|
case 'S': /* scotopic response */ |
| 306 |
+ |
if (argv[i][3]) |
| 307 |
+ |
goto badopt; |
| 308 |
|
sens_curve = scolor_scotopic; |
| 309 |
|
out_scalefactor = WHTSCOTOPIC; |
| 310 |
|
break; |
| 311 |
|
case 'M': /* melanopic response */ |
| 312 |
+ |
if (argv[i][3]) |
| 313 |
+ |
goto badopt; |
| 314 |
|
sens_curve = scolor_melanopic; |
| 315 |
|
out_scalefactor = WHTMELANOPIC; |
| 316 |
|
break; |
| 351 |
|
rval = setspectrsamp(CNDX, WLPART); |
| 352 |
|
if (rval < 0) |
| 353 |
|
error(USER, "unsupported spectral sampling"); |
| 354 |
< |
if (out_prims != NULL) { |
| 354 |
> |
if (sens_curve != NULL) |
| 355 |
> |
out_prims = NULL; |
| 356 |
> |
else if (out_prims != NULL) { |
| 357 |
|
if (!rval) |
| 358 |
|
error(WARNING, "spectral range incompatible with color output"); |
| 359 |
|
} else if (NCSAMP == 3) |
| 456 |
|
dup2(duped1, fileno(stdout)); |
| 457 |
|
close(duped1); |
| 458 |
|
if (persist == PARALLEL) { /* multiprocessing */ |
| 459 |
< |
preload_objs(); /* preload scene */ |
| 449 |
< |
shm_boundary = (char *)malloc(16); |
| 450 |
< |
strcpy(shm_boundary, "SHM_BOUNDARY"); |
| 459 |
> |
cow_memshare(); /* preloads scene */ |
| 460 |
|
while ((rval=fork()) == 0) { /* keep on forkin' */ |
| 461 |
|
pflock(1); |
| 462 |
|
pfhold(); |
| 513 |
|
) |
| 514 |
|
{ |
| 515 |
|
int lasterrno = errno; |
| 516 |
+ |
if (erract[WARNING].pf == NULL) |
| 517 |
+ |
return; /* called by calcomp or someone */ |
| 518 |
|
eputs(s); |
| 519 |
|
errno = lasterrno; |
| 520 |
|
} |
| 635 |
|
out_prims[GRN][0], out_prims[GRN][1], |
| 636 |
|
out_prims[BLU][0], out_prims[BLU][1], |
| 637 |
|
out_prims[WHT][0], out_prims[WHT][1]); |
| 638 |
< |
if (NCSAMP > 3) |
| 638 |
> |
if ((sens_curve == NULL) & (NCSAMP > 3)) |
| 639 |
|
printf(out_prims != NULL ? "-co-\t\t\t\t# output tristimulus colors\n" : |
| 640 |
|
"-co+\t\t\t\t# output spectral values\n"); |
| 641 |
|
print_rdefaults(); |