8 |
|
#include "copyright.h" |
9 |
|
|
10 |
|
#include "ray.h" |
11 |
+ |
#include "rtotypes.h" |
12 |
|
|
13 |
|
/* |
14 |
|
* Clipping objects permit holes and sections to be taken out |
20 |
|
|
21 |
|
|
22 |
|
int |
23 |
< |
m_clip(m, r) /* clip objects from ray */ |
24 |
< |
register OBJREC *m; |
25 |
< |
register RAY *r; |
23 |
> |
m_clip( /* clip objects from ray */ |
24 |
> |
OBJREC *m, |
25 |
> |
RAY *r |
26 |
> |
) |
27 |
|
{ |
28 |
|
OBJECT cset[MAXSET+1], *modset; |
29 |
|
OBJECT obj, mod; |
30 |
|
int entering; |
31 |
< |
register int i; |
31 |
> |
int i; |
32 |
|
|
33 |
|
obj = objndx(m); |
34 |
|
if ((modset = (OBJECT *)m->os) == NULL) { |
55 |
|
} |
56 |
|
m->os = (char *)modset; |
57 |
|
} |
58 |
+ |
if (r == NULL) |
59 |
+ |
return(0); /* just initializing */ |
60 |
|
if (r->clipset != NULL) |
61 |
|
setcopy(cset, r->clipset); |
62 |
|
else |
63 |
|
cset[0] = 0; |
64 |
|
|
65 |
< |
entering = r->rod > 0.0; /* entering clipped region? */ |
65 |
> |
entering = (r->rod > 0.0); /* entering clipped region? */ |
66 |
|
|
67 |
< |
for (i = modset[0]; i > 0; i--) { |
67 |
> |
for (i = modset[0]; i > 0; i--) |
68 |
|
if (entering) { |
69 |
|
if (!inset(cset, modset[i])) { |
70 |
|
if (cset[0] >= MAXSET) |
71 |
|
error(INTERNAL, "set overflow in m_clip"); |
72 |
|
insertelem(cset, modset[i]); |
73 |
|
} |
74 |
< |
} else { |
75 |
< |
if (inset(cset, modset[i])) |
76 |
< |
deletelem(cset, modset[i]); |
73 |
< |
} |
74 |
< |
} |
74 |
> |
} else if (inset(cset, modset[i])) |
75 |
> |
deletelem(cset, modset[i]); |
76 |
> |
|
77 |
|
/* compute ray value */ |
78 |
|
r->newcset = cset; |
79 |
|
if (strcmp(m->oargs.sarg[0], VOIDID)) { |
80 |
|
int inside = 0; |
81 |
< |
register RAY *rp; |
81 |
> |
const RAY *rp; |
82 |
|
/* check for penetration */ |
83 |
|
for (rp = r; rp->parent != NULL; rp = rp->parent) |
84 |
|
if (!(rp->rtype & RAYREFL) && rp->parent->ro != NULL |