35 |
|
|
36 |
|
int nproc = 1; /* number of processes */ |
37 |
|
|
38 |
< |
extern char *formstr(); /* string from format */ |
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 |
|
|
93 |
|
for (i = 0; addobjnotify[i] != NULL; i++) |
94 |
|
; |
95 |
|
addobjnotify[i] = tranotify; |
92 |
– |
/* set our defaults */ |
93 |
– |
rand_samp = 1; |
94 |
– |
maxdepth = -10; |
95 |
– |
minweight = 2e-3; |
96 |
|
/* option city */ |
97 |
|
for (i = 1; i < argc; i++) { |
98 |
|
/* expand arguments */ |
195 |
|
tralp = tralist; |
196 |
|
} |
197 |
|
if (argv[i][2] == 'I') { /* file */ |
198 |
< |
rval = wordfile(tralp, |
198 |
> |
rval = wordfile(tralp, MAXMODLIST-(tralp-tralist), |
199 |
|
getpath(argv[++i],getrlibpath(),R_OK)); |
200 |
|
if (rval < 0) { |
201 |
|
sprintf(errmsg, |
217 |
|
tralp = tralist; |
218 |
|
} |
219 |
|
if (argv[i][2] == 'E') { /* file */ |
220 |
< |
rval = wordfile(tralp, |
220 |
> |
rval = wordfile(tralp, MAXMODLIST-(tralp-tralist), |
221 |
|
getpath(argv[++i],getrlibpath(),R_OK)); |
222 |
|
if (rval < 0) { |
223 |
|
sprintf(errmsg, |
251 |
|
goto badopt; |
252 |
|
} |
253 |
|
} |
254 |
< |
if (nproc > 1) { |
255 |
< |
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 |
< |
} |
254 |
> |
if (nproc > 1 && persist) |
255 |
> |
error(USER, "multiprocessing incompatible with persist file"); |
256 |
|
/* initialize object types */ |
257 |
|
initotypes(); |
258 |
|
/* initialize urand */ |
310 |
|
#endif |
311 |
|
if (outform != 'a') |
312 |
|
SET_FILE_BINARY(stdout); |
313 |
+ |
rval = setrtoutput(); |
314 |
|
readoct(octname = octnm, loadflags, &thescene, NULL); |
315 |
|
nsceneobjs = nobjects; |
316 |
|
|
318 |
|
printargs(i, argv, stdout); |
319 |
|
printf("SOFTWARE= %s\n", VersionID); |
320 |
|
fputnow(stdout); |
321 |
+ |
if (rval > 0) /* saved from setrtoutput() call */ |
322 |
+ |
printf("NCOMP=%d\n", rval); |
323 |
+ |
if ((outform == 'f') | (outform == 'd')) |
324 |
+ |
fputendian(stdout); |
325 |
|
fputformat(formstr(outform), stdout); |
326 |
|
putchar('\n'); |
327 |
|
} |
329 |
– |
|
330 |
– |
ray_init_pmap(); /* PMAP: set up & load photon maps */ |
331 |
– |
|
332 |
– |
marksources(); /* find and mark sources */ |
328 |
|
|
329 |
< |
setambient(); /* initialize ambient calculation */ |
330 |
< |
|
329 |
> |
if (!castonly) { /* any actual ray traversal to do? */ |
330 |
> |
|
331 |
> |
ray_init_pmap(); /* PMAP: set up & load photon maps */ |
332 |
> |
|
333 |
> |
marksources(); /* find and mark sources */ |
334 |
> |
|
335 |
> |
setambient(); /* initialize ambient calculation */ |
336 |
> |
} else |
337 |
> |
distantsources(); /* else mark only distant sources */ |
338 |
> |
|
339 |
> |
fflush(stdout); /* in case we're duplicating header */ |
340 |
> |
|
341 |
|
#ifdef PERSIST |
342 |
|
if (persist) { |
338 |
– |
fflush(stdout); |
343 |
|
/* reconnect stdout */ |
344 |
|
dup2(duped1, fileno(stdout)); |
345 |
|
close(duped1); |
485 |
|
case 't': case 'T': printf(" trace"); break; |
486 |
|
case 'o': printf(" origin"); break; |
487 |
|
case 'd': printf(" direction"); break; |
488 |
+ |
case 'r': printf(" reflect_contrib"); break; |
489 |
+ |
case 'R': printf(" reflect_length"); break; |
490 |
+ |
case 'x': printf(" unreflect_contrib"); break; |
491 |
+ |
case 'X': printf(" unreflect_length"); break; |
492 |
|
case 'v': printf(" value"); break; |
493 |
|
case 'V': printf(" contribution"); break; |
494 |
|
case 'l': printf(" length"); break; |
501 |
|
case 'W': printf(" coefficient"); break; |
502 |
|
case 'm': printf(" modifier"); break; |
503 |
|
case 'M': printf(" material"); break; |
504 |
< |
case '-': printf(" stroke"); break; |
504 |
> |
case '~': printf(" tilde"); break; |
505 |
|
} |
506 |
|
putchar('\n'); |
507 |
|
printf(erract[WARNING].pf != NULL ? |