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 2.51 by greg, Thu May 26 06:55:22 2005 UTC vs.
Revision 2.58 by greg, Mon Aug 23 15:56:17 2010 UTC

# Line 55 | Line 55 | findmaterial(register OBJREC *o)
55                          ao = objptr(aobj);
56                          if (ismaterial(ao->otype))
57                                  return(ao);
58 +                        if (ao->otype == MOD_ALIAS) {
59 +                                o = ao;
60 +                                continue;
61 +                        }
62                  }
63                  if (o->omod == OVOID)
64                          return(NULL);
# Line 82 | Line 86 | marksources(void)                      /* find and mark source objects */
86                          continue;
87                                          /* find material */
88                  m = findmaterial(objptr(o->omod));
89 <                if (m == NULL || !islight(m->otype))
89 >                if (m == NULL)
90 >                        continue;
91 >                if (m->otype == MAT_CLIP) {
92 >                        markclip(m);    /* special case for antimatter */
93 >                        continue;
94 >                }
95 >                if (!islight(m->otype))
96                          continue;       /* not source modifier */
97          
98                  if (m->oargs.nfargs != (m->otype == MAT_GLOW ? 4 :
# Line 296 | Line 306 | sourcehit(                     /* check to see if ray hit distant source
306                   * If it's a glow or transparent illum, just remember it.
307                   */
308                  if (source[i].sflags & SSKIP) {
309 <                        glowsrc = i;
309 >                        if (glowsrc < 0)
310 >                                glowsrc = i;
311                          continue;
312                  }
313                  if (transillum(source[i].so->omod)) {
314 <                        transrc = i;
314 >                        if (transrc < 0)
315 >                                transrc = i;
316                          continue;
317                  }
318                  r->ro = source[i].so;   /* otherwise, use first hit */
# Line 382 | Line 394 | direct(                                        /* add direct component */
394                  scp->sno = sr.rsrc;
395                                                  /* compute coefficient */
396                  (*f)(scp->coef, p, sr.rdir, si.dom);
397 <                cntord[sn].brt = bright(scp->coef);
397 >                cntord[sn].brt = intens(scp->coef);
398                  if (cntord[sn].brt <= 0.0)
399                          continue;
400   #if SHADCACHE
# Line 399 | Line 411 | direct(                                        /* add direct component */
411                  rayvalue(&sr);
412                  multcolor(sr.rcol, sr.rcoef);
413                  copycolor(scp->val, sr.rcol);
414 <                cntord[sn].brt = bright(scp->val);
414 >                cntord[sn].brt = bright(sr.rcol);
415          }
416                                                  /* sort contributions */
417          qsort(cntord, sn, sizeof(CNTPTR), cntcmp);
# Line 437 | Line 449 | direct(                                        /* add direct component */
449                          break;
450                  scp = srccnt + cntord[sn].sndx;
451                                                  /* test for hit */
452 <                rayorigin(&sr, SHADOW, r, scp->coef);
452 >                rayorigin(&sr, SHADOW, r, NULL);
453 >                copycolor(sr.rcoef, scp->coef);
454                  VCOPY(sr.rdir, scp->dir);
455                  sr.rsrc = scp->sno;
456                                                  /* keep statistics */
# Line 452 | Line 465 | direct(                                        /* add direct component */
465                          raycont(&sr);
466                          if (trace != NULL)
467                                  (*trace)(&sr);  /* trace execution */
455                        rayparticipate(&sr);
468                          if (bright(sr.rcol) <= FTINY) {
469   #if SHADCACHE
470                                  if ((scp <= srccnt || scp[-1].sno != scp->sno)
# Line 462 | Line 474 | direct(                                        /* add direct component */
474   #endif
475                                  continue;       /* missed! */
476                          }
477 +                        rayparticipate(&sr);
478                          multcolor(sr.rcol, sr.rcoef);
479                          copycolor(scp->val, sr.rcol);
480                  } else if (trace != NULL &&

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines