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.83 by greg, Sat Nov 9 15:21:32 2024 UTC vs.
Revision 2.85 by greg, Wed Dec 25 17:40:27 2024 UTC

# Line 200 | Line 200 | freesources(void)                      /* free all source structures */
200                  while (nsources--)
201                          freeobscache(&source[nsources]);
202   #endif
203 + #ifdef SSKIPOPT
204 +                sskip_rsi(NULL);
205 + #endif
206                  free(source);
207                  source = NULL;
208                  nsources = 0;
# Line 216 | Line 219 | freesources(void)                      /* free all source structures */
219  
220  
221   int
222 < srcray(                         /* send a ray to a source, return domega */
223 <        RAY  *sr,               /* returned source ray */
224 <        RAY  *r,                        /* ray which hit object */
222 > srcray(                         /* aim a ray at a source, return domega */
223 >        RAY  *sr,               /* prepared source ray */
224 >        RAY  *r,                        /* originating ray (or NULL) */
225          SRCINDEX  *si                   /* source sample index */
226   )
227   {
# Line 231 | Line 234 | srcray(                                /* send a ray to a source, return domega */
234                  sr->rmax = 0.0;
235  
236          while ((d = nextssamp(sr, si)) != 0.0) {
237 <                sr->rsrc = si->sn;                      /* remember source */
237 >                sr->rsrc = si->sn;              /* remember source */
238                  srcp = source + si->sn;
239                  if (srcp->sflags & SDISTANT) {
240                          if (srcp->sflags & SSPOT && spotout(sr, srcp->sl.s))
# Line 448 | Line 451 | direct(                                        /* add direct component */
451                  cntord[sn].brt = sintens(scp->coef);
452                  if (cntord[sn].brt <= 0.0)
453                          continue;
454 + #ifdef SSKIPOPT
455 +                if (ssf_select != NULL && sskip_chk(ssf_select, scp->sno))
456 +                        scalescolor(scp->coef, r->scorr);
457 + #endif
458                  VCOPY(scp->dir, sr.rdir);
459                  copyscolor(sr.rcoef, scp->coef);
460                                                  /* compute potential */
# Line 603 | Line 610 | srcscatter(                    /* compute source scattering into ray */
610                          sr.rorg[2] = r->rorg[2] + r->rdir[2]*t;
611                          
612                          if (!volumePhotonMapping) {
613 <                                if (srcskip(r->slights[i], r))
613 >                                sr.parent = r;          /* hack for preemptive test */
614 >                                if (srcskip(r->slights[i], &sr))
615                                          continue;
616                                  initsrcindex(&si);      /* sample ray to this source */
617                                  si.sn = r->slights[i];
# Line 635 | Line 643 | srcscatter(                    /* compute source scattering into ray */
643                                  }
644                                                          /* other factors */
645                                  d *= si.dom * r->rot / (4.*PI*nsamps);
646 + #ifdef SSKIPOPT
647 +                                if (ssf_select != NULL && sskip_chk(ssf_select, sr.rsrc))
648 +                                        d *= r->scorr;
649 + #endif
650                                  scalescolor(sr.rcol, d);
651                          } else {
652                                  /* PMAP: Add ambient inscattering from

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines