-
Notifications
You must be signed in to change notification settings - Fork 2
/
world.h
115 lines (89 loc) · 1.49 KB
/
world.h
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#ifndef WORLD_H_SENTRY
#define WORLD_H_SENTRY
#include "matrix.h"
#include "shaders.h"
#include <GLFW/glfw3.h>
typedef
struct PointLight
{
vec3 position;
vec4 ambient;
vec4 diffuse;
vec4 specular;
vec3 attenuation;
}
PointLight;
typedef
struct Texture
{
struct Texture * next;
const char * name;
GLuint id;
int num;
}
Texture;
typedef
struct TextureList
{
Texture * first;
Texture * last;
int cnt;
}
TextureList;
typedef
struct Material
{
struct Material * next;
char * name;
char * textureName;
vec4 emission;
vec4 ambient;
vec4 diffuse;
vec4 specular;
GLfloat shininess;
}
Material;
typedef
struct MaterialList
{
Material * first;
Material * last;
}
MaterialList;
typedef
struct WorldObject
{
struct WorldObject * next;
const char * materialName;
GLenum primitiveType; /* I.e. GL_TRIANGLES. */
GLfloat * position;
GLfloat * normal;
GLfloat * texCoord;
GLsizei cnt;
GLuint * idx;
GLsizei idxCnt;
GLuint vaoP;
}
WorldObject;
typedef
struct WorldObjectList
{
WorldObject * first;
WorldObject * last;
}
WorldObjectList;
typedef
struct World
{
PointLight * pointLight;
TextureList texList;
MaterialList mtrlList;
WorldObjectList objList;
ShaderProgram * sp;
}
World;
World * getWorld(const char * path);
void drawWorld(World * world);
void setupWater(ShaderProgram * sp, World * world);
void freeWorld(World * world);
#endif /* WORLD_H_SENTRY */