--- ray/src/rt/o_mesh.c 2003/03/14 21:27:46 2.5 +++ ray/src/rt/o_mesh.c 2004/03/30 16:13:01 2.10 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: o_mesh.c,v 2.5 2003/03/14 21:27:46 greg Exp $"; +static const char RCSid[] = "$Id: o_mesh.c,v 2.10 2004/03/30 16:13:01 schorsch Exp $"; #endif /* * Routines for computing ray intersections with meshes. @@ -21,11 +21,12 @@ static const char RCSid[] = "$Id: o_mesh.c,v 2.5 2003/ #include "copyright.h" -#include "ray.h" +#include +#include "ray.h" #include "mesh.h" - #include "tmesh.h" +#include "rtotypes.h" #define EDGE_CACHE_SIZ 251 /* length of mesh edge cache */ @@ -39,7 +40,7 @@ struct EdgeCache { OBJREC *o; /* mesh object */ MESHINST *mi; /* current mesh instance */ struct EdgeSide { - int4 v1i, v2i; /* vertex indices (lowest first) */ + int32 v1i, v2i; /* vertex indices (lowest first) */ short signum; /* signed volume */ } cache[EDGE_CACHE_SIZ]; } edge_cache; @@ -52,20 +53,20 @@ OBJREC *o; /* get mesh instance */ edge_cache.mi = getmeshinst(edge_cache.o = o, IO_ALL); /* clear edge cache */ - bzero((void *)edge_cache.cache, sizeof(edge_cache.cache)); + memset((void *)edge_cache.cache, '\0', sizeof(edge_cache.cache)); } static int signed_volume(r, v1, v2) /* get signed volume for ray and edge */ register RAY *r; -int4 v1, v2; +int32 v1, v2; { int reversed = 0; register struct EdgeSide *ecp; if (v1 > v2) { - int4 t = v2; v2 = v1; v1 = t; + int32 t = v2; v2 = v1; v1 = t; reversed = 1; } ecp = &edge_cache.cache[((v2<<11 ^ v1) & 0x7fffffff) % EDGE_CACHE_SIZ]; @@ -102,7 +103,7 @@ mesh_hit(oset, r) /* intersect ray with mesh triangle OBJECT *oset; RAY *r; { - int4 tvi[3]; + int32 tvi[3]; int sv1, sv2, sv3; MESHVERT tv[3]; OBJECT tmod; @@ -144,21 +145,22 @@ RAY *r; } -int -o_mesh(o, r) /* compute ray intersection with a mesh */ -OBJREC *o; -register RAY *r; +extern int +o_mesh( /* compute ray intersection with a mesh */ + OBJREC *o, + register RAY *r +) { RAY rcont; int flags; MESHVERT tv[3]; OBJECT tmod; - FLOAT wt[3]; + RREAL wt[3]; int i; /* get the mesh instance */ prep_edge_cache(o); /* copy and transform ray */ - copystruct(&rcont, r); + rcont = *r; multp3(rcont.rorg, r->rorg, curmi->x.b.xfm); multv3(rcont.rdir, r->rdir, curmi->x.b.xfm); for (i = 0; i < 3; i++)