1 |
< |
/* Copyright (c) 1992 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1994 Regents of the University of California */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
53 |
|
double dstrsrc = 0.0; /* square source distribution */ |
54 |
|
double shadthresh = .05; /* shadow threshold */ |
55 |
|
double shadcert = .5; /* shadow certainty */ |
56 |
< |
int directrelay = 1; /* number of source relays */ |
56 |
> |
int directrelay = 2; /* number of source relays */ |
57 |
|
int vspretest = 512; /* virtual source pretest density */ |
58 |
|
int directvis = 1; /* sources visible? */ |
59 |
< |
double srcsizerat = .25; /* maximum ratio source size/dist. */ |
59 |
> |
double srcsizerat = .2; /* maximum ratio source size/dist. */ |
60 |
|
|
61 |
|
double specthresh = .15; /* specular sampling threshold */ |
62 |
|
double specjitter = 1.; /* specular sampling jitter */ |
63 |
|
|
64 |
+ |
int backvis = 1; /* back face visibility */ |
65 |
+ |
|
66 |
|
int maxdepth = 6; /* maximum recursion depth */ |
67 |
|
double minweight = 4e-3; /* minimum ray weight */ |
68 |
|
|
69 |
|
COLOR ambval = BLKCOLOR; /* ambient value */ |
70 |
|
double ambacc = 0.2; /* ambient accuracy */ |
71 |
< |
int ambres = 32; /* ambient resolution */ |
72 |
< |
int ambdiv = 128; /* ambient divisions */ |
71 |
> |
int ambres = 128; /* ambient resolution */ |
72 |
> |
int ambdiv = 512; /* ambient divisions */ |
73 |
|
int ambssamp = 0; /* ambient super-samples */ |
74 |
|
int ambounce = 0; /* ambient bounces */ |
75 |
|
char *amblist[128]; /* ambient include/exclude list */ |
135 |
|
setmode(fileno(fp), O_BINARY); |
136 |
|
#endif |
137 |
|
/* set up output */ |
138 |
< |
if (imm_irrad) |
137 |
< |
outvals = "v"; |
138 |
< |
else |
139 |
< |
setoutput(outvals); |
138 |
> |
setoutput(outvals); |
139 |
|
switch (outform) { |
140 |
|
case 'a': putreal = puta; break; |
141 |
|
case 'f': putreal = putf; break; |
165 |
|
if (imm_irrad) |
166 |
|
irrad(orig, direc); |
167 |
|
else |
168 |
< |
traceray(orig, direc); |
168 |
> |
rad(orig, direc); |
169 |
|
/* flush if time */ |
170 |
|
if (--nextflush == 0) { |
171 |
|
fflush(stdout); |
240 |
|
} |
241 |
|
|
242 |
|
|
243 |
< |
traceray(org, dir) /* compute and print ray value(s) */ |
243 |
> |
rad(org, dir) /* compute and print ray value(s) */ |
244 |
|
FVECT org, dir; |
245 |
|
{ |
247 |
– |
register int (**tp)(); |
248 |
– |
|
246 |
|
VCOPY(thisray.rorg, org); |
247 |
|
VCOPY(thisray.rdir, dir); |
248 |
+ |
thisray.rmax = 0.0; |
249 |
|
rayorigin(&thisray, NULL, PRIMARY, 1.0); |
250 |
|
if (castonly) |
251 |
|
localhit(&thisray, &thescene) || sourcehit(&thisray); |
252 |
|
else |
253 |
|
rayvalue(&thisray); |
254 |
< |
|
257 |
< |
if (ray_out[0] == NULL) |
258 |
< |
return; |
259 |
< |
for (tp = ray_out; *tp != NULL; tp++) |
260 |
< |
(**tp)(&thisray); |
261 |
< |
if (outform == 'a') |
262 |
< |
putchar('\n'); |
254 |
> |
printvals(&thisray); |
255 |
|
} |
256 |
|
|
257 |
|
|
266 |
|
} |
267 |
|
rayorigin(&thisray, NULL, PRIMARY, 1.0); |
268 |
|
/* pretend we hit surface */ |
269 |
< |
thisray.rot = 1.0; |
269 |
> |
thisray.rot = 1.0-1e-4; |
270 |
|
thisray.rod = 1.0; |
271 |
|
VCOPY(thisray.ron, dir); |
272 |
|
for (i = 0; i < 3; i++) /* fudge factor */ |
273 |
|
thisray.rop[i] = org[i] + 1e-4*dir[i]; |
274 |
|
/* compute and print */ |
275 |
|
(*ofun[Lamb.otype].funp)(&Lamb, &thisray); |
276 |
< |
oputv(&thisray); |
276 |
> |
printvals(&thisray); |
277 |
> |
} |
278 |
> |
|
279 |
> |
|
280 |
> |
printvals(r) /* print requested ray values */ |
281 |
> |
RAY *r; |
282 |
> |
{ |
283 |
> |
register int (**tp)(); |
284 |
> |
|
285 |
> |
if (ray_out[0] == NULL) |
286 |
> |
return; |
287 |
> |
for (tp = ray_out; *tp != NULL; tp++) |
288 |
> |
(**tp)(r); |
289 |
|
if (outform == 'a') |
290 |
|
putchar('\n'); |
291 |
|
} |
358 |
|
|
359 |
|
if (every_out[0] == NULL) |
360 |
|
return; |
361 |
< |
if (traincl == 1 && r->ro == NULL) |
362 |
< |
return; |
363 |
< |
if (traincl != -1 && traincl != inset(traset, r->ro->omod)) |
361 |
> |
if (r->ro == NULL) { |
362 |
> |
if (traincl == 1) |
363 |
> |
return; |
364 |
> |
} else if (traincl != -1 && traincl != inset(traset, r->ro->omod)) |
365 |
|
return; |
366 |
|
tabin(r); |
367 |
|
for (tp = every_out; *tp != NULL; tp++) |