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.72 by greg, Mon Apr 6 21:09:07 2020 UTC vs.
Revision 2.75 by greg, Mon Jan 4 19:07:15 2021 UTC

# Line 364 | Line 364 | sourcehit(                     /* check to see if ray hit distant source
364                          return(0);      /* nothing usable */
365          }
366          /*
367 <         * Make assignments.
367 >         * Assign object index
368           */
369          r->robj = objndx(r->ro);
370        for (i = 0; i < 3; i++)
371                r->ron[i] = -r->rdir[i];
372        r->rod = 1.0;
373        r->pert[0] = r->pert[1] = r->pert[2] = 0.0;
374        r->uv[0] = r->uv[1] = 0.0;
375        r->rox = NULL;
370          return(1);
371   }
372  
# Line 434 | Line 428 | direct(                                        /* add direct component */
428                  cntord[sn].sndx = sn;
429                  scp = srccnt + sn;
430                  scp->sno = sr.rsrc;
431 <                                                /* compute coefficient */
438 <                (*f)(scp->coef, p, sr.rdir, si.dom);
439 <                cntord[sn].brt = intens(scp->coef);
440 <                if (cntord[sn].brt <= 0.0)
441 <                        continue;
442 < #if SHADCACHE
443 <                                                /* check shadow cache */
431 > #if SHADCACHE                                   /* check shadow cache */
432                  if (si.np == 1 && srcblocked(&sr)) {
433                          cntord[sn].brt = 0.0;
434                          continue;
435                  }
436   #endif
437 +                                                /* compute coefficient */
438 +                (*f)(scp->coef, p, sr.rdir, si.dom);
439 +                cntord[sn].brt = intens(scp->coef);
440 +                if (cntord[sn].brt <= 0.0)
441 +                        continue;
442                  VCOPY(scp->dir, sr.rdir);
443                  copycolor(sr.rcoef, scp->coef);
444                                                  /* compute potential */
# Line 478 | Line 471 | direct(                                        /* add direct component */
471                                                  /* compute number to check */
472          nshadcheck = pow((double)ncnts, shadcert) + .5;
473                                                  /* modify threshold */
474 <        if (ncnts > MINSHADCNT)
482 <                ourthresh = shadthresh / r->rweight;
483 <        else
484 <                ourthresh = 0;
474 >        ourthresh = shadthresh / r->rweight;
475                                                  /* test for shadows */
476          for (nhits = 0, hwt = 0.0, sn = 0; sn < ncnts;
477                          hwt += (double)source[scp->sno].nhits /
478                                  (double)source[scp->sno].ntests,
479                          sn++) {
480                                                  /* check threshold */
481 <                if ((sn+nshadcheck>=ncnts ? cntord[sn].brt :
481 >                if (sn >= MINSHADCNT &&
482 >                            (sn+nshadcheck>=ncnts ? cntord[sn].brt :
483                                  cntord[sn].brt-cntord[sn+nshadcheck].brt)
484 <                                < ourthresh*bright(r->rcol))
484 >                                        < ourthresh*bright(r->rcol))
485                          break;
486                  scp = srccnt + cntord[sn].sndx;
487                                                  /* test for hit */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines