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