]> git.lizzy.rs Git - shadowclad.git/blob - level.c
Start refactoring naming convention
[shadowclad.git] / level.c
1 #include <GL/gl.h>
2 #include <stdlib.h>
3 #include <stdio.h> // TODO remove
4 #include <assimp/cimport.h>
5 #include <assimp/scene.h>
6
7 #include "level.h"
8 #include "tga.h"
9
10 const Block BLOCK_EMPTY = 0;
11 const Block BLOCK_WALL01 = 1;
12
13 TGAimage* level_image = NULL;
14
15 Block get_block(GLushort x, GLushort y) {
16         if (level_image == NULL) {
17                 return BLOCK_EMPTY;
18         }
19         return ((Block*) (*level_image).bytes)[x * (*level_image).header.image_width + y];
20 }
21
22 void set_image(TGAimage* image) {
23         level_image = image;
24 }
25
26 const struct aiScene* import_model(const char* path) {
27         const struct aiScene* scene = aiImportFile(path, 0u);
28         if (scene == NULL) {
29                 fprintf(stderr, "Asset import failed at file %s\n", path); // TODO factor logging the heck outta here
30         }
31         return scene;
32         // TODO aiReleaseImport(scene);
33 }