summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
author0undefined <oscar@nelin.dk>2026-02-19 01:39:46 +0000
committer0undefined <oscar@nelin.dk>2026-02-19 01:39:46 +0000
commiteef15506347455593d0daf1159eaa1b2c5097802 (patch)
treebd80d01ae0a5fae17a1e120c9630910c275a6971 /include
parentd623fb2cc40cb3648441f1818e172637b108f6a1 (diff)
Add chunking
Diffstat (limited to 'include')
-rw-r--r--include/worldgen.h26
1 files changed, 22 insertions, 4 deletions
diff --git a/include/worldgen.h b/include/worldgen.h
index 4cac9bf..9095906 100644
--- a/include/worldgen.h
+++ b/include/worldgen.h
@@ -6,16 +6,34 @@ extern "C" {
#include <daw/types.h>
-// first 4 bits for material type
+// amounts to 32768 blocks per chunk
+#define CHUNK_WIDTH 16
+#define CHUNK_LENGTH 16
+#define CHUNK_HEIGHT 128
+#define CHUNK_SIZE (CHUNK_WIDTH * CHUNK_LENGTH * CHUNK_HEIGHT)
+
+
+
+// World size is defined in terms of number of chunks. Chunks are not stacked
+// vertically
+#define WORLD_WIDTH 4
+#define WORLD_LENGTH 4
+#define WORLD_SIZE (WORLD_LENGTH * WORLD_WIDTH)
+
+
+// first 4 bits for material type, 16 types in total
#define BLOCK_none 0
#define BLOCK_grass 1
#define BLOCK_rock 2
// next 4 bits for shape type
-#define SHAPE_filled (1 << 4)
-#define SHAPE_slope (2 << 4)
+#define SHAPE_none (0 << 4)
+#define SHAPE_slope_north (1 << 4)
+#define SHAPE_slope_east (2 << 4)
+#define SHAPE_slope_south (3 << 4)
+#define SHAPE_slope_west (4 << 4)
-void gen_terrain(u8 *world, usize height, usize length, usize width);
+void gen_terrain(u8 *world);
#ifdef __cplusplus