#ifndef OBJ_H #define OBJ_H /* external variables */ char obj_last_fname[31]; typedef struct { float x, y, z; } ObjVertex; typedef ObjVertex ObjNormal; typedef struct { float u, v; } ObjTexCoord; typedef struct { int Vertex[4]; int Normal[4]; int TexCoord[4]; } ObjFace; typedef struct { float Ns; float Ni; float d; float Tr; ObjVertex Tf; int illum; ObjVertex Ka; ObjVertex Kd; ObjVertex Ks; ObjVertex Ke; char *map_Ka; char *map_Kd; } ObjMtl; typedef struct { char *mtllib; char *objectName; char *groupName; char *usemtl; ObjMtl *mtl; int nVertex, nNormal, nTexCoord, nFace; ObjVertex *VertexArray; ObjNormal *NormalArray; ObjTexCoord *TexCoordArray; ObjFace *FaceArray; } ObjModel; /* function prototypes */ ObjModel *ObjLoadModel(char *, size_t); /* read a file into argument 2, and return amount of bytes read */ size_t ObjLoadFile(char *, char **); void ObjList(ObjModel *); /* once we load an .obj file, we can extract path up to last '/' to load a * mtl or texture that resides in the same folder */ char *ObjGetPath(char *); void ObjFree(ObjModel *); #endif