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.2 by greg, Thu Jan 1 19:31:46 2004 UTC vs.
Revision 2.3 by greg, Fri Jan 9 05:37:12 2004 UTC

# Line 136 | Line 136 | initobscache(int sn)
136                                  else
137                                          VSUM(rdir, srcp->obscache->p.f.v,
138                                                  srcp->obscache->p.f.u, d);
139 <                                d = 2./SHADCACHE*(j+.5);
139 >                                d = 1. - 2./SHADCACHE*(j+.5);
140                                  VSUM(rdir, rdir, srcp->snorm, d);
141                                  normalize(rdir);
142                                  castshadow(sn, rorg, rdir);
# Line 219 | Line 219 | srcobstructp(register RAY *r)
219                          if (sd[0] < 0)
220                                  ondx += ((SHADCACHE+1)>>1)*SHADCACHE;
221                          ondx += SHADCACHE*(int)(SHADCACHE*(.5-FTINY) *
222 <                                        sd[2]/sd0m);
222 >                                        (1. - sd[2]/sd0m));
223                          ondx += (int)(SHADCACHE*(.5-FTINY) *
224                                          (1. + sd[1]/sd0m));
225                  } else /* sd1m > sd0m */ {
# Line 228 | Line 228 | srcobstructp(register RAY *r)
228                          if (sd[1] < 0)
229                                  ondx += ((SHADCACHE+1)>>1)*SHADCACHE;
230                          ondx += SHADCACHE*(int)(SHADCACHE*(.5-FTINY) *
231 <                                        sd[2]/sd1m);
231 >                                        (1. - sd[2]/sd1m));
232                          ondx += (int)(SHADCACHE*(.5-FTINY) *
233                                          (1. + sd[0]/sd1m));
234                  }
235 +                DCHECK(ondx < 0 | ondx >= SHADCACHE*SHADCACHE*3 +
236 +                                (SHADCACHE&1)*SHADCACHE*4, CONSISTENCY,
237 +                                "flat source cache index out of bounds");
238          } else /* spherical distribution */ {
239                  int     ax, ax1, ax2;
240                  RREAL   amax = 0;
# Line 249 | Line 252 | srcobstructp(register RAY *r)
252                                          (1. + r->rdir[ax1]/amax));
253                  ondx += (int)(SHADCACHE*(.5-FTINY) *
254                                  (1. + r->rdir[ax2]/amax));
255 +                DCHECK(ondx < 0 | ondx >= SHADCACHE*SHADCACHE*6, CONSISTENCY,
256 +                                "radial source cache index out of bounds");
257          }
258                                          /* return cache pointer */
259          return(&srcp->obscache->obs[ondx]);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines