]> git.localhorst.tv Git - blank.git/blob - src/world.hpp
split chunk loader from world
[blank.git] / src / world.hpp
1 #ifndef BLANK_WORLD_HPP_
2 #define BLANK_WORLD_HPP_
3
4 #include "block.hpp"
5 #include "chunk.hpp"
6 #include "entity.hpp"
7 #include "generator.hpp"
8 #include "shader.hpp"
9 #include "shape.hpp"
10
11 #include <glm/glm.hpp>
12
13
14 namespace blank {
15
16 class World {
17
18 public:
19         World();
20
21         bool Intersection(
22                 const Ray &,
23                 const glm::mat4 &M,
24                 Chunk **chunk = nullptr,
25                 int *blkid = nullptr,
26                 float *dist = nullptr,
27                 glm::vec3 *normal = nullptr);
28
29         BlockTypeRegistry &BlockTypes() { return blockType; }
30
31         Entity &Player() { return player; }
32
33         Chunk &Next(const Chunk &to, const glm::tvec3<int> &dir);
34
35         void Update(int dt);
36
37         void Render(DirectionalLighting &);
38
39 private:
40         BlockTypeRegistry blockType;
41         CuboidShape blockShape;
42         StairShape stairShape;
43         CuboidShape slabShape;
44
45         Generator generate;
46         ChunkLoader chunks;
47
48         Entity player;
49
50 };
51
52 }
53
54 #endif