aboutsummaryrefslogtreecommitdiff
path: root/src/obj.h
blob: 19a156ee558ed820880f87ca7c4aa8f5ab29f030 (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
# ifndef __OBJ__
#define __OBJ__

#define OBJ_LINE_MAX_SIZE 1024
#define OBJ_MAX_NAME 512

typedef struct {
    float position[3];
    float normal[3];
    float texCoords[2];
} Vertex;

typedef struct {
    unsigned int id;
    char type[50];
} Texture;

typedef struct {
    char name[OBJ_LINE_MAX_SIZE];
    float ka[3], kd[3], ks[3];
    unsigned int illum;
    float ns;
} Material;

typedef struct {
    Vertex *vertices;
    Material material;
    unsigned int *indices;
    unsigned int indexSize, vertexSize;
    unsigned int VAO, EBO, VBO;
} Mesh;

typedef struct {
    Mesh *mesh;
    unsigned int size;
} Obj;

Obj objCreate(const char *filename);
# endif
Feel free to download, copy and edit any repo