diff options
| author | Aaditya Dhruv <[email protected]> | 2026-01-27 20:10:55 -0600 |
|---|---|---|
| committer | Aaditya Dhruv <[email protected]> | 2026-01-27 20:10:55 -0600 |
| commit | de3c9942416382aae0f2f2aac3b67c1e8b4d71f1 (patch) | |
| tree | 3776e5ba74dd45ee7ce41bb397ec97e187dcc325 /src/chunk.h | |
| parent | 6aabb8b3ca8284ac2d27af36459393321742d8f5 (diff) | |
Add support for chunk and world
- Chunk is a array of blocks
- World is a array of chunks
- Basic chunk plains generation based on simple linear functions
- Bunch of functions still not implemented, in design phase
Diffstat (limited to 'src/chunk.h')
| -rw-r--r-- | src/chunk.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/chunk.h b/src/chunk.h new file mode 100644 index 0000000..87c33fa --- /dev/null +++ b/src/chunk.h @@ -0,0 +1,21 @@ +#pragma once +#include "block.h" +#include "world.h" +#include "junk/vector.h" +#include <stdint.h> +enum biome { + JUNK_BIOME_PLAINS, +}; +#define CHUNK_WIDTH 16 +#define CHUNK_LENGTH 16 +#define CHUNK_HEIGHT 128 + +struct chunk { + struct block* blocks[CHUNK_WIDTH][CHUNK_LENGTH][CHUNK_HEIGHT]; + enum biome biome; + vec2 coord; +}; + +int chunk_gen(struct world* world, struct chunk* chunk); +int chunk_gen_structures(void* neighbor_data, struct chunk* chunk); +int chunk_gen_terrain(void* neighbor_data, struct chunk* chunk); |
