| 19 |
|
#if SHADCACHE /* preemptive shadow checking */ |
| 20 |
|
|
| 21 |
|
|
| 22 |
+ |
OBJECT * antimodlist = NULL; /* set of clipped materials */ |
| 23 |
+ |
|
| 24 |
+ |
|
| 25 |
|
static int /* cast source ray to first blocker */ |
| 26 |
|
castshadow(int sn, FVECT rorg, FVECT rdir) |
| 27 |
|
{ |
| 295 |
|
return(0); /* don't record complex blockers */ |
| 296 |
|
if (r->rsrc < 0 || source[r->rsrc].so == r->ro) |
| 297 |
|
return(0); /* just a mistake, that's all */ |
| 298 |
+ |
if (antimodlist != NULL && inset(antimodlist, r->ro->omod)) |
| 299 |
+ |
return(0); /* could be clipped */ |
| 300 |
|
m = findmaterial(r->ro); |
| 301 |
|
if (m == NULL) |
| 302 |
|
return(0); /* no material?! */ |
| 325 |
|
return(1); |
| 326 |
|
rayclear(r); |
| 327 |
|
return(0); /* source in front */ |
| 328 |
+ |
} |
| 329 |
+ |
|
| 330 |
+ |
|
| 331 |
+ |
void /* record potentially clipped materials */ |
| 332 |
+ |
markclip(OBJREC *m) |
| 333 |
+ |
{ |
| 334 |
+ |
OBJECT *set2add, *oldset; |
| 335 |
+ |
|
| 336 |
+ |
m_clip(m, NULL); /* initialize modifier list */ |
| 337 |
+ |
if ((set2add = (OBJECT *)m->os) == NULL || !set2add[0]) |
| 338 |
+ |
return; |
| 339 |
+ |
|
| 340 |
+ |
if (antimodlist == NULL) { /* start of list */ |
| 341 |
+ |
antimodlist = setsave(set2add); |
| 342 |
+ |
return; |
| 343 |
+ |
} |
| 344 |
+ |
/* else add to previous list */ |
| 345 |
+ |
oldset = antimodlist; |
| 346 |
+ |
antimodlist = (OBJECT *)malloc((oldset[0]+set2add[0]+1)*sizeof(OBJECT)); |
| 347 |
+ |
if (antimodlist == NULL) |
| 348 |
+ |
error(SYSTEM, "out of memory in markclip"); |
| 349 |
+ |
setunion(antimodlist, oldset, set2add); |
| 350 |
+ |
free((void *)oldset); |
| 351 |
+ |
} |
| 352 |
+ |
|
| 353 |
+ |
|
| 354 |
+ |
#else /* SHADCACHE */ |
| 355 |
+ |
|
| 356 |
+ |
|
| 357 |
+ |
void /* no-op also avoids linker warning */ |
| 358 |
+ |
markclip(OBJREC *m) |
| 359 |
+ |
{ |
| 360 |
+ |
(void)m; |
| 361 |
|
} |
| 362 |
|
|
| 363 |
|
|