96 |
|
static putf_t puta, putd, putf; |
97 |
|
|
98 |
|
typedef void oputf_t(RAY *r); |
99 |
< |
static oputf_t oputo, oputd, oputv, oputl, oputL, oputc, |
100 |
< |
oputp, oputn, oputN, oputs, oputw, oputm, oputM; |
99 |
> |
static oputf_t oputo, oputd, oputv, oputl, oputL, oputc, oputp, |
100 |
> |
oputn, oputN, oputs, oputw, oputW, oputm, oputM; |
101 |
|
|
102 |
|
static void setoutput(char *vs); |
103 |
|
static void tranotify(OBJECT obj); |
220 |
|
|
221 |
|
|
222 |
|
static void |
223 |
+ |
trace_sources(void) /* trace rays to light sources, also */ |
224 |
+ |
{ |
225 |
+ |
int sn; |
226 |
+ |
|
227 |
+ |
for (sn = 0; sn < nsources; sn++) |
228 |
+ |
source[sn].sflags |= SFOLLOW; |
229 |
+ |
} |
230 |
+ |
|
231 |
+ |
|
232 |
+ |
static void |
233 |
|
setoutput( /* set up output tables */ |
234 |
|
register char *vs |
235 |
|
) |
239 |
|
castonly = 1; |
240 |
|
while (*vs) |
241 |
|
switch (*vs++) { |
242 |
+ |
case 'T': /* trace sources */ |
243 |
+ |
trace_sources(); |
244 |
+ |
/* fall through */ |
245 |
|
case 't': /* trace */ |
246 |
|
*table = NULL; |
247 |
|
table = every_out; |
284 |
|
case 'w': /* weight */ |
285 |
|
*table++ = oputw; |
286 |
|
break; |
287 |
+ |
case 'W': /* coefficient */ |
288 |
+ |
*table++ = oputW; |
289 |
+ |
if (ambounce > 0 && (ambacc > FTINY || ambssamp > 0)) |
290 |
+ |
error(WARNING, |
291 |
+ |
"-otW accuracy requires -aa 0 -as 0"); |
292 |
+ |
break; |
293 |
|
case 'm': /* modifier */ |
294 |
|
*table++ = oputm; |
295 |
|
break; |
306 |
|
{ |
307 |
|
thisray.rorg[0] = thisray.rorg[1] = thisray.rorg[2] = |
308 |
|
thisray.rdir[0] = thisray.rdir[1] = thisray.rdir[2] = 0.0; |
309 |
< |
rayorigin(&thisray, NULL, PRIMARY, 1.0); |
309 |
> |
thisray.rmax = 0.0; |
310 |
> |
rayorigin(&thisray, PRIMARY, NULL, NULL); |
311 |
|
printvals(&thisray); |
312 |
|
} |
313 |
|
|
322 |
|
VCOPY(thisray.rorg, org); |
323 |
|
VCOPY(thisray.rdir, dir); |
324 |
|
thisray.rmax = dmax; |
325 |
< |
rayorigin(&thisray, NULL, PRIMARY, 1.0); |
325 |
> |
rayorigin(&thisray, PRIMARY, NULL, NULL); |
326 |
|
if (castonly) { |
327 |
|
if (!localhit(&thisray, &thescene)) { |
328 |
|
if (thisray.ro == &Aftplane) { /* clipped */ |
349 |
|
thisray.rorg[i] = org[i] + dir[i]; |
350 |
|
thisray.rdir[i] = -dir[i]; |
351 |
|
} |
352 |
< |
rayorigin(&thisray, NULL, PRIMARY, 1.0); |
352 |
> |
thisray.rmax = 0.0; |
353 |
> |
rayorigin(&thisray, PRIMARY, NULL, NULL); |
354 |
|
/* pretend we hit surface */ |
355 |
|
thisray.rot = 1.0-1e-4; |
356 |
|
thisray.rod = 1.0; |
472 |
|
RAY *r |
473 |
|
) |
474 |
|
{ |
475 |
< |
register RAY *rp; |
475 |
> |
const RAY *rp; |
476 |
|
|
477 |
|
for (rp = r->parent; rp != NULL; rp = rp->parent) |
478 |
|
putchar('\t'); |
622 |
|
) |
623 |
|
{ |
624 |
|
(*putreal)(r->rweight); |
625 |
+ |
} |
626 |
+ |
|
627 |
+ |
|
628 |
+ |
static void |
629 |
+ |
oputW( /* print contribution */ |
630 |
+ |
RAY *r |
631 |
+ |
) |
632 |
+ |
{ |
633 |
+ |
COLOR contr; |
634 |
+ |
COLR cout; |
635 |
+ |
|
636 |
+ |
raycontrib(contr, r, PRIMARY); |
637 |
+ |
if (outform == 'c') { |
638 |
+ |
setcolr(cout, colval(contr,RED), |
639 |
+ |
colval(contr,GRN), |
640 |
+ |
colval(contr,BLU)); |
641 |
+ |
fwrite((char *)cout, sizeof(cout), 1, stdout); |
642 |
+ |
return; |
643 |
+ |
} |
644 |
+ |
(*putreal)(colval(contr,RED)); |
645 |
+ |
(*putreal)(colval(contr,GRN)); |
646 |
+ |
(*putreal)(colval(contr,BLU)); |
647 |
|
} |
648 |
|
|
649 |
|
|