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"; |
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 |
|
|
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) |
132 |
< |
outvals = "v"; |
133 |
< |
else |
134 |
< |
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 |
|
{ |
242 |
– |
register int (**tp)(); |
243 |
– |
|
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 |
< |
|
252 |
< |
if (ray_out[0] == NULL) |
253 |
< |
return; |
254 |
< |
for (tp = ray_out; *tp != NULL; tp++) |
255 |
< |
(**tp)(&thisray); |
256 |
< |
if (outform == 'a') |
257 |
< |
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 |
|
} |
328 |
|
} |
329 |
|
|
330 |
|
|
331 |
+ |
tranotify(obj) /* record new modifier */ |
332 |
+ |
OBJECT obj; |
333 |
+ |
{ |
334 |
+ |
static int hitlimit = 0; |
335 |
+ |
register OBJREC *o = objptr(obj); |
336 |
+ |
register char **tralp; |
337 |
+ |
|
338 |
+ |
if (hitlimit || !ismodifier(o->otype)) |
339 |
+ |
return; |
340 |
+ |
for (tralp = tralist; *tralp != NULL; tralp++) |
341 |
+ |
if (!strcmp(o->oname, *tralp)) { |
342 |
+ |
if (traset[0] >= MAXTSET) { |
343 |
+ |
error(WARNING, "too many modifiers in trace list"); |
344 |
+ |
hitlimit++; |
345 |
+ |
return; /* should this be fatal? */ |
346 |
+ |
} |
347 |
+ |
insertelem(traset, obj); |
348 |
+ |
return; |
349 |
+ |
} |
350 |
+ |
} |
351 |
+ |
|
352 |
+ |
|
353 |
|
static |
354 |
|
ourtrace(r) /* print ray values */ |
355 |
|
RAY *r; |
357 |
|
register int (**tp)(); |
358 |
|
|
359 |
|
if (every_out[0] == NULL) |
360 |
+ |
return; |
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++) |