21 |
|
|
22 |
|
extern char *progname; /* global argv[0] */ |
23 |
|
|
24 |
– |
extern char *shm_boundary; /* boundary of shared memory */ |
25 |
– |
|
24 |
|
/* persistent processes define */ |
25 |
|
#ifdef F_SETLKW |
26 |
|
#define PERSIST 1 /* normal persist */ |
57 |
|
char *tralist[MAXMODLIST]; /* list of modifers to trace (or no) */ |
58 |
|
int traincl = -1; /* include == 1, exclude == 0 */ |
59 |
|
|
60 |
< |
double (*sens_curve)(SCOLOR scol) = NULL; /* spectral conversion for 1-channel */ |
60 |
> |
double (*sens_curve)(const SCOLOR scol) = NULL; /* spectral conversion for 1-channel */ |
61 |
|
double out_scalefactor = 1; /* output calibration scale factor */ |
62 |
|
RGBPRIMP out_prims = stdprims; /* output color primitives (NULL if spectral) */ |
63 |
|
static RGBPRIMS our_prims; /* private output color primitives */ |
71 |
|
#ifdef PERSIST |
72 |
|
#define RTRACE_FEATURES "Persist\nParallelPersist\nMultiprocessing\n" \ |
73 |
|
"IrradianceCalc\nImmediateIrradiance\nDistanceLimiting\n" \ |
74 |
< |
"Hyperspectral\nParticipatingMedia=Mist\n" \ |
74 |
> |
"ParticipatingMedia=Mist\n" \ |
75 |
|
"HessianAmbientCache\nAmbientAveraging\n" \ |
76 |
|
"AmbientValueSharing\nAdaptiveShadowTesting\n" \ |
77 |
|
"InputFormats=a,f,d\nOutputFormats=a,f,d,c\n" \ |
78 |
< |
"Outputs=o,d,v,V,w,W,l,L,c,p,n,N,s,m,M,r,x,R,X,~\n" |
78 |
> |
"Outputs=o,d,v,V,w,W,l,L,c,p,n,N,s,m,M,r,x,R,X,~\n" \ |
79 |
> |
"OutputCS=RGB,XYZ,Y,S,M,prims,spec\n" |
80 |
|
#else |
81 |
|
#define RTRACE_FEATURES "IrradianceCalc\nIrradianceCalc\nDistanceLimiting\n" \ |
82 |
< |
"Hyperspectral\nParticipatingMedia=Mist\n" \ |
82 |
> |
"ParticipatingMedia=Mist\n" \ |
83 |
|
"HessianAmbientCache\nAmbientAveraging\n" \ |
84 |
|
"AmbientValueSharing\nAdaptiveShadowTesting\n" \ |
85 |
|
"InputFormats=a,f,d\nOutputFormats=a,f,d,c\n" \ |
86 |
< |
"Outputs=o,d,v,V,w,W,l,L,c,p,n,N,s,m,M,r,x,R,X,~\n" |
86 |
> |
"Outputs=o,d,v,V,w,W,l,L,c,p,n,N,s,m,M,r,x,R,X,~\n" \ |
87 |
> |
"OutputCS=RGB,XYZ,Y,S,M,prims,spec\n" |
88 |
|
#endif |
89 |
|
|
90 |
|
|
294 |
|
sens_curve = NULL; |
295 |
|
} break; |
296 |
|
case 'Y': /* photopic response */ |
297 |
+ |
if (argv[i][3]) |
298 |
+ |
goto badopt; |
299 |
|
sens_curve = scolor_photopic; |
300 |
|
out_scalefactor = WHTEFFICACY; |
301 |
|
break; |
302 |
|
case 'S': /* scotopic response */ |
303 |
+ |
if (argv[i][3]) |
304 |
+ |
goto badopt; |
305 |
|
sens_curve = scolor_scotopic; |
306 |
|
out_scalefactor = WHTSCOTOPIC; |
307 |
|
break; |
308 |
|
case 'M': /* melanopic response */ |
309 |
+ |
if (argv[i][3]) |
310 |
+ |
goto badopt; |
311 |
|
sens_curve = scolor_melanopic; |
312 |
|
out_scalefactor = WHTMELANOPIC; |
313 |
|
break; |
316 |
|
} |
317 |
|
break; |
318 |
|
#if MAXCSAMP>3 |
319 |
< |
case 'c': /* spectral sampling */ |
320 |
< |
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: |
319 |
> |
case 'c': /* output spectral results */ |
320 |
> |
if (argv[i][2] != 'o') |
321 |
|
goto badopt; |
322 |
< |
} |
322 |
> |
rval = (out_prims == NULL) & (sens_curve == NULL); |
323 |
> |
check_bool(3,rval); |
324 |
> |
if (rval) { |
325 |
> |
out_prims = NULL; |
326 |
> |
sens_curve = NULL; |
327 |
> |
} else if (out_prims == NULL) |
328 |
> |
out_prims = stdprims; |
329 |
|
break; |
330 |
|
#endif |
331 |
|
#ifdef PERSIST |
451 |
|
dup2(duped1, fileno(stdout)); |
452 |
|
close(duped1); |
453 |
|
if (persist == PARALLEL) { /* multiprocessing */ |
454 |
< |
preload_objs(); /* preload scene */ |
459 |
< |
shm_boundary = (char *)malloc(16); |
460 |
< |
strcpy(shm_boundary, "SHM_BOUNDARY"); |
454 |
> |
cow_memshare(); /* preloads scene */ |
455 |
|
while ((rval=fork()) == 0) { /* keep on forkin' */ |
456 |
|
pflock(1); |
457 |
|
pfhold(); |
572 |
|
{ |
573 |
|
char *cp; |
574 |
|
|
575 |
+ |
printf(erract[WARNING].pf != NULL ? |
576 |
+ |
"-w+\t\t\t\t# warning messages on\n" : |
577 |
+ |
"-w-\t\t\t\t# warning messages off\n"); |
578 |
|
if (imm_irrad) |
579 |
|
printf("-I+\t\t\t\t# immediate irradiance on\n"); |
580 |
|
printf("-n %-2d\t\t\t\t# number of rendering processes\n", nproc); |
612 |
|
case '~': printf(" tilde"); break; |
613 |
|
} |
614 |
|
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 |
– |
} |
615 |
|
if (sens_curve == scolor_photopic) |
616 |
|
printf("-pY\t\t\t\t# photopic output\n"); |
617 |
|
else if (sens_curve == scolor_scotopic) |
628 |
|
out_prims[GRN][0], out_prims[GRN][1], |
629 |
|
out_prims[BLU][0], out_prims[BLU][1], |
630 |
|
out_prims[WHT][0], out_prims[WHT][1]); |
631 |
< |
printf(erract[WARNING].pf != NULL ? |
632 |
< |
"-w+\t\t\t\t# warning messages on\n" : |
633 |
< |
"-w-\t\t\t\t# warning messages off\n"); |
631 |
> |
if ((sens_curve == NULL) & (NCSAMP > 3)) |
632 |
> |
printf(out_prims != NULL ? "-co-\t\t\t\t# output tristimulus colors\n" : |
633 |
> |
"-co+\t\t\t\t# output spectral values\n"); |
634 |
|
print_rdefaults(); |
635 |
|
} |