]> git.lizzy.rs Git - shadowclad.git/blob - level.h
Apply all transforms in 3D assets during import
[shadowclad.git] / level.h
1 #ifndef LEVEL_H_
2 #define LEVEL_H_
3
4 #include <stdint.h>
5
6 #include "assimp_types.h"
7
8 #include "tga.h"
9
10 typedef enum {
11         BLOCKTYPE_SPACE,
12         BLOCKTYPE_OBSTACLE_X,
13         BLOCKTYPE_OBSTACLE_Z,
14         BLOCKTYPE_OBSTACLE
15 } BlockType;
16
17 typedef struct {
18         const BlockType type;
19         const AiScene* sceneData;
20         GLuint* textureIds;
21 } Block;
22
23 typedef struct {
24         int width;
25         int depth;
26         Block** blocks;
27 } BlockGrid;
28
29 #define BLOCKGRID_CELL_SIZE 2.5f
30
31 BlockGrid levelGrid;
32
33 void initLevel();
34 void buildLevelFromImage(TgaImage* image);
35 const AiScene* importScene(const char* path);
36
37 static inline Block* getBlockFromGrid(BlockGrid grid, int x, int z) {
38         return grid.blocks[(z * grid.width) + x];
39 }
40
41 #endif