92 |
|
{ |
93 |
|
if (ray_pnprocs > 0) /* close children if any */ |
94 |
|
ray_pclose(0); |
95 |
+ |
else if (ray_pnprocs < 0) |
96 |
+ |
_exit(code); /* avoid flush() in child */ |
97 |
|
#ifndef NON_POSIX |
98 |
< |
else if (!ray_pnprocs) { |
98 |
> |
else { |
99 |
|
headclean(); /* delete header file */ |
100 |
|
pfclean(); /* clean up persist files */ |
101 |
|
} |
166 |
|
if (nproc > 1) { /* start multiprocessing */ |
167 |
|
ray_popen(nproc); |
168 |
|
ray_fifo_out = printvals; |
167 |
– |
ray_pnbatch = 1; /* optimize for throughput */ |
169 |
|
} |
170 |
|
if (hresolu > 0) { |
171 |
|
if (vresolu > 0) |
420 |
|
) |
421 |
|
{ |
422 |
|
/* set up ray */ |
422 |
– |
rayorigin(&thisray, PRIMARY, NULL, NULL); |
423 |
|
if (imm_irrad) { |
424 |
|
VSUM(thisray.rorg, org, dir, 1.1e-4); |
425 |
|
thisray.rdir[0] = -dir[0]; |
426 |
|
thisray.rdir[1] = -dir[1]; |
427 |
|
thisray.rdir[2] = -dir[2]; |
428 |
|
thisray.rmax = 0.0; |
429 |
– |
thisray.revf = rayirrad; |
429 |
|
} else { |
430 |
|
VCOPY(thisray.rorg, org); |
431 |
|
VCOPY(thisray.rdir, dir); |
432 |
|
thisray.rmax = dmax; |
434 |
– |
if (castonly) |
435 |
– |
thisray.revf = raycast; |
433 |
|
} |
434 |
+ |
rayorigin(&thisray, PRIMARY, NULL, NULL); |
435 |
+ |
if (imm_irrad) |
436 |
+ |
thisray.revf = rayirrad; |
437 |
+ |
else if (castonly) |
438 |
+ |
thisray.revf = raycast; |
439 |
|
if (ray_pnprocs > 1) { /* multiprocessing FIFO? */ |
440 |
|
if (ray_fifo_in(&thisray) < 0) |
441 |
|
error(USER, "lost children"); |
766 |
|
|
767 |
|
|
768 |
|
static void |
769 |
< |
oputp( /* print point */ |
769 |
> |
oputp( /* print intersection point */ |
770 |
|
RAY *r |
771 |
|
) |
772 |
|
{ |
773 |
< |
if (r->rot < FHUGE*.99) |
772 |
< |
(*putreal)(r->rop, 3); |
773 |
< |
else |
774 |
< |
(*putreal)(vdummy, 3); |
773 |
> |
(*putreal)(r->rop, 3); /* set to ray origin if distant or no hit */ |
774 |
|
} |
775 |
|
|
776 |
|
|
779 |
|
RAY *r |
780 |
|
) |
781 |
|
{ |
782 |
< |
if (r->rot < FHUGE*.99) { |
784 |
< |
if (r->rflips & 1) { /* undo any flippin' flips */ |
785 |
< |
FVECT unrm; |
786 |
< |
unrm[0] = -r->ron[0]; |
787 |
< |
unrm[1] = -r->ron[1]; |
788 |
< |
unrm[2] = -r->ron[2]; |
789 |
< |
(*putreal)(unrm, 3); |
790 |
< |
} else |
791 |
< |
(*putreal)(r->ron, 3); |
792 |
< |
} else |
782 |
> |
if (r->ro == NULL) { /* zero vector if clipped or no hit */ |
783 |
|
(*putreal)(vdummy, 3); |
784 |
+ |
return; |
785 |
+ |
} |
786 |
+ |
if (r->rflips & 1) { /* undo any flippin' flips */ |
787 |
+ |
FVECT unrm; |
788 |
+ |
unrm[0] = -r->ron[0]; |
789 |
+ |
unrm[1] = -r->ron[1]; |
790 |
+ |
unrm[2] = -r->ron[2]; |
791 |
+ |
(*putreal)(unrm, 3); |
792 |
+ |
} else |
793 |
+ |
(*putreal)(r->ron, 3); |
794 |
|
} |
795 |
|
|
796 |
|
|
801 |
|
{ |
802 |
|
FVECT pnorm; |
803 |
|
|
804 |
< |
if (r->rot >= FHUGE*.99) { |
804 |
> |
if (r->ro == NULL) { /* clipped or no hit */ |
805 |
|
(*putreal)(vdummy, 3); |
806 |
|
return; |
807 |
|
} |