| 35 |
|
|
| 36 |
|
int nproc = 1; /* number of processes */ |
| 37 |
|
|
| 38 |
– |
extern char *formstr(int f); /* string from format */ |
| 38 |
|
extern int setrtoutput(void); /* set output values */ |
| 39 |
|
|
| 40 |
|
int inform = 'a'; /* input format */ |
| 44 |
|
int hresolu = 0; /* horizontal (scan) size */ |
| 45 |
|
int vresolu = 0; /* vertical resolution */ |
| 46 |
|
|
| 47 |
< |
int castonly = 0; /* only doing ray-casting? */ |
| 47 |
> |
extern int castonly; /* only doing ray-casting? */ |
| 48 |
|
|
| 49 |
|
int imm_irrad = 0; /* compute immediate irradiance? */ |
| 50 |
|
int lim_dist = 0; /* limit distance? */ |
| 65 |
|
static void sigdie(int signo, char *msg); |
| 66 |
|
static void printdefaults(void); |
| 67 |
|
|
| 68 |
+ |
#ifdef PERSIST |
| 69 |
+ |
#define RTRACE_FEATURES "Persist\nParallelPersist\nMultiProcessing\n" \ |
| 70 |
+ |
"IrradianceCalc\nImmediateIrradiance\nDistanceLimiting\n" \ |
| 71 |
+ |
"HessianAmbientCache\nAmbientAveraging\n" \ |
| 72 |
+ |
"AmbientValueSharing\nAdaptiveShadowTesting\n" \ |
| 73 |
+ |
"Outputs=o,d,v,V,w,W,l,L,c,p,n,N,s,m,M,r,x,R,X,~\n" |
| 74 |
+ |
#else |
| 75 |
+ |
#define RTRACE_FEATURES "IrradianceCalc\nIrradianceCalc\nDistanceLimiting\n" \ |
| 76 |
+ |
"HessianAmbientCache\nAmbientAveraging\n" \ |
| 77 |
+ |
"AmbientValueSharing\nAdaptiveShadowTesting\n" \ |
| 78 |
+ |
"Outputs=o,d,v,V,w,W,l,L,c,p,n,N,s,m,M,r,x,R,X,~\n" |
| 79 |
+ |
#endif |
| 80 |
|
|
| 81 |
+ |
|
| 82 |
|
int |
| 83 |
|
main(int argc, char *argv[]) |
| 84 |
|
{ |
| 101 |
|
int i; |
| 102 |
|
/* global program name */ |
| 103 |
|
progname = argv[0] = fixargv0(argv[0]); |
| 104 |
+ |
/* feature check only? */ |
| 105 |
+ |
strcat(RFeatureList, RTRACE_FEATURES); |
| 106 |
+ |
if (argc > 1 && !strcmp(argv[1], "-features")) |
| 107 |
+ |
return feature_status(argc-2, argv+2); |
| 108 |
|
/* add trace notify function */ |
| 109 |
|
for (i = 0; addobjnotify[i] != NULL; i++) |
| 110 |
|
; |
| 267 |
|
goto badopt; |
| 268 |
|
} |
| 269 |
|
} |
| 270 |
< |
if (nproc > 1) { |
| 271 |
< |
if (persist) |
| 256 |
< |
error(USER, "multiprocessing incompatible with persist file"); |
| 257 |
< |
if (!vresolu && hresolu > 0 && hresolu < nproc) |
| 258 |
< |
error(WARNING, "number of cores should not exceed horizontal resolution"); |
| 259 |
< |
if (trace != NULL) |
| 260 |
< |
error(WARNING, "multiprocessing does not work properly with trace mode"); |
| 261 |
< |
} |
| 270 |
> |
if (nproc > 1 && persist) |
| 271 |
> |
error(USER, "multiprocessing incompatible with persist file"); |
| 272 |
|
/* initialize object types */ |
| 273 |
|
initotypes(); |
| 274 |
|
/* initialize urand */ |
| 327 |
|
if (outform != 'a') |
| 328 |
|
SET_FILE_BINARY(stdout); |
| 329 |
|
rval = setrtoutput(); |
| 330 |
< |
readoct(octname = octnm, loadflags, &thescene, NULL); |
| 330 |
> |
octname = savqstr(octnm); |
| 331 |
> |
readoct(octname, loadflags, &thescene, NULL); |
| 332 |
|
nsceneobjs = nobjects; |
| 333 |
|
|
| 334 |
|
if (loadflags & IO_INFO) { /* print header */ |
| 350 |
|
marksources(); /* find and mark sources */ |
| 351 |
|
|
| 352 |
|
setambient(); /* initialize ambient calculation */ |
| 353 |
< |
} |
| 353 |
> |
} else |
| 354 |
> |
distantsources(); /* else mark only distant sources */ |
| 355 |
> |
|
| 356 |
> |
fflush(stdout); /* in case we're duplicating header */ |
| 357 |
> |
|
| 358 |
|
#ifdef PERSIST |
| 359 |
|
if (persist) { |
| 345 |
– |
fflush(stdout); |
| 360 |
|
/* reconnect stdout */ |
| 361 |
|
dup2(duped1, fileno(stdout)); |
| 362 |
|
close(duped1); |
| 416 |
|
|
| 417 |
|
void |
| 418 |
|
wputs( /* warning output function */ |
| 419 |
< |
char *s |
| 419 |
> |
const char *s |
| 420 |
|
) |
| 421 |
|
{ |
| 422 |
|
int lasterrno = errno; |
| 427 |
|
|
| 428 |
|
void |
| 429 |
|
eputs( /* put string to stderr */ |
| 430 |
< |
register char *s |
| 430 |
> |
const char *s |
| 431 |
|
) |
| 432 |
|
{ |
| 433 |
|
static int midline = 0; |
| 482 |
|
static void |
| 483 |
|
printdefaults(void) /* print default values to stdout */ |
| 484 |
|
{ |
| 485 |
< |
register char *cp; |
| 485 |
> |
char *cp; |
| 486 |
|
|
| 487 |
|
if (imm_irrad) |
| 488 |
|
printf("-I+\t\t\t\t# immediate irradiance on\n"); |
| 518 |
|
case 'W': printf(" coefficient"); break; |
| 519 |
|
case 'm': printf(" modifier"); break; |
| 520 |
|
case 'M': printf(" material"); break; |
| 521 |
< |
case '-': printf(" stroke"); break; |
| 521 |
> |
case '~': printf(" tilde"); break; |
| 522 |
|
} |
| 523 |
|
putchar('\n'); |
| 524 |
|
printf(erract[WARNING].pf != NULL ? |