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.81 by greg, Wed Nov 15 18:02:53 2023 UTC vs.
Revision 2.86 by greg, Sat Jan 18 03:49:00 2025 UTC

# Line 216 | Line 216 | freesources(void)                      /* free all source structures */
216  
217  
218   int
219 < srcray(                         /* send a ray to a source, return domega */
220 <        RAY  *sr,               /* returned source ray */
221 <        RAY  *r,                        /* ray which hit object */
219 > srcray(                         /* aim a ray at a source, return domega */
220 >        RAY  *sr,               /* prepared source ray */
221 >        RAY  *r,                        /* originating ray (or NULL) */
222          SRCINDEX  *si                   /* source sample index */
223   )
224   {
# Line 231 | Line 231 | srcray(                                /* send a ray to a source, return domega */
231                  sr->rmax = 0.0;
232  
233          while ((d = nextssamp(sr, si)) != 0.0) {
234 <                sr->rsrc = si->sn;                      /* remember source */
234 >                sr->rsrc = si->sn;              /* remember source */
235                  srcp = source + si->sn;
236                  if (srcp->sflags & SDISTANT) {
237                          if (srcp->sflags & SSPOT && spotout(sr, srcp->sl.s))
# Line 494 | Line 494 | direct(                                        /* add direct component */
494                          break;
495                  scp = srccnt + cntord[sn].sndx;
496                                                  /* test for hit */
497 <                rayorigin(&sr, SHADOW, r, NULL);
497 >                rayorigin(&sr, thrudir(r,scp->dir) ? TSHADOW : RSHADOW, r, NULL);
498                  copyscolor(sr.rcoef, scp->coef);
499                  VCOPY(sr.rdir, scp->dir);
500                  sr.rsrc = scp->sno;
# Line 596 | Line 596 | srcscatter(                    /* compute source scattering into ray */
596                          setcolor(cvext, re > 92. ? 0. : exp(-re),
597                                          ge > 92. ? 0. : exp(-ge),
598                                          be > 92. ? 0. : exp(-be));
599 <                        if (intens(cvext) <= FTINY)
599 >                        if (intens(cvext) <= FTINY*FTINY)
600                                  break;                  /* too far away */
601                          sr.rorg[0] = r->rorg[0] + r->rdir[0]*t;
602                          sr.rorg[1] = r->rorg[1] + r->rdir[1]*t;
603                          sr.rorg[2] = r->rorg[2] + r->rdir[2]*t;
604                          
605                          if (!volumePhotonMapping) {
606 +                                sr.parent = r;          /* hack for preemptive test */
607 +                                if (srcskip(r->slights[i], &sr))
608 +                                        continue;
609                                  initsrcindex(&si);      /* sample ray to this source */
610                                  si.sn = r->slights[i];
611                                  nopart(&si, &sr);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines