19 |
|
OBJREC *o; |
20 |
|
register RAY *r; |
21 |
|
{ |
22 |
– |
extern long raynum; |
22 |
|
RAY rcont; |
23 |
|
register INSTANCE *in; |
24 |
|
register int i; |
25 |
|
/* get the octree */ |
26 |
|
in = getinstance(o, IO_ALL); |
27 |
< |
/* copy old ray */ |
27 |
> |
/* duplicate and clear ray */ |
28 |
|
copystruct(&rcont, r); |
29 |
< |
/* transform it */ |
30 |
< |
rcont.rno = raynum++; |
32 |
< |
rcont.ro = NULL; |
33 |
< |
rcont.rot = FHUGE; |
29 |
> |
rayclear(&rcont); |
30 |
> |
/* transform ray to new space */ |
31 |
|
multp3(rcont.rorg, r->rorg, in->x.b.xfm); |
32 |
|
multv3(rcont.rdir, r->rdir, in->x.b.xfm); |
33 |
|
for (i = 0; i < 3; i++) |
34 |
|
rcont.rdir[i] /= in->x.b.sca; |
35 |
|
/* trace it */ |
36 |
|
if (!localhit(&rcont, &in->obj->scube)) |
37 |
< |
return(0); /* missed */ |
37 |
> |
return(0); /* missed */ |
38 |
|
if (rcont.rot * in->x.f.sca >= r->rot) |
39 |
< |
return(0); /* not close enough */ |
39 |
> |
return(0); /* not close enough */ |
40 |
|
|
41 |
|
if (o->omod != OVOID) { /* if we have modifier, use it */ |
42 |
|
r->ro = o; |