--- ray/src/rt/o_instance.c 1989/04/11 13:30:30 1.2 +++ ray/src/rt/o_instance.c 1990/01/19 00:00:17 1.7 @@ -24,14 +24,13 @@ register RAY *r; register INSTANCE *in; register int i; /* get the octree */ - in = getinstance(o, GET_ALL); + in = getinstance(o, IO_ALL); /* copy old ray */ - bcopy(r, &rcont, sizeof(RAY)); + copystruct(&rcont, r); /* transform it */ rcont.rno = nrays; rcont.ro = NULL; rcont.rot = FHUGE; - rcont.rno = nrays; multp3(rcont.rorg, r->rorg, in->b.xfm); multv3(rcont.rdir, r->rdir, in->b.xfm); for (i = 0; i < 3; i++) @@ -41,13 +40,15 @@ register RAY *r; return(0); /* missed */ if (rcont.rot * in->f.sca >= r->rot) return(0); /* not close enough */ - /* if we have modifier, use it */ - if (o->omod != OVOID) + + if (o->omod != OVOID) { /* if we have modifier, use it */ r->ro = o; - else { /* else use theirs */ + r->rofs = 1.0; setident4(r->rofx); + r->robs = 1.0; setident4(r->robx); + } else { /* else use theirs */ r->ro = rcont.ro; - multmat4(r->rofx, in->f.xfm, rcont.rofx); - r->rofs = in->f.sca * rcont.rofs; + multmat4(r->rofx, rcont.rofx, in->f.xfm); + r->rofs = rcont.rofs * in->f.sca; multmat4(r->robx, in->b.xfm, rcont.robx); r->robs = in->b.sca * rcont.robs; }