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

Comparing ray/src/rt/srcsamp.c (file contents):
Revision 2.18 by greg, Wed Dec 28 18:39:36 2011 UTC vs.
Revision 2.25 by greg, Sat Jan 18 03:49:00 2025 UTC

# Line 16 | Line 16 | static const char      RCSid[] = "$Id$";
16   #include  "random.h"
17  
18  
19 < static int
20 < srcskip(                        /* pre-emptive test for out-of-range glow */
21 <        SRCREC  *sp,
22 <        FVECT  orig
19 > int
20 > srcskip(                        /* pre-emptive test for source to skip */
21 >        int  sn,
22 >        RAY  *r
23   )
24   {
25 +        SRCREC  *sp = source + sn;
26 +
27          if (sp->sflags & SSKIP)
28                  return(1);
29 <
30 <        if ((sp->sflags & (SPROX|SDISTANT)) != SPROX)
29 <                return(0);
30 <
31 <        return(dist2(orig, sp->sloc) >
29 >        if ((sp->sflags & (SPROX|SDISTANT)) == SPROX)
30 >                return(dist2(r->rorg, sp->sloc) >
31                          (sp->sl.prox + sp->srad)*(sp->sl.prox + sp->srad));
32 +        return(0);
33   }
34  
35   double
36   nextssamp(                      /* compute sample for source, rtn. distance */
37          RAY  *r,                /* origin is read, direction is set */
38 <        SRCINDEX  *si           /* source index (modified to current) */\
38 >        SRCINDEX  *si           /* source index (modified to current) */
39   )
40   {
41          int  cent[3], size[3], parr[2];
42          SRCREC  *srcp;
43 <        FVECT  vpos;
43 >        double  vpos[3];
44          double  d;
45          int  i;
46   nextsample:
47          while (++si->sp >= si->np) {    /* get next sample */
48                  if (++si->sn >= nsources)
49                          return(0.0);    /* no more */
50 <                if (srcskip(source+si->sn, r->rorg))
50 >                if (srcskip(si->sn, r))
51                          si->np = 0;
52                  else if (srcsizerat <= FTINY)
53                          nopart(si, r);
# Line 84 | Line 84 | nextsample:
84  
85          VSUM(vpos, vpos, cent, 1.0/MAXSPART);
86                                          /* avoid circular aiming failures */
87 <        if ((srcp->sflags & SCIR) && (si->np > 1 || dstrsrc > 0.7)) {
87 >        if ((srcp->sflags & SCIR) && (si->np > 1) | (dstrsrc > 0.7)) {
88                  FVECT   trim;
89                  if (srcp->sflags & (SFLAT|SDISTANT)) {
90                          d = 1.12837917;         /* correct setflatss() */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines