| 50 |
|
double shadcert = .5; /* shadow certainty */ |
| 51 |
|
int directrelay = 1; /* number of source relays */ |
| 52 |
|
int vspretest = 512; /* virtual source pretest density */ |
| 53 |
< |
int directinvis = 0; /* sources invisible? */ |
| 53 |
> |
int directvis = 1; /* sources visible? */ |
| 54 |
|
double srcsizerat = .25; /* maximum ratio source size/dist. */ |
| 55 |
|
|
| 56 |
|
double specthresh = .15; /* specular sampling threshold */ |
| 73 |
|
static RAY thisray; /* for our convenience */ |
| 74 |
|
|
| 75 |
|
static int oputo(), oputd(), oputv(), oputl(), oputL(), |
| 76 |
< |
oputp(), oputn(), oputs(), oputw(), oputm(); |
| 76 |
> |
oputp(), oputn(), oputN(), oputs(), oputw(), oputm(); |
| 77 |
|
|
| 78 |
|
static int (*ray_out[10])(), (*every_out[10])(); |
| 79 |
|
static int castonly; |
| 86 |
|
quit(code) /* quit program */ |
| 87 |
|
int code; |
| 88 |
|
{ |
| 89 |
+ |
#ifndef NIX |
| 90 |
+ |
headclean(); /* delete header file */ |
| 91 |
+ |
pfclean(); /* clean up persist files */ |
| 92 |
+ |
#endif |
| 93 |
|
exit(code); |
| 94 |
|
} |
| 95 |
|
|
| 122 |
|
sprintf(errmsg, "cannot open input file \"%s\"", fname); |
| 123 |
|
error(SYSTEM, errmsg); |
| 124 |
|
} |
| 125 |
+ |
#ifdef MSDOS |
| 126 |
+ |
if (inform != 'a') |
| 127 |
+ |
setmode(fileno(fp), O_BINARY); |
| 128 |
+ |
#endif |
| 129 |
|
/* set up output */ |
| 130 |
|
setoutput(outvals); |
| 131 |
|
switch (outform) { |
| 139 |
|
default: |
| 140 |
|
error(CONSISTENCY, "botched output format"); |
| 141 |
|
} |
| 134 |
– |
fputformat(formstr(outform), stdout); |
| 135 |
– |
putchar('\n'); |
| 142 |
|
if (hresolu > 0 && vresolu > 0) |
| 143 |
|
fprtresolu(hresolu, vresolu, stdout); |
| 144 |
|
/* process file */ |
| 206 |
|
case 'p': /* point */ |
| 207 |
|
*table++ = oputp; |
| 208 |
|
break; |
| 209 |
< |
case 'n': /* normal */ |
| 209 |
> |
case 'n': /* perturbed normal */ |
| 210 |
|
*table++ = oputn; |
| 211 |
+ |
castonly = 0; |
| 212 |
|
break; |
| 213 |
+ |
case 'N': /* unperturbed normal */ |
| 214 |
+ |
*table++ = oputN; |
| 215 |
+ |
break; |
| 216 |
|
case 's': /* surface */ |
| 217 |
|
*table++ = oputs; |
| 218 |
|
break; |
| 408 |
|
|
| 409 |
|
|
| 410 |
|
static |
| 411 |
< |
oputn(r) /* print normal */ |
| 411 |
> |
oputN(r) /* print unperturbed normal */ |
| 412 |
|
register RAY *r; |
| 413 |
|
{ |
| 414 |
|
if (r->rot < FHUGE) { |
| 420 |
|
(*putreal)(0.0); |
| 421 |
|
(*putreal)(0.0); |
| 422 |
|
} |
| 423 |
+ |
} |
| 424 |
+ |
|
| 425 |
+ |
|
| 426 |
+ |
static |
| 427 |
+ |
oputn(r) /* print perturbed normal */ |
| 428 |
+ |
RAY *r; |
| 429 |
+ |
{ |
| 430 |
+ |
FVECT pnorm; |
| 431 |
+ |
|
| 432 |
+ |
if (r->rot >= FHUGE) { |
| 433 |
+ |
(*putreal)(0.0); |
| 434 |
+ |
(*putreal)(0.0); |
| 435 |
+ |
(*putreal)(0.0); |
| 436 |
+ |
return; |
| 437 |
+ |
} |
| 438 |
+ |
raynormal(pnorm, r); |
| 439 |
+ |
(*putreal)(pnorm[0]); |
| 440 |
+ |
(*putreal)(pnorm[1]); |
| 441 |
+ |
(*putreal)(pnorm[2]); |
| 442 |
|
} |
| 443 |
|
|
| 444 |
|
|