]> git.lizzy.rs Git - shadowclad.git/blobdiff - level.c
Add vsync via EXT_swap_control
[shadowclad.git] / level.c
diff --git a/level.c b/level.c
index 29bee2ca62f4b95251a47161639331b5c74194ad..5e1cd6fbf5d73432e4cf834d48cdc0397fe1c5cd 100644 (file)
--- a/level.c
+++ b/level.c
@@ -1,31 +1,30 @@
 #include <GL/gl.h>
 #include <assimp/cimport.h>
-#include <assimp/scene.h>
 
-#include <stdlib.h>
 #include <stdio.h> // TODO remove
 
 #include "level.h"
-#include "tga.h"
 
-const Block BLOCK_EMPTY = 0;
-const Block BLOCK_WALL01 = 1;
+const AiScene* levelScene = NULL;
 
-TGAimage* level_image = NULL;
+static const Block BLOCK_EMPTY = 0;
+static const Block BLOCK_WALL01 = 0xFF0000FF; // red
 
-Block get_block(GLushort x, GLushort y) {
-       if (level_image == NULL) {
-               return BLOCK_EMPTY;
-       }
-       return ((Block*) (*level_image).bytes)[x * (*level_image).header.image_width + y];
+static const AiScene* blockWall01 = NULL;
+
+static TgaImage* levelImage = NULL;
+
+void initLevel() {
+       blockWall01 = importScene("out/assets/wall01.3ds");
+       levelScene = blockWall01;
 }
 
-void set_image(TGAimage* image) {
-       level_image = image;
+void setImage(TgaImage* image) {
+       levelImage = image;
 }
 
-const struct aiScene* import_model(const char* path) {
-       const struct aiScene* scene = aiImportFile(path, 0u);
+const AiScene* importScene(const char* path) {
+       const AiScene* scene = aiImportFile(path, 0u);
        if (scene == NULL) {
                fprintf(stderr, "Asset import failed at file %s\n", path); // TODO factor logging the heck outta here
        }