summaryrefslogtreecommitdiffstats
path: root/obj.h
blob: 51acb3a7b000d96fda981851754260c061250134 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef OBJ_H
#define OBJ_H

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
{
   char *mtllib;
   char *objectName;
   char *groupName; 
   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 *);
void ObjFree(ObjModel *);

#endif