| 1 |
< |
/* Copyright (c) 1993 Regents of the University of California */ |
| 1 |
> |
/* Copyright (c) 1996 Regents of the University of California */ |
| 2 |
|
|
| 3 |
|
#ifndef lint |
| 4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
| 27 |
|
|
| 28 |
|
#include "octree.h" |
| 29 |
|
|
| 30 |
+ |
#include <sys/types.h> |
| 31 |
+ |
|
| 32 |
|
#include <signal.h> |
| 33 |
|
|
| 34 |
|
#include "view.h" |
| 47 |
|
|
| 48 |
|
char *octname; /* octree name */ |
| 49 |
|
|
| 50 |
< |
char *libpath; /* library directory list */ |
| 50 |
> |
char *getlibpath(); /* library directory list */ |
| 51 |
|
|
| 52 |
|
char *sigerr[NSIG]; /* signal error messages */ |
| 53 |
|
|
| 54 |
+ |
char *shm_boundary = NULL; /* boundary of shared memory */ |
| 55 |
+ |
|
| 56 |
|
extern char VersionID[]; /* version ID string */ |
| 57 |
|
|
| 58 |
|
extern int stderr_v(); /* standard error output */ |
| 63 |
|
int (*trace)() = NULL; /* trace call */ |
| 64 |
|
int do_irrad = 0; /* compute irradiance? */ |
| 65 |
|
|
| 66 |
< |
extern long time(); |
| 63 |
< |
long tstart; /* start time */ |
| 66 |
> |
char *errfile = NULL; /* error output file */ |
| 67 |
|
|
| 68 |
+ |
extern time_t time(); |
| 69 |
+ |
time_t tstart; /* start time */ |
| 70 |
+ |
|
| 71 |
|
extern int ambnotify(); /* new object notify functions */ |
| 72 |
|
#if RTRACE |
| 73 |
|
extern int tranotify(); |
| 119 |
|
extern double specthresh; /* specular sampling threshold */ |
| 120 |
|
extern double specjitter; /* specular sampling jitter */ |
| 121 |
|
|
| 122 |
+ |
extern COLOR cextinction; /* global extinction coefficient */ |
| 123 |
+ |
extern COLOR salbedo; /* global scattering albedo */ |
| 124 |
+ |
extern double seccg; /* global scattering eccentricity */ |
| 125 |
+ |
extern double ssampdist; /* scatter sampling distance */ |
| 126 |
+ |
|
| 127 |
+ |
extern int backvis; /* back face visibility */ |
| 128 |
+ |
|
| 129 |
|
extern int maxdepth; /* maximum recursion depth */ |
| 130 |
|
extern double minweight; /* minimum ray weight */ |
| 131 |
|
|
| 132 |
|
extern COLOR ambval; /* ambient value */ |
| 133 |
+ |
extern int ambvwt; /* initial weight for ambient value */ |
| 134 |
|
extern double ambacc; /* ambient accuracy */ |
| 135 |
|
extern int ambres; /* ambient resolution */ |
| 136 |
|
extern int ambdiv; /* ambient divisions */ |
| 158 |
|
char *recover = NULL; |
| 159 |
|
char *outfile = NULL; |
| 160 |
|
char *zfile = NULL; |
| 147 |
– |
char *errfile = NULL; |
| 161 |
|
char *ambfile = NULL; |
| 162 |
|
int loadflags = ~IO_FILES; |
| 163 |
|
int seqstart = 0; |
| 168 |
|
int rval; |
| 169 |
|
int i; |
| 170 |
|
/* record start time */ |
| 171 |
< |
tstart = time((long *)0); |
| 171 |
> |
tstart = time((time_t *)NULL); |
| 172 |
|
/* global program name */ |
| 173 |
|
progname = argv[0] = fixargv0(argv[0]); |
| 161 |
– |
/* get library path */ |
| 162 |
– |
if ((libpath = getenv(ULIBVAR)) == NULL) |
| 163 |
– |
libpath = DEFPATH; |
| 174 |
|
/* initialize object types */ |
| 175 |
|
initotypes(); |
| 176 |
|
/* initialize urand */ |
| 227 |
|
} |
| 228 |
|
break; |
| 229 |
|
#endif |
| 230 |
+ |
case 'b': /* back face vis. */ |
| 231 |
+ |
if (argv[i][2] == 'v') { |
| 232 |
+ |
bool(3,backvis); |
| 233 |
+ |
break; |
| 234 |
+ |
} |
| 235 |
+ |
#if RVIEW |
| 236 |
+ |
bool(2,greyscale); |
| 237 |
+ |
break; |
| 238 |
+ |
#else |
| 239 |
+ |
goto badopt; |
| 240 |
+ |
#endif |
| 241 |
|
case 'd': /* direct */ |
| 242 |
|
switch (argv[i][2]) { |
| 243 |
|
case 't': /* threshold */ |
| 391 |
|
atof(argv[i+3])); |
| 392 |
|
i += 3; |
| 393 |
|
break; |
| 394 |
+ |
case 'w': /* weight */ |
| 395 |
+ |
check(3,"i"); |
| 396 |
+ |
ambvwt = atoi(argv[++i]); |
| 397 |
+ |
break; |
| 398 |
|
case 'a': /* accuracy */ |
| 399 |
|
check(3,"f"); |
| 400 |
|
ambacc = atof(argv[++i]); |
| 424 |
|
} |
| 425 |
|
if (argv[i][2] == 'I') { /* file */ |
| 426 |
|
rval = wordfile(amblp, |
| 427 |
< |
getpath(argv[++i],libpath,R_OK)); |
| 427 |
> |
getpath(argv[++i],getlibpath(),R_OK)); |
| 428 |
|
if (rval < 0) { |
| 429 |
|
sprintf(errmsg, |
| 430 |
|
"cannot open ambient include file \"%s\"", |
| 446 |
|
} |
| 447 |
|
if (argv[i][2] == 'E') { /* file */ |
| 448 |
|
rval = wordfile(amblp, |
| 449 |
< |
getpath(argv[++i],libpath,R_OK)); |
| 449 |
> |
getpath(argv[++i],getlibpath(),R_OK)); |
| 450 |
|
if (rval < 0) { |
| 451 |
|
sprintf(errmsg, |
| 452 |
|
"cannot open ambient exclude file \"%s\"", |
| 467 |
|
goto badopt; |
| 468 |
|
} |
| 469 |
|
break; |
| 470 |
+ |
case 'm': /* medium */ |
| 471 |
+ |
switch (argv[i][2]) { |
| 472 |
+ |
case 'e': /* extinction */ |
| 473 |
+ |
check(3,"fff"); |
| 474 |
+ |
setcolor(cextinction, atof(argv[i+1]), |
| 475 |
+ |
atof(argv[i+2]), |
| 476 |
+ |
atof(argv[i+3])); |
| 477 |
+ |
i += 3; |
| 478 |
+ |
break; |
| 479 |
+ |
case 'a': /* albedo */ |
| 480 |
+ |
check(3,"fff"); |
| 481 |
+ |
setcolor(salbedo, atof(argv[i+1]), |
| 482 |
+ |
atof(argv[i+2]), |
| 483 |
+ |
atof(argv[i+3])); |
| 484 |
+ |
i += 3; |
| 485 |
+ |
break; |
| 486 |
+ |
case 'g': /* eccentr. */ |
| 487 |
+ |
check(3,"f"); |
| 488 |
+ |
seccg = atof(argv[++i]); |
| 489 |
+ |
break; |
| 490 |
+ |
case 's': /* sampling */ |
| 491 |
+ |
check(3,"f"); |
| 492 |
+ |
ssampdist = atof(argv[++i]); |
| 493 |
+ |
break; |
| 494 |
+ |
default: |
| 495 |
+ |
goto badopt; |
| 496 |
+ |
} |
| 497 |
+ |
break; |
| 498 |
|
#if RTRACE |
| 499 |
|
case 'I': /* immed. irradiance */ |
| 500 |
|
bool(2,imm_irrad); |
| 544 |
|
} |
| 545 |
|
if (argv[i][2] == 'I') { /* file */ |
| 546 |
|
rval = wordfile(tralp, |
| 547 |
< |
getpath(argv[++i],libpath,R_OK)); |
| 547 |
> |
getpath(argv[++i],getlibpath(),R_OK)); |
| 548 |
|
if (rval < 0) { |
| 549 |
|
sprintf(errmsg, |
| 550 |
|
"cannot open trace include file \"%s\"", |
| 566 |
|
} |
| 567 |
|
if (argv[i][2] == 'E') { /* file */ |
| 568 |
|
rval = wordfile(tralp, |
| 569 |
< |
getpath(argv[++i],libpath,R_OK)); |
| 569 |
> |
getpath(argv[++i],getlibpath(),R_OK)); |
| 570 |
|
if (rval < 0) { |
| 571 |
|
sprintf(errmsg, |
| 572 |
|
"cannot open trace exclude file \"%s\"", |
| 585 |
|
break; |
| 586 |
|
#endif |
| 587 |
|
#if RVIEW |
| 535 |
– |
case 'b': /* black and white */ |
| 536 |
– |
bool(2,greyscale); |
| 537 |
– |
break; |
| 588 |
|
case 'o': /* output device */ |
| 589 |
|
check(2,"s"); |
| 590 |
|
devname = argv[++i]; |
| 708 |
|
} |
| 709 |
|
if (persist == PARALLEL) { /* multiprocessing */ |
| 710 |
|
preload_objs(); /* preload scene */ |
| 711 |
+ |
strcpy(shm_boundary=bmalloc(16), "SHM_BOUNDARY"); |
| 712 |
|
while ((rval=fork()) == 0) { /* keep on forkin' */ |
| 713 |
|
pflock(1); |
| 714 |
|
pfhold(); |
| 715 |
< |
tstart = time(0); |
| 715 |
> |
tstart = time((time_t *)NULL); |
| 716 |
|
} |
| 717 |
|
if (rval < 0) |
| 718 |
|
error(SYSTEM, "cannot fork child for persist function"); |
| 751 |
|
if (outfile != NULL) |
| 752 |
|
close(duped1); /* release output handle */ |
| 753 |
|
pfhold(); |
| 754 |
< |
tstart = time(0); /* reinitialize counters */ |
| 754 |
> |
tstart = time((time_t *)NULL); /* reinitialize */ |
| 755 |
|
raynum = nrays = 0; |
| 756 |
|
goto runagain; |
| 757 |
|
} |
| 862 |
|
ourview.type==VT_PAR ? "parallel" : |
| 863 |
|
ourview.type==VT_HEM ? "hemispherical" : |
| 864 |
|
ourview.type==VT_ANG ? "angular" : |
| 865 |
+ |
ourview.type==VT_CYL ? "cylindrical" : |
| 866 |
|
"unknown"); |
| 867 |
|
printf("-vp %f %f %f\t# view point\n", |
| 868 |
|
ourview.vp[0], ourview.vp[1], ourview.vp[2]); |
| 872 |
|
ourview.vup[0], ourview.vup[1], ourview.vup[2]); |
| 873 |
|
printf("-vh %f\t\t\t# view horizontal size\n", ourview.horiz); |
| 874 |
|
printf("-vv %f\t\t\t# view vertical size\n", ourview.vert); |
| 875 |
+ |
printf("-vo %f\t\t\t# view fore clipping plane\n", ourview.vfore); |
| 876 |
+ |
printf("-va %f\t\t\t# view aft clipping plane\n", ourview.vaft); |
| 877 |
|
printf("-vs %f\t\t\t# view shift\n", ourview.hoff); |
| 878 |
|
printf("-vl %f\t\t\t# view lift\n", ourview.voff); |
| 879 |
|
#endif |
| 892 |
|
printf("-ps %-9d\t\t\t# pixel sample\n", psample); |
| 893 |
|
printf("-pt %f\t\t\t# pixel threshold\n", maxdiff); |
| 894 |
|
#endif |
| 895 |
+ |
printf(backvis ? "-bv+\t\t\t\t# back face visibility on\n" : |
| 896 |
+ |
"-bv-\t\t\t\t# back face visibility off\n"); |
| 897 |
|
printf("-dt %f\t\t\t# direct threshold\n", shadthresh); |
| 898 |
|
printf("-dc %f\t\t\t# direct certainty\n", shadcert); |
| 899 |
|
printf("-dj %f\t\t\t# direct jitter\n", dstrsrc); |
| 906 |
|
printf("-st %f\t\t\t# specular threshold\n", specthresh); |
| 907 |
|
printf("-av %f %f %f\t# ambient value\n", colval(ambval,RED), |
| 908 |
|
colval(ambval,GRN), colval(ambval, BLU)); |
| 909 |
+ |
printf("-aw %-9d\t\t\t# ambient value weight\n", ambvwt); |
| 910 |
|
printf("-ab %-9d\t\t\t# ambient bounces\n", ambounce); |
| 911 |
|
printf("-aa %f\t\t\t# ambient accuracy\n", ambacc); |
| 912 |
|
printf("-ar %-9d\t\t\t# ambient resolution\n", ambres); |
| 913 |
|
printf("-ad %-9d\t\t\t# ambient divisions\n", ambdiv); |
| 914 |
|
printf("-as %-9d\t\t\t# ambient super-samples\n", ambssamp); |
| 915 |
+ |
printf("-me %.2e %.2e %.2e\t# extinction coefficient\n", |
| 916 |
+ |
colval(cextinction,RED), |
| 917 |
+ |
colval(cextinction,GRN), |
| 918 |
+ |
colval(cextinction,BLU)); |
| 919 |
+ |
printf("-ma %f %f %f\t# scattering albedo\n", colval(salbedo,RED), |
| 920 |
+ |
colval(salbedo,GRN), colval(salbedo,BLU)); |
| 921 |
+ |
printf("-mg %f\t\t\t# scattering eccentricity\n", seccg); |
| 922 |
+ |
printf("-ms %f\t\t\t# mist sampling distance\n", ssampdist); |
| 923 |
|
printf("-lr %-9d\t\t\t# limit reflection\n", maxdepth); |
| 924 |
|
printf("-lw %f\t\t\t# limit weight\n", minweight); |
| 925 |
|
#if RPICT |