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.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/block.c') diff --git a/src/block.c b/src/block.c index 80a62d2..2197b2a 100644 --- a/src/block.c +++ b/src/block.c @@ -1,3 +1,4 @@ +#include "cglm/affine.h" #include "cglm/cam.h" #include "cglm/cglm.h" #include "cglm/io.h" @@ -131,7 +132,7 @@ void block_update(struct block* blk) { // RTS matrix - rotate, translate, scale glm_mat4_identity(blk->model); float angle = glm_rad(blk->angle); - vec3 scale = { 0.90f, 0.90f, 0.90f }; + // vec3 scale = { 0.90f, 0.90f, 0.90f }; glm_translate(blk->model, blk->coords); // glm_scale(blk->model, scale); // glm_rotate_at(blk->model, pivot, angle, rot_axis); @@ -159,7 +160,7 @@ int block_draw(struct block* blk, struct shader* shader) { }; glUniform3fv(loc, 6, (void*)colors); glDrawElements(GL_TRIANGLES, blk->_vertex_count, GL_UNSIGNED_INT, 0); - block_update(blk); + glBindVertexArray(0); return 0; } -- cgit