59 |
|
|
60 |
|
typedef void oputf_t(RAY *r); |
61 |
|
static oputf_t oputo, oputd, oputv, oputV, oputl, oputL, oputc, oputp, |
62 |
< |
oputn, oputN, oputs, oputw, oputW, oputm, oputM, oputtilde; |
62 |
> |
oputr, oputR, oputx, oputX, oputn, oputN, oputs, |
63 |
> |
oputw, oputW, oputm, oputM, oputtilde; |
64 |
|
|
65 |
|
static void setoutput(char *vs); |
66 |
|
extern void tranotify(OBJECT obj); |
73 |
|
static void tabin(RAY *r); |
74 |
|
static void ourtrace(RAY *r); |
75 |
|
|
76 |
< |
static oputf_t *ray_out[16], *every_out[16]; |
76 |
> |
static oputf_t *ray_out[32], *every_out[32]; |
77 |
|
static putf_t *putreal; |
78 |
|
|
79 |
|
|
162 |
|
|
163 |
|
d = normalize(direc); |
164 |
|
if (d == 0.0) { /* zero ==> flush */ |
165 |
< |
if (--nextflush <= 0 || !vcount) { |
166 |
< |
if (nproc > 1 && ray_fifo_flush() < 0) |
165 |
> |
if ((--nextflush <= 0) | !vcount) { |
166 |
> |
if (ray_pnprocs > 1 && ray_fifo_flush() < 0) |
167 |
|
error(USER, "child(ren) died"); |
168 |
|
bogusray(); |
169 |
|
fflush(stdout); |
175 |
|
rtcompute(orig, direc, lim_dist ? d : 0.0); |
176 |
|
/* flush if time */ |
177 |
|
if (!--nextflush) { |
178 |
< |
if (nproc > 1 && ray_fifo_flush() < 0) |
178 |
> |
if (ray_pnprocs > 1 && ray_fifo_flush() < 0) |
179 |
|
error(USER, "child(ren) died"); |
180 |
|
fflush(stdout); |
181 |
|
nextflush = hresolu; |
186 |
|
if (vcount && !--vcount) /* check for end */ |
187 |
|
break; |
188 |
|
} |
189 |
< |
if (nproc > 1) { /* clean up children */ |
189 |
> |
if (ray_pnprocs > 1) { /* clean up children */ |
190 |
|
if (ray_fifo_flush() < 0) |
191 |
|
error(USER, "unable to complete processing"); |
192 |
|
ray_pclose(0); |
237 |
|
case 'd': /* direction */ |
238 |
|
*table++ = oputd; |
239 |
|
break; |
240 |
+ |
case 'r': /* reflected contrib. */ |
241 |
+ |
*table++ = oputr; |
242 |
+ |
castonly = 0; |
243 |
+ |
break; |
244 |
+ |
case 'R': /* reflected distance */ |
245 |
+ |
*table++ = oputR; |
246 |
+ |
castonly = 0; |
247 |
+ |
break; |
248 |
+ |
case 'x': /* xmit contrib. */ |
249 |
+ |
*table++ = oputx; |
250 |
+ |
castonly = 0; |
251 |
+ |
break; |
252 |
+ |
case 'X': /* xmit distance */ |
253 |
+ |
*table++ = oputX; |
254 |
+ |
castonly = 0; |
255 |
+ |
break; |
256 |
|
case 'v': /* value */ |
257 |
|
*table++ = oputv; |
258 |
|
castonly = 0; |
259 |
|
break; |
260 |
|
case 'V': /* contribution */ |
261 |
|
*table++ = oputV; |
262 |
+ |
castonly = 0; |
263 |
|
if (ambounce > 0 && (ambacc > FTINY || ambssamp > 0)) |
264 |
|
error(WARNING, |
265 |
|
"-otV accuracy depends on -aa 0 -as 0"); |
292 |
|
break; |
293 |
|
case 'W': /* coefficient */ |
294 |
|
*table++ = oputW; |
295 |
+ |
castonly = 0; |
296 |
|
if (ambounce > 0 && (ambacc > FTINY || ambssamp > 0)) |
297 |
|
error(WARNING, |
298 |
|
"-otW accuracy depends on -aa 0 -as 0"); |
314 |
|
static void |
315 |
|
bogusray(void) /* print out empty record */ |
316 |
|
{ |
317 |
< |
thisray.rorg[0] = thisray.rorg[1] = thisray.rorg[2] = |
299 |
< |
thisray.rdir[0] = thisray.rdir[1] = thisray.rdir[2] = 0.0; |
300 |
< |
thisray.rmax = 0.0; |
317 |
> |
memset(&thisray, 0, sizeof(thisray)); |
318 |
|
rayorigin(&thisray, PRIMARY, NULL, NULL); |
319 |
|
printvals(&thisray); |
320 |
|
} |
341 |
|
) |
342 |
|
{ |
343 |
|
void (*old_revf)(RAY *) = r->revf; |
344 |
< |
|
345 |
< |
r->rot = 1e-5; /* pretend we hit surface */ |
344 |
> |
/* pretend we hit surface */ |
345 |
> |
r->rxt = r->rot = 1e-5; |
346 |
|
VSUM(r->rop, r->rorg, r->rdir, r->rot); |
347 |
|
r->ron[0] = -r->rdir[0]; |
348 |
|
r->ron[1] = -r->rdir[1]; |
526 |
|
|
527 |
|
|
528 |
|
static void |
529 |
+ |
oputr( /* print mirrored contribution */ |
530 |
+ |
RAY *r |
531 |
+ |
) |
532 |
+ |
{ |
533 |
+ |
RREAL cval[3]; |
534 |
+ |
|
535 |
+ |
cval[0] = colval(r->mcol,RED); |
536 |
+ |
cval[1] = colval(r->mcol,GRN); |
537 |
+ |
cval[2] = colval(r->mcol,BLU); |
538 |
+ |
(*putreal)(cval, 3); |
539 |
+ |
} |
540 |
+ |
|
541 |
+ |
|
542 |
+ |
|
543 |
+ |
static void |
544 |
+ |
oputR( /* print mirrored distance */ |
545 |
+ |
RAY *r |
546 |
+ |
) |
547 |
+ |
{ |
548 |
+ |
(*putreal)(&r->rmt, 1); |
549 |
+ |
} |
550 |
+ |
|
551 |
+ |
|
552 |
+ |
static void |
553 |
+ |
oputx( /* print unmirrored contribution */ |
554 |
+ |
RAY *r |
555 |
+ |
) |
556 |
+ |
{ |
557 |
+ |
RREAL cval[3]; |
558 |
+ |
|
559 |
+ |
cval[0] = colval(r->rcol,RED) - colval(r->mcol,RED); |
560 |
+ |
cval[1] = colval(r->rcol,GRN) - colval(r->mcol,GRN); |
561 |
+ |
cval[2] = colval(r->rcol,BLU) - colval(r->mcol,BLU); |
562 |
+ |
(*putreal)(cval, 3); |
563 |
+ |
} |
564 |
+ |
|
565 |
+ |
|
566 |
+ |
static void |
567 |
+ |
oputX( /* print unmirrored distance */ |
568 |
+ |
RAY *r |
569 |
+ |
) |
570 |
+ |
{ |
571 |
+ |
(*putreal)(&r->rxt, 1); |
572 |
+ |
} |
573 |
+ |
|
574 |
+ |
|
575 |
+ |
static void |
576 |
|
oputv( /* print value */ |
577 |
|
RAY *r |
578 |
|
) |
612 |
|
RAY *r |
613 |
|
) |
614 |
|
{ |
615 |
< |
(*putreal)(&r->rt, 1); |
615 |
> |
RREAL d = raydistance(r); |
616 |
> |
|
617 |
> |
(*putreal)(&d, 1); |
618 |
|
} |
619 |
|
|
620 |
|
|