--- ray/src/rt/o_instance.c 1991/11/12 17:10:10 2.1 +++ ray/src/rt/o_instance.c 2003/02/25 02:47:23 2.5 @@ -1,15 +1,12 @@ -/* Copyright (c) 1990 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: o_instance.c,v 2.5 2003/02/25 02:47:23 greg Exp $"; #endif - /* * o_instance.c - routines for computing ray intersections with octrees. - * - * 11/11/88 */ +#include "copyright.h" + #include "ray.h" #include "instance.h" @@ -19,21 +16,20 @@ 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); - /* duplicate and clear ray */ + /* copy and transform ray */ copystruct(&rcont, r); - 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 */ + rcont.rmax *= in->x.b.sca; + /* clear and trace it */ + rayclear(&rcont); if (!localhit(&rcont, &in->obj->scube)) return(0); /* missed */ if (rcont.rot * in->x.f.sca >= r->rot)