blob: 10df760f9deb5adf4af662e5777132fd36f00e31 (
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/*
* This file is part of mverse
* Copyright (C) 2022 juanvalencia.xyz
* mverse is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
# ifndef __OBJ__
#define __OBJ__
#define OBJ_LINE_MAX 1024
#define OBJ_MAX_WORD 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];
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
|