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); |
197 |
|
ondx += (int)(2*SHADCACHE*srcp->obscache->p.d.e2 * |
198 |
|
(r->rorg[ax2] + t*srcp->sloc[ax2] - |
199 |
|
srcp->obscache->p.d.o[ax2])); |
200 |
< |
if (ondx < 0 | ondx >= 4*SHADCACHE*SHADCACHE) |
200 |
> |
if ((ondx < 0) | (ondx >= 4*SHADCACHE*SHADCACHE)) |
201 |
|
return(&noobs); /* could happen if ray is outside */ |
202 |
|
} else if (srcp->sflags & SFLAT) { |
203 |
|
FVECT sd; |
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]); |
281 |
|
m = findmaterial(r->ro); |
282 |
|
if (m == NULL) |
283 |
|
return; /* no material?! */ |
284 |
< |
if (!(ofun[m->otype].flags & T_OPAQUE)) |
284 |
> |
if (!isopaque(m->otype)) |
285 |
|
return; /* material not a reliable blocker */ |
286 |
|
*srcobstructp(r) = r->robj; /* else record obstructor */ |
287 |
|
} |