382 |
|
rtst.rmax = normalize(rtst.rdir); /* short ray test */ |
383 |
|
while (localhit(&rtst, &thescene)) { /* check for occluder */ |
384 |
|
OBJREC *m = findmaterial(rtst.ro); |
385 |
< |
if (m != NULL && !istransp(m->otype) && !isBSDFproxy(m) && |
385 |
> |
if (m != NULL && !istransp(m) && !isBSDFproxy(m) && |
386 |
|
(rtst.clipset == NULL || |
387 |
|
!inset(rtst.clipset, rtst.ro->omod))) |
388 |
|
return(1); /* plug light leak */ |
458 |
|
if (delta_r2 >= maxangle*maxangle) |
459 |
|
continue; |
460 |
|
/* |
461 |
< |
* Original ray behind test |
461 |
> |
* Modified ray behind test |
462 |
|
*/ |
463 |
< |
d = 0.0; |
464 |
< |
for (j = 0; j < 3; j++) |
465 |
< |
d += (r->rop[j] - av->pos[j])*(r->ron[j] + uvw[2][j]); |
466 |
< |
d *= 0.5; |
463 |
> |
VSUB(ck0, r->rop, av->pos); |
464 |
> |
d = DOT(ck0, uvw[2]); |
465 |
|
if (d < -minarad*ambacc) |
466 |
|
continue; |
467 |
< |
/* Pre-empt following test if we can */ |
468 |
< |
if (fabs(d) >= av->rad[0]*ambacc) |
467 |
> |
d /= av->rad[0]; |
468 |
> |
delta_t2 = d*d; |
469 |
> |
if (delta_t2 >= ambacc*ambacc) |
470 |
|
continue; |
471 |
|
/* |
472 |
|
* Elliptical radii test based on Hessian |
630 |
|
{ |
631 |
|
extern char *progname, *octname; |
632 |
|
static char *mybuf = NULL; |
633 |
+ |
int ntries = 3; |
634 |
|
|
635 |
|
#ifdef F_SETLKW |
636 |
|
aflock(cre8 ? F_WRLCK : F_RDLCK); |
666 |
|
fputc('\n', ambfp); |
667 |
|
putambmagic(ambfp); |
668 |
|
} else if (getheader(ambfp, amb_headline, NULL) < 0 || !hasambmagic(ambfp)) { |
669 |
– |
#ifndef F_SETLKW |
670 |
– |
static int ntries = 3; |
669 |
|
if (--ntries > 0 && ftell(ambfp) == 0) { |
670 |
+ |
#ifdef F_SETLKW |
671 |
+ |
aflock(F_UNLCK); |
672 |
|
clearerr(ambfp); |
673 |
|
sleep(2); |
674 |
+ |
aflock(F_RDLCK); |
675 |
+ |
#else |
676 |
+ |
clearerr(ambfp); |
677 |
+ |
sleep(2); |
678 |
+ |
#endif |
679 |
|
goto retry; |
680 |
|
} |
676 |
– |
#endif |
681 |
|
error(USER, "bad/incompatible ambient file"); |
682 |
|
} |
683 |
|
if ((AMB_CNDX != CNDX) | (AMB_WLPART != WLPART)) { |