]> git.lizzy.rs Git - dragonblocks3d.git/blob - src/dragonblocks/map.hpp
Multithreading
[dragonblocks3d.git] / src / dragonblocks / map.hpp
1 #pragma once
2
3 #include <map>
4 #include "chunk.hpp"
5 #include "gl.hpp"
6
7 #define DRAGONBLOCKS_MAP_SIZE 1000
8
9 namespace dragonblocks
10 {
11         class BlockDef;
12         class Block;
13         class Mapgen;
14         class MeshGenMgr;
15         class Scene;
16         
17         class Map
18         {
19                 public:
20                 static glm::ivec3 getChunkPos(const glm::vec3 &);
21                 static glm::ivec3 getBlockPos(const glm::ivec3 &);
22                 static uint16_t getChunkPosHash(const glm::ivec3 &);
23                 
24                 const Block *getBlock(const glm::ivec3 &);
25                 const Block *getBlockRelativePos(Chunk *, const glm::ivec3 &);
26                 void setBlock(const glm::ivec3 &, BlockDef *);
27                 void createChunk(const glm::ivec3 &, const Chunk::Data &);
28                 void createChunk(const glm::ivec3 &);
29                 Chunk *getChunk(const glm::ivec3 &);
30                 void clear();
31                 
32                 Map(Mapgen *, MeshGenMgr *, Scene *);
33                 ~Map();
34                 
35                 private:
36                 std::map<uint16_t, Chunk*> chunks;
37                 Mapgen *mapgen;
38                 MeshGenMgr *mesh_gen_mgr;
39                 Scene *scene;
40         };
41 }