--- ray/src/ot/bbox.c 1990/12/15 15:23:56 1.4 +++ ray/src/ot/bbox.c 2003/03/11 17:08:55 2.4 @@ -1,19 +1,18 @@ -/* Copyright (c) 1987 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: bbox.c,v 2.4 2003/03/11 17:08:55 greg Exp $"; #endif - /* * bbox.c - routines for bounding box computation. - * - * 8/4/87 */ +#include "copyright.h" + #include "standard.h" #include "object.h" +#include "octree.h" + #include "otypes.h" #include "face.h" @@ -22,7 +21,9 @@ static char SCCSid[] = "$SunId$ LBL"; #include "instance.h" +#include "mesh.h" + add2bbox(o, bbmin, bbmax) /* expand bounding box to fit object */ register OBJREC *o; FVECT bbmin, bbmax; @@ -30,6 +31,7 @@ FVECT bbmin, bbmax; CONE *co; FACE *fo; INSTANCE *io; + MESHINST *mi; FVECT v; register int i, j; @@ -71,6 +73,18 @@ FVECT bbmin, bbmax; v[i] += io->obj->scube.cusize; } multp3(v, v, io->x.f.xfm); + point2bbox(v, bbmin, bbmax); + } + break; + case OBJ_MESH: + mi = getmeshinst(o, IO_BOUNDS); + for (j = 0; j < 8; j++) { + for (i = 0; i < 3; i++) { + v[i] = mi->msh->mcube.cuorg[i]; + if (j & 1<msh->mcube.cusize; + } + multp3(v, v, mi->x.f.xfm); point2bbox(v, bbmin, bbmax); } break;