--- ray/src/rt/ambient.c 2024/11/11 19:01:55 2.125 +++ ray/src/rt/ambient.c 2024/12/19 17:43:47 2.127 @@ -1,4 +1,4 @@ -static const char RCSid[] = "$Id: ambient.c,v 2.125 2024/11/11 19:01:55 greg Exp $"; +static const char RCSid[] = "$Id: ambient.c,v 2.127 2024/12/19 17:43:47 greg Exp $"; /* * ambient.c - routines dealing with ambient (inter-reflected) component. * @@ -382,7 +382,7 @@ plugaleak(RAY *r, AMBVAL *ap, FVECT anorm, double ang) rtst.rmax = normalize(rtst.rdir); /* short ray test */ while (localhit(&rtst, &thescene)) { /* check for occluder */ OBJREC *m = findmaterial(rtst.ro); - if (m != NULL && !istransp(m->otype) && !isBSDFproxy(m) && + if (m != NULL && !istransp(m) && !isBSDFproxy(m) && (rtst.clipset == NULL || !inset(rtst.clipset, rtst.ro->omod))) return(1); /* plug light leak */ @@ -665,14 +665,19 @@ retry: fputc('\n', ambfp); putambmagic(ambfp); } else if (getheader(ambfp, amb_headline, NULL) < 0 || !hasambmagic(ambfp)) { -#ifndef F_SETLKW - static int ntries = 3; - if (--ntries > 0 && ftell(ambfp) == 0) { + int ntries = 2; + if (ntries-- > 0 && ftell(ambfp) == 0) { +#ifdef F_SETLKW + aflock(F_UNLCK); clearerr(ambfp); sleep(2); + aflock(F_RDLCK); +#else + clearerr(ambfp); + sleep(2); +#endif goto retry; } -#endif error(USER, "bad/incompatible ambient file"); } if ((AMB_CNDX != CNDX) | (AMB_WLPART != WLPART)) {