1 |
|
#ifndef lint |
2 |
< |
static const char RCSid[] = "$Id$"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
4 |
|
/* |
5 |
|
* bbox.c - routines for bounding box computation. |
6 |
|
*/ |
7 |
|
|
8 |
< |
#include "copyright.h" |
8 |
> |
#include "copyright.h" |
9 |
|
|
10 |
|
#include "standard.h" |
11 |
|
|
21 |
|
|
22 |
|
#include "instance.h" |
23 |
|
|
24 |
+ |
#include "mesh.h" |
25 |
|
|
26 |
+ |
|
27 |
|
add2bbox(o, bbmin, bbmax) /* expand bounding box to fit object */ |
28 |
|
register OBJREC *o; |
29 |
|
FVECT bbmin, bbmax; |
31 |
|
CONE *co; |
32 |
|
FACE *fo; |
33 |
|
INSTANCE *io; |
34 |
+ |
MESHINST *mi; |
35 |
|
FVECT v; |
36 |
|
register int i, j; |
37 |
|
|
73 |
|
v[i] += io->obj->scube.cusize; |
74 |
|
} |
75 |
|
multp3(v, v, io->x.f.xfm); |
76 |
+ |
point2bbox(v, bbmin, bbmax); |
77 |
+ |
} |
78 |
+ |
break; |
79 |
+ |
case OBJ_MESH: |
80 |
+ |
mi = getmeshinst(o, IO_BOUNDS); |
81 |
+ |
for (j = 0; j < 8; j++) { |
82 |
+ |
for (i = 0; i < 3; i++) { |
83 |
+ |
v[i] = mi->msh->mcube.cuorg[i]; |
84 |
+ |
if (j & 1<<i) |
85 |
+ |
v[i] += mi->msh->mcube.cusize; |
86 |
+ |
} |
87 |
+ |
multp3(v, v, mi->x.f.xfm); |
88 |
|
point2bbox(v, bbmin, bbmax); |
89 |
|
} |
90 |
|
break; |