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