--- ray/src/common/mesh.c 2003/07/21 22:30:17 2.13 +++ ray/src/common/mesh.c 2004/05/25 22:04:13 2.20 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: mesh.c,v 2.13 2003/07/21 22:30:17 schorsch Exp $"; +static const char RCSid[] = "$Id: mesh.c,v 2.20 2004/05/25 22:04:13 greg Exp $"; #endif /* * Mesh support routines @@ -7,7 +7,10 @@ static const char RCSid[] = "$Id: mesh.c,v 2.13 2003/0 #include -#include "standard.h" +#include "rtio.h" +#include "rtmath.h" +#include "rterror.h" +#include "paths.h" #include "octree.h" #include "object.h" #include "otypes.h" @@ -27,11 +30,16 @@ typedef struct { static MESH *mlist = NULL; /* list of loaded meshes */ +static lut_keycmpf_t cvcmp; +static lut_hashf_t cvhash; + static unsigned long -cvhash(cvp) /* hash an encoded vertex */ -MCVERT *cvp; +cvhash(p) /* hash an encoded vertex */ +//MCVERT *cvp; +const void *p; { + const MCVERT *cvp = (const MCVERT *)p; unsigned long hval; if (!(cvp->fl & MT_V)) @@ -46,9 +54,11 @@ MCVERT *cvp; static int -cvcmp(v1, v2) /* compare encoded vertices */ -register MCVERT *v1, *v2; +cvcmp(vv1, vv2) /* compare encoded vertices */ +//register MCVERT *v1, *v2; +const void *vv1, *vv2; { + const MCVERT *v1 = vv1, *v2 = vv2; if (v1->fl != v2->fl) return(1); if (v1->xyz[0] != v2->xyz[0]) @@ -306,7 +316,7 @@ MESHVERT *vp; (vp->v[i] - mp->mcube.cuorg[i]) / mp->mcube.cusize); } - if (vp->fl & MT_N) + if (vp->fl & MT_N) /* assumes normalized! */ cv.norm = encodedir(vp->n); if (vp->fl & MT_UV) for (i = 0; i < 2; i++) { @@ -543,8 +553,6 @@ register MESH *mp; if (nouvbounds && pp->uv != NULL) return("unreferenced uv coordinates"); } - if (pp->ntris + pp->nj1tris + pp->nj2tris <= 0) - error(WARNING, "no triangles in patch"); if (pp->ntris > 0 && pp->tri == NULL) return("missing patch triangle list"); if (pp->nj1tris > 0 && pp->j1tri == NULL)