-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathchunk.h
More file actions
38 lines (29 loc) · 821 Bytes
/
Copy pathchunk.h
File metadata and controls
38 lines (29 loc) · 821 Bytes
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
#ifndef CHUNK_H
#define CHUNK_H
#include "block.h"
#define CHUNK_BITS_X 4
#define CHUNK_BITS_Y 7
#define CHUNK_BITS_Z 4
#define CHUNK_SIZE_X (1 << CHUNK_BITS_X)
#define CHUNK_SIZE_Y (1 << CHUNK_BITS_Y)
#define CHUNK_SIZE_Z (1 << CHUNK_BITS_Z)
#define CHUNK_MASK_X (CHUNK_SIZE_X - 1)
#define CHUNK_MASK_Y (CHUNK_SIZE_Y - 1)
#define CHUNK_MASK_Z (CHUNK_SIZE_Z - 1)
struct landscape_t;
struct chunk_t
{
int32_t x;
int32_t y;
int32_t z;
struct block_t blocks[CHUNK_SIZE_X * CHUNK_SIZE_Y * CHUNK_SIZE_Z];
bool dirty;
bool ready;
bool inuse;
bool purge;
struct chunk_t *hash_next;
};
void chunk_generate(struct chunk_t *chunk, struct landscape_t *landscape);
bool chunk_load(const char *name, struct chunk_t *chunk);
bool chunk_save(const char *name, struct chunk_t *chunk);
#endif