| 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" |
| 19 |
– |
#include "paths.h" |
| 20 |
|
#include "pmapray.h" |
| 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 */ |
| 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 |
|
"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 |
|
|
| 114 |
|
strcat(RFeatureList, RTRACE_FEATURES); |
| 115 |
|
if (argc > 1 && !strcmp(argv[1], "-features")) |
| 116 |
|
return feature_status(argc-2, argv+2); |
| 117 |
+ |
/* initialize calcomp routines */ |
| 118 |
+ |
initfunc(); |
| 119 |
|
/* add trace notify function */ |
| 120 |
|
for (i = 0; addobjnotify[i] != NULL; i++) |
| 121 |
|
; |
| 350 |
|
rval = setspectrsamp(CNDX, WLPART); |
| 351 |
|
if (rval < 0) |
| 352 |
|
error(USER, "unsupported spectral sampling"); |
| 353 |
< |
if (out_prims != NULL) { |
| 353 |
> |
if (sens_curve != NULL) |
| 354 |
> |
out_prims = NULL; |
| 355 |
> |
else if (out_prims != NULL) { |
| 356 |
|
if (!rval) |
| 357 |
|
error(WARNING, "spectral range incompatible with color output"); |
| 358 |
|
} else if (NCSAMP == 3) |
| 362 |
|
/* initialize object types */ |
| 363 |
|
initotypes(); |
| 364 |
|
/* initialize urand */ |
| 365 |
< |
if (rand_samp) { |
| 362 |
< |
srandom((long)time(0)); |
| 363 |
< |
initurand(0); |
| 364 |
< |
} else { |
| 365 |
< |
srandom(0L); |
| 366 |
< |
initurand(2048); |
| 367 |
< |
} |
| 365 |
> |
reset_random(); |
| 366 |
|
/* set up signal handling */ |
| 367 |
|
sigdie(SIGINT, "Interrupt"); |
| 368 |
|
#ifdef SIGHUP |
| 449 |
|
dup2(duped1, fileno(stdout)); |
| 450 |
|
close(duped1); |
| 451 |
|
if (persist == PARALLEL) { /* multiprocessing */ |
| 452 |
< |
preload_objs(); /* preload scene */ |
| 455 |
< |
shm_boundary = (char *)malloc(16); |
| 456 |
< |
strcpy(shm_boundary, "SHM_BOUNDARY"); |
| 452 |
> |
cow_memshare(); /* preloads scene */ |
| 453 |
|
while ((rval=fork()) == 0) { /* keep on forkin' */ |
| 454 |
|
pflock(1); |
| 455 |
|
pfhold(); |
| 506 |
|
) |
| 507 |
|
{ |
| 508 |
|
int lasterrno = errno; |
| 509 |
+ |
if (erract[WARNING].pf == NULL) |
| 510 |
+ |
return; /* called by calcomp or someone */ |
| 511 |
|
eputs(s); |
| 512 |
|
errno = lasterrno; |
| 513 |
|
} |
| 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 |
< |
if (NCSAMP > 3) |
| 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(); |