| 42 |
|
int outform = 'a'; /* output format */ |
| 43 |
|
char *outvals = "v"; /* output specification */ |
| 44 |
|
|
| 45 |
+ |
char *tralist[128]; /* list of modifers to trace (or no) */ |
| 46 |
+ |
int traincl = -1; /* include == 1, exclude == 0 */ |
| 47 |
+ |
#define MAXTSET 511 /* maximum number in trace set */ |
| 48 |
+ |
OBJECT traset[MAXTSET+1]={0}; /* trace include/exclude set */ |
| 49 |
+ |
|
| 50 |
|
int hresolu = 0; /* horizontal (scan) size */ |
| 51 |
|
int vresolu = 0; /* vertical resolution */ |
| 52 |
|
|
| 55 |
|
double shadcert = .5; /* shadow certainty */ |
| 56 |
|
int directrelay = 1; /* number of source relays */ |
| 57 |
|
int vspretest = 512; /* virtual source pretest density */ |
| 58 |
< |
int directinvis = 0; /* sources invisible? */ |
| 58 |
> |
int directvis = 1; /* sources visible? */ |
| 59 |
|
double srcsizerat = .25; /* maximum ratio source size/dist. */ |
| 60 |
|
|
| 61 |
|
double specthresh = .15; /* specular sampling threshold */ |
| 80 |
|
static int oputo(), oputd(), oputv(), oputl(), oputL(), |
| 81 |
|
oputp(), oputn(), oputN(), oputs(), oputw(), oputm(); |
| 82 |
|
|
| 83 |
< |
static int (*ray_out[10])(), (*every_out[10])(); |
| 84 |
< |
static int castonly; |
| 83 |
> |
static int ourtrace(), tabin(); |
| 84 |
> |
static int (*ray_out[16])(), (*every_out[16])(); |
| 85 |
> |
static int castonly = 0; |
| 86 |
|
|
| 87 |
|
static int puta(), putf(), putd(); |
| 88 |
|
|
| 92 |
|
quit(code) /* quit program */ |
| 93 |
|
int code; |
| 94 |
|
{ |
| 95 |
+ |
#ifndef NIX |
| 96 |
+ |
headclean(); /* delete header file */ |
| 97 |
+ |
pfclean(); /* clean up persist files */ |
| 98 |
+ |
#endif |
| 99 |
|
exit(code); |
| 100 |
|
} |
| 101 |
|
|
| 133 |
|
setmode(fileno(fp), O_BINARY); |
| 134 |
|
#endif |
| 135 |
|
/* set up output */ |
| 136 |
< |
setoutput(outvals); |
| 136 |
> |
if (imm_irrad) |
| 137 |
> |
outvals = "v"; |
| 138 |
> |
else |
| 139 |
> |
setoutput(outvals); |
| 140 |
|
switch (outform) { |
| 141 |
|
case 'a': putreal = puta; break; |
| 142 |
|
case 'f': putreal = putf; break; |
| 148 |
|
default: |
| 149 |
|
error(CONSISTENCY, "botched output format"); |
| 150 |
|
} |
| 151 |
< |
if (hresolu > 0 && vresolu > 0) |
| 152 |
< |
fprtresolu(hresolu, vresolu, stdout); |
| 151 |
> |
if (hresolu > 0) { |
| 152 |
> |
if (vresolu > 0) |
| 153 |
> |
fprtresolu(hresolu, vresolu, stdout); |
| 154 |
> |
fflush(stdout); |
| 155 |
> |
} |
| 156 |
|
/* process file */ |
| 157 |
|
while (getvec(orig, inform, fp) == 0 && |
| 158 |
|
getvec(direc, inform, fp) == 0) { |
| 177 |
|
if (--vcount == 0) /* check for end */ |
| 178 |
|
break; |
| 179 |
|
} |
| 180 |
+ |
fflush(stdout); |
| 181 |
|
if (vcount > 0) |
| 182 |
|
error(USER, "read error"); |
| 183 |
< |
fclose(fp); |
| 183 |
> |
if (fname != NULL) |
| 184 |
> |
fclose(fp); |
| 185 |
|
} |
| 186 |
|
|
| 187 |
|
|
| 188 |
|
setoutput(vs) /* set up output tables */ |
| 189 |
|
register char *vs; |
| 190 |
|
{ |
| 191 |
< |
extern int ourtrace(), (*trace)(); |
| 191 |
> |
extern int (*trace)(); |
| 192 |
|
register int (**table)() = ray_out; |
| 193 |
|
|
| 194 |
|
castonly = 1; |
| 324 |
|
} |
| 325 |
|
|
| 326 |
|
|
| 327 |
+ |
tranotify(obj) /* record new modifier */ |
| 328 |
+ |
OBJECT obj; |
| 329 |
+ |
{ |
| 330 |
+ |
static int hitlimit = 0; |
| 331 |
+ |
register OBJREC *o = objptr(obj); |
| 332 |
+ |
register char **tralp; |
| 333 |
+ |
|
| 334 |
+ |
if (hitlimit || !ismodifier(o->otype)) |
| 335 |
+ |
return; |
| 336 |
+ |
for (tralp = tralist; *tralp != NULL; tralp++) |
| 337 |
+ |
if (!strcmp(o->oname, *tralp)) { |
| 338 |
+ |
if (traset[0] >= MAXTSET) { |
| 339 |
+ |
error(WARNING, "too many modifiers in trace list"); |
| 340 |
+ |
hitlimit++; |
| 341 |
+ |
return; /* should this be fatal? */ |
| 342 |
+ |
} |
| 343 |
+ |
insertelem(traset, obj); |
| 344 |
+ |
return; |
| 345 |
+ |
} |
| 346 |
+ |
} |
| 347 |
+ |
|
| 348 |
+ |
|
| 349 |
|
static |
| 350 |
|
ourtrace(r) /* print ray values */ |
| 351 |
|
RAY *r; |
| 353 |
|
register int (**tp)(); |
| 354 |
|
|
| 355 |
|
if (every_out[0] == NULL) |
| 356 |
+ |
return; |
| 357 |
+ |
if (traincl == 1 && r->ro == NULL) |
| 358 |
+ |
return; |
| 359 |
+ |
if (traincl != -1 && traincl != inset(traset, r->ro->omod)) |
| 360 |
|
return; |
| 361 |
|
tabin(r); |
| 362 |
|
for (tp = every_out; *tp != NULL; tp++) |