summaryrefslogtreecommitdiff
path: root/src/engine.c
diff options
context:
space:
mode:
authorAaditya Dhruv <[email protected]>2026-01-31 15:46:50 -0600
committerAaditya Dhruv <[email protected]>2026-01-31 15:46:50 -0600
commit42401e4e1c34f9ddc7246550227281ec6aeeceac (patch)
treef9dc68a455f05257b1138702fb51d3ef6344ac03 /src/engine.c
parent7f13b0abaa76a5e90674d5733f8162f02ceab693 (diff)
Add face culling - drastic reduction in rendered faces
- Only render faces that are "visible" so - exposed to air essentially. - We also check a neighbor chunk to test if there is a block, and accordigly draw a face in the curr chunk
Diffstat (limited to 'src/engine.c')
-rw-r--r--src/engine.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/engine.c b/src/engine.c
index ab6cf92..314c4ed 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -59,7 +59,7 @@ int engine_init(struct engine *engine) {
int chunk_coord[2] = { engine->curr_chunk[0] + i, -engine->curr_chunk[1] + j };
world_get_chunk(engine->world, chunk_coord, &chunk);
// Load chunk
- chunk_load(chunk, chunk_coord);
+ chunk_load(world, chunk, chunk_coord);
}
}
// Final step - Start the game
@@ -101,7 +101,7 @@ void engine_update(struct engine* engine) {
int chunk_coord[2] = { engine->curr_chunk[0] + i, -engine->curr_chunk[1] + j };
world_get_chunk(engine->world, chunk_coord, &chunk);
// Load chunk
- chunk_load(chunk, chunk_coord);
+ chunk_load(engine->world, chunk, chunk_coord);
}
}
}