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

Comparing ray/src/rt/srcobstr.c (file contents):
Revision 2.5 by greg, Tue Jun 22 13:40:54 2004 UTC vs.
Revision 2.6 by greg, Wed Sep 8 01:48:50 2004 UTC

# Line 169 | Line 169 | initobscache(int sn)
169   static OBJECT *                 /* return occluder cache entry */
170   srcobstructp(register RAY *r)
171   {
172 +        static unsigned long    lastrno = ~0;
173          static OBJECT   noobs;
174 +        static OBJECT   *lastobjp;
175          SRCREC          *srcp;
176          int             ondx;
177  
178 +        noobs = OVOID;
179 +        if (r->rno == lastrno)
180 +                return lastobjp;        /* just recall last pointer */
181          DCHECK(r->rsrc < 0, CONSISTENCY,
182                          "srcobstructp() called with unaimed ray");
183 <        noobs = OVOID;
183 >        lastrno = r->rno;
184 >        lastobjp = &noobs;
185          srcp = &source[r->rsrc];
186          if (srcp->sflags & (SSKIP|SPROX|SSPOT|SVIRTUAL))
187                  return(&noobs);         /* don't cache these */
# Line 232 | Line 238 | srcobstructp(register RAY *r)
238                          ondx += (int)(SHADCACHE*(.5-FTINY) *
239                                          (1. + sd[0]/sd1m));
240                  }
241 <                DCHECK(ondx < 0 | ondx >= SHADCACHE*SHADCACHE*3 +
242 <                                (SHADCACHE&1)*SHADCACHE*4, CONSISTENCY,
241 >                DCHECK((ondx < 0) | (ondx >= SHADCACHE*SHADCACHE*3 +
242 >                                (SHADCACHE&1)*SHADCACHE*4), CONSISTENCY,
243                                  "flat source cache index out of bounds");
244          } else /* spherical distribution */ {
245                  int     ax, ax1, ax2;
# Line 252 | Line 258 | srcobstructp(register RAY *r)
258                                          (1. + r->rdir[ax1]/amax));
259                  ondx += (int)(SHADCACHE*(.5-FTINY) *
260                                  (1. + r->rdir[ax2]/amax));
261 <                DCHECK(ondx < 0 | ondx >= SHADCACHE*SHADCACHE*6, CONSISTENCY,
261 >                DCHECK((ondx < 0) | (ondx >= SHADCACHE*SHADCACHE*6), CONSISTENCY,
262                                  "radial source cache index out of bounds");
263          }
264                                          /* return cache pointer */
265 <        return(&srcp->obscache->obs[ondx]);
265 >        return(lastobjp = &srcp->obscache->obs[ondx]);
266   }
267  
268  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines