]> git.localhorst.tv Git - blank.git/blob - src/world.hpp
drawable entity with angular velocity
[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 <list>
12 #include <glm/glm.hpp>
13
14
15 namespace blank {
16
17 class World {
18
19 public:
20         World();
21
22         bool Intersection(
23                 const Ray &,
24                 const glm::mat4 &M,
25                 Chunk **chunk = nullptr,
26                 int *blkid = nullptr,
27                 float *dist = nullptr,
28                 glm::vec3 *normal = nullptr);
29
30         BlockTypeRegistry &BlockTypes() { return blockType; }
31
32         Entity &Player() { return *player; }
33         Entity &AddEntity() { entities.emplace_back(); return entities.back(); }
34
35         Chunk &Next(const Chunk &to, const glm::tvec3<int> &dir);
36
37         void Update(int dt);
38
39         void Render(DirectionalLighting &);
40
41 private:
42         BlockTypeRegistry blockType;
43         CuboidShape blockShape;
44         StairShape stairShape;
45         CuboidShape slabShape;
46
47         Generator generate;
48         ChunkLoader chunks;
49
50         Entity *player;
51         std::list<Entity> entities;
52
53 };
54
55 }
56
57 #endif