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); |
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 */ { |
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; |
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]); |
296 |
|
if (obs == OVOID) |
297 |
|
return(0); |
298 |
|
op = objptr(obs); /* check for intersection */ |
299 |
< |
return ((*ofun[op->otype].funp)(op, r)); |
299 |
> |
return((*ofun[op->otype].funp)(op, r)); |
300 |
|
} |
301 |
|
|
302 |
|
|