/* * Copyright (c) 1994, Riley Rainey, riley@netcon.com * * Permission to use, copy, modify and distribute (without charge) this * software, documentation, images, etc. is granted, provided that this * comment and the author's name is retained. * * This software is provided by the author as is, and without any expressed * or implied warranties, including, but not limited to, the implied * warranties of merchantability and fitness for a particular purpose. In no * event shall the author be liable for any direct, indirect, incidental, or * consequential damages arising in any way out of the use of this software. */ #include "Vlib.h" #include VObject *VReadObject(f) FILE *f; { short I, J, vertex, vertices, NumPts, NumPolys; float x, y, z; char str[64], name[128]; VPoint *tmpPts, pts[VmaxVP]; VPolygon **polygons; VObject *object; fscanf(f, "%s\n", name); fscanf(f, "%hd", &NumPts); fscanf(f, "%hd", &NumPolys); tmpPts = (VPoint *) Vmalloc (NumPts * sizeof(VPoint)); polygons = (VPolygon **) Vmalloc (NumPolys * sizeof(VPolygon *)); for (I=0; Iname = strdup (name); object->numPolys = NumPolys; object->polygon = polygons; free ((char *) tmpPts); return ferror(f) ? (VObject *) 0 : object; }