--- ray/src/rt/o_instance.c 1991/06/17 08:26:20 1.10 +++ ray/src/rt/o_instance.c 1992/12/20 10:11:53 2.2 @@ -19,27 +19,24 @@ o_instance(o, r) /* compute ray intersection with oct OBJREC *o; register RAY *r; { - extern long raynum; RAY rcont; register INSTANCE *in; register int i; /* get the octree */ in = getinstance(o, IO_ALL); - /* copy old ray */ + /* duplicate and clear ray */ copystruct(&rcont, r); - /* transform it */ - rcont.rno = raynum++; - rcont.ro = NULL; - rcont.rot = FHUGE; + rayclear(&rcont); + /* transform ray to new space */ multp3(rcont.rorg, r->rorg, in->x.b.xfm); multv3(rcont.rdir, r->rdir, in->x.b.xfm); for (i = 0; i < 3; i++) rcont.rdir[i] /= in->x.b.sca; /* trace it */ if (!localhit(&rcont, &in->obj->scube)) - return(0); /* missed */ + return(0); /* missed */ if (rcont.rot * in->x.f.sca >= r->rot) - return(0); /* not close enough */ + return(0); /* not close enough */ if (o->omod != OVOID) { /* if we have modifier, use it */ r->ro = o;