--- ray/src/rt/source.c 1989/07/19 18:47:01 1.14 +++ ray/src/rt/source.c 1990/01/11 11:06:22 1.19 @@ -329,7 +329,7 @@ char *p; /* data for f */ /* compute coefficient */ (*f)(srccnt[sn].val, p, srccnt[sn].dir, srccnt[sn].dom); cntord[sn].brt = bright(srccnt[sn].val); - if (cntord[sn].brt <= FTINY) + if (cntord[sn].brt <= 0.0) continue; /* compute intersection */ if (!( source[sn].sflags & SDISTANT ? @@ -338,7 +338,7 @@ char *p; /* data for f */ (source[sn].so, &sr) )) continue; /* compute contribution */ - rayshade(&sr, sr.ro->omod); + raycont(&sr); multcolor(srccnt[sn].val, sr.rcol); cntord[sn].brt = bright(srccnt[sn].val); } @@ -376,10 +376,11 @@ char *p; /* data for f */ /* test for hit */ rayorigin(&sr, r, SHADOW, 1.0); VCOPY(sr.rdir, srccnt[cntord[sn].sno].dir); + sr.rsrc = cntord[sn].sno; if (localhit(&sr, &thescene) && sr.ro != source[cntord[sn].sno].so) { /* check for transmission */ - rayshade(&sr, sr.ro->omod); + raycont(&sr); if (bright(sr.rcol) <= FTINY) continue; /* missed! */ (*f)(srccnt[cntord[sn].sno].val, p, @@ -394,7 +395,7 @@ char *p; /* data for f */ } /* weighted hit rate */ hwt = hit2 / test2; -#ifdef DEBUG +#ifdef notdef sprintf(errmsg, "%d tested, %d untested, %f hit rate\n", sn, ncnts-sn, hwt); eputs(errmsg); @@ -428,9 +429,6 @@ m_light(m, r) /* ray hit a light source */ register OBJREC *m; register RAY *r; { - /* check for behind */ - if (r->rod < 0.0) - return; /* check for over-counting */ if (wrongsource(m, r) || badambient(m, r)) return; @@ -444,6 +442,9 @@ register RAY *r; /* otherwise treat as source */ } else { + /* check for behind */ + if (r->rod < 0.0) + return; /* get distribution pattern */ raytexture(r, m->omod); /* get source color */