--- ray/src/common/readmesh.c 2003/06/07 12:50:20 2.4 +++ ray/src/common/readmesh.c 2004/09/14 02:53:50 2.13 @@ -1,16 +1,24 @@ #ifndef lint -static const char RCSid[] = "$Id: readmesh.c,v 2.4 2003/06/07 12:50:20 schorsch Exp $"; +static const char RCSid[] = "$Id: readmesh.c,v 2.13 2004/09/14 02:53:50 greg Exp $"; #endif /* * Routines for reading a compiled mesh from a file */ +#include + +#include "platform.h" #include "standard.h" #include "octree.h" #include "object.h" #include "mesh.h" #include "resolu.h" +#ifdef getc_unlocked /* avoid horrendous overhead of flockfile */ +#undef getc +#define getc getc_unlocked +#endif + static char *meshfn; /* input file name */ static FILE *meshfp; /* mesh file pointer */ static int objsize; /* sizeof(OBJECT) from writer */ @@ -89,7 +97,7 @@ gettree() /* get a pre-ordered octree */ default: mesherror(USER, "damaged mesh octree"); } - return NULL; /* pro forma return */ + return (OCTREE)NULL; /* pro forma return */ } @@ -132,17 +140,17 @@ register MESHPATCH *pp; pp->nverts = mgetint(2); if (pp->nverts <= 0 || pp->nverts > 256) mesherror(USER, "bad number of patch vertices"); - pp->xyz = (uint4 (*)[3])malloc(pp->nverts*3*sizeof(uint4)); + pp->xyz = (uint32 (*)[3])malloc(pp->nverts*3*sizeof(uint32)); if (pp->xyz == NULL) goto nomem; if (flags & MT_N) { - pp->norm = (int4 *)calloc(pp->nverts, sizeof(int4)); + pp->norm = (int32 *)calloc(pp->nverts, sizeof(int32)); if (pp->norm == NULL) goto nomem; } else pp->norm = NULL; if (flags & MT_UV) { - pp->uv = (uint4 (*)[2])calloc(pp->nverts, 2*sizeof(uint4)); + pp->uv = (uint32 (*)[2])calloc(pp->nverts, 2*sizeof(uint32)); if (pp->uv == NULL) goto nomem; } else @@ -178,7 +186,7 @@ register MESHPATCH *pp; pp->tri = NULL; /* local triangle material(s) */ if (mgetint(2) > 1) { - pp->trimat = (int2 *)malloc(pp->ntris*sizeof(int2)); + pp->trimat = (int16 *)malloc(pp->ntris*sizeof(int16)); if (pp->trimat == NULL) goto nomem; for (i = 0; i < pp->ntris; i++)