59 |
|
|
60 |
|
static int |
61 |
|
volume_sign(r, v1, v2) /* get signed volume for ray and edge */ |
62 |
< |
register RAY *r; |
62 |
> |
RAY *r; |
63 |
|
int32 v1, v2; |
64 |
|
{ |
65 |
< |
int reversed = 0; |
66 |
< |
register struct EdgeSide *ecp; |
65 |
> |
int reversed = 0; |
66 |
> |
struct EdgeSide *ecp; |
67 |
|
|
68 |
|
if (v1 > v2) { |
69 |
|
int32 t = v2; v2 = v1; v1 = t; |
113 |
|
"missing triangle vertices in mesh_hit"); |
114 |
|
sv1 = volume_sign(r, tvi[0], tvi[1]); |
115 |
|
sv2 = volume_sign(r, tvi[1], tvi[2]); |
116 |
+ |
if (sv1 != sv2) /* compare volume signs */ |
117 |
+ |
continue; |
118 |
|
sv3 = volume_sign(r, tvi[2], tvi[0]); |
119 |
< |
/* compare volume signs */ |
118 |
< |
if ((sv1 != sv2) | (sv2 != sv3)) |
119 |
> |
if (sv2 != sv3) |
120 |
|
continue; |
121 |
|
/* compute intersection */ |
122 |
|
getmeshvert(&tv[0], curmsh, tvi[0], MT_V); |
130 |
|
continue; /* ray is tangent */ |
131 |
|
VSUB(va, tv[0].v, r->rorg); |
132 |
|
d = DOT(va, nrm) / d; |
133 |
< |
if (d <= FTINY || d >= r->rot) |
133 |
> |
if ((d <= FTINY) | (d >= r->rot)) |
134 |
|
continue; /* not good enough */ |
135 |
|
r->robj = oset[i]; /* else record hit */ |
136 |
|
r->ro = edge_cache.o; |
142 |
|
} |
143 |
|
|
144 |
|
|
145 |
< |
extern int |
145 |
> |
int |
146 |
|
o_mesh( /* compute ray intersection with a mesh */ |
147 |
|
OBJREC *o, |
148 |
< |
register RAY *r |
148 |
> |
RAY *r |
149 |
|
) |
150 |
|
{ |
151 |
|
RAY rcont; |
181 |
|
if (!(flags & MT_V)) |
182 |
|
objerror(o, INTERNAL, "missing mesh vertices in o_mesh"); |
183 |
|
r->robj = objndx(o); /* set object and material */ |
184 |
< |
if (o->omod == OVOID && tmod != OVOID) { |
184 |
> |
if ((o->omod == OVOID) & (tmod != OVOID)) { |
185 |
|
r->ro = getmeshpseudo(curmsh, tmod); |
186 |
|
r->rox = &curmi->x; |
187 |
|
} else |
199 |
|
wt[2]*tv[2].n[i]; |
200 |
|
multv3(r->pert, rcont.pert, curmi->x.f.xfm); |
201 |
|
if (normalize(r->pert) != 0.0) |
202 |
< |
for (i = 0; i < 3; i++) |
202 |
< |
r->pert[i] -= r->ron[i]; |
202 |
> |
VSUB(r->pert, r->pert, r->ron); |
203 |
|
} else |
204 |
|
r->pert[0] = r->pert[1] = r->pert[2] = .0; |
205 |
|
|
210 |
|
wt[2]*tv[2].uv[i]; |
211 |
|
else |
212 |
|
r->uv[0] = r->uv[1] = .0; |
213 |
< |
|
214 |
< |
/* return hit */ |
215 |
< |
return(1); |
213 |
> |
|
214 |
> |
return(1); /* return hit */ |
215 |
|
} |