ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/source.c
(Generate patch)

Comparing ray/src/rt/source.c (file contents):
Revision 1.12 by greg, Tue Jun 13 10:57:52 1989 UTC vs.
Revision 1.16 by greg, Sat Jul 22 11:07:51 1989 UTC

# Line 329 | Line 329 | char  *p;                      /* data for f */
329                                                  /* compute coefficient */
330                  (*f)(srccnt[sn].val, p, srccnt[sn].dir, srccnt[sn].dom);
331                  cntord[sn].brt = bright(srccnt[sn].val);
332 <                if (cntord[sn].brt <= FTINY)
332 >                if (cntord[sn].brt <= 0.0)
333                          continue;
334                                                  /* compute intersection */
335                  if (!( source[sn].sflags & SDISTANT ?
# Line 344 | Line 344 | char  *p;                      /* data for f */
344          }
345                                                  /* sort contributions */
346          qsort(cntord, nsources, sizeof(CNTPTR), cntcmp);
347 <                                                /* find last */
348 <        sn = 0; ncnts = nsources;
349 <        while (sn < ncnts-1) {
350 <                register int  m;
351 <                m = (sn + ncnts) >> 1;
352 <                if (cntord[m].brt > 0.0)
353 <                        sn = m;
354 <                else
355 <                        ncnts = m;
356 <        }
347 >        {                                       /* find last */
348 >                register int  l, m;
349 >
350 >                sn = 0; ncnts = l = nsources;
351 >                while ((m = (sn + ncnts) >> 1) != l) {
352 >                        if (cntord[m].brt > 0.0)
353 >                                sn = m;
354 >                        else
355 >                                ncnts = m;
356 >                        l = m;
357 >                }
358 >        }
359                                                  /* accumulate tail */
360          for (sn = ncnts-1; sn > 0; sn--)
361                  cntord[sn-1].brt += cntord[sn].brt;
# Line 377 | Line 379 | char  *p;                      /* data for f */
379                  if (localhit(&sr, &thescene) &&
380                                  sr.ro != source[cntord[sn].sno].so) {
381                                                  /* check for transmission */
382 <                        if (sr.clipset != NULL && inset(sr.clipset,sr.ro->omod))
381 <                                raytrans(&sr);          /* object is clipped */
382 <                        else
383 <                                rayshade(&sr, sr.ro->omod);
382 >                        rayshade(&sr, sr.ro->omod);
383                          if (bright(sr.rcol) <= FTINY)
384                                  continue;       /* missed! */
385                          (*f)(srccnt[cntord[sn].sno].val, p,
# Line 429 | Line 428 | m_light(m, r)                  /* ray hit a light source */
428   register OBJREC  *m;
429   register RAY  *r;
430   {
432                                                /* check for behind */
433        if (r->rod < 0.0)
434                return;
431                                                  /* check for over-counting */
432          if (wrongsource(m, r) || badambient(m, r))
433                  return;
# Line 445 | Line 441 | register RAY  *r;
441  
442                                                  /* otherwise treat as source */
443          } else {
444 +                                                /* check for behind */
445 +                if (r->rod < 0.0)
446 +                        return;
447                                                  /* get distribution pattern */
448                  raytexture(r, m->omod);
449                                                  /* get source color */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines