-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathworld.h
79 lines (64 loc) · 1.19 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
#ifndef _WORLD_H
#define _WORLD_H
#include <stdbool.h>
#define WORLD_SIZE_X 128
#define WORLD_SIZE_Y 64
#define WORLD_SIZE_Z 128
#define WORLD_SIZE_XZ WORLD_SIZE_X * WORLD_SIZE_Z
#define WORLD_SIZE_XYZ WORLD_SIZE_X * WORLD_SIZE_Y * WORLD_SIZE_Z
#define TYPE_AIR 0
#define TYPE_STONE 1
struct vec3 {
GLfloat x;
GLfloat y;
GLfloat z;
};
struct vec4 {
GLfloat x;
GLfloat y;
GLfloat z;
GLfloat w;
};
struct mat4 {
struct vec4 x;
struct vec4 y;
struct vec4 z;
struct vec4 w;
};
struct color {
GLfloat r;
GLfloat g;
GLfloat b;
};
struct directions {
float right;
float left;
float up;
float down;
float front;
float back;
};
struct block {
char type;
struct color color;
struct directions occlusion;
};
struct vertex {
struct vec3 position;
struct vec3 normal;
struct color color;
GLfloat occlusion;
};
struct height_point {
int x;
int z;
int height;
};
struct block *get_block(int x, int y, int z);
bool has_neighbors(int x, int y, int z);
void world_init(int argc, char **argv);
void world_tick(int delta);
void world_display(void);
void world_keyboard(unsigned char key, int x, int y);
void world_mouse(int button, int state, int x, int y);
#endif /* !defined _WORLD_H */