From 8150b91d4076d15f8df5cd66acc1b8076a2ee1a9 Mon Sep 17 00:00:00 2001 From: Aaditya Dhruv Date: Fri, 30 Jan 2026 00:17:39 -0600 Subject: Update chunk rendering, improve chunk loading - On world_init, LOAD_CHUNK amount of chunks are preloaded - Chunks are loaded around the player's current chunk, in a square shape. The size of the shape is controlled by CHUNK_DISTANCE - Allow chunks struct to be independent of a position. We load a chunk TO a position in the world chunk grid (x, y). This allows us to "wrap" chunks, so we have an endless world, but we are really just wrapping around --- src/block.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/block.h') diff --git a/src/block.h b/src/block.h index 1da88ac..b19265d 100644 --- a/src/block.h +++ b/src/block.h @@ -12,6 +12,15 @@ struct block { mat4 model; float angle; }; +/** + * Create a "block" object, which is the building blocks of this world. + * Blocks belong in chunks, and chunks belong in worlds. vec3 pos here is the coordinates of the block in WORLD space. + * However, a common method to render these blocks will be that the chunk will set the coordinates in "chunk space", and + * on a chunk_load, we will translate the blocks to wherever the chunk is loaded + * + * + */ int block_init(vec3 pos, struct block* blk); int block_draw(struct block* blk, struct shader* shader); void block_debug(struct block* blk); +void block_update(struct block* blk); -- cgit