summaryrefslogtreecommitdiff
path: root/src/chunk.c
diff options
context:
space:
mode:
authorAaditya Dhruv <[email protected]>2026-01-30 19:12:03 -0600
committerAaditya Dhruv <[email protected]>2026-01-30 19:12:03 -0600
commit1a721b98caf7559f4a18baa8d3b92269e8f1f6ce (patch)
tree32be8966361f8f8ae74c6c0af226e39fe9feb375 /src/chunk.c
parent4992ce0098cac8caef6c9315816b688d96259bce (diff)
Add basic block textures
- Remove the code that sent colors through uniform variables, instead send texture data - Each vertex now has a texture coordinate - struct texture is a easy way to represent textures, can be extended later - Shaders updated to use textures
Diffstat (limited to 'src/chunk.c')
-rw-r--r--src/chunk.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/chunk.c b/src/chunk.c
index 4918d22..3a7b334 100644
--- a/src/chunk.c
+++ b/src/chunk.c
@@ -147,7 +147,7 @@ void chunk_load(struct chunk *chunk, int coord[2]) {
}
}
-void chunk_draw(struct chunk* chunk, struct shader* shader) {
+void chunk_draw(struct chunk* chunk, struct shader* shader, struct texture* texture) {
int counter = 0;
for (int i = 0; i < CHUNK_WIDTH; i++) {
for (int j = 0; j < CHUNK_LENGTH; j++) {
@@ -156,7 +156,7 @@ void chunk_draw(struct chunk* chunk, struct shader* shader) {
if (blk == NULL) {
continue;
}
- block_draw(blk, shader);
+ block_draw(blk, shader, texture);
counter += 1;
}
}