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