]> git.localhorst.tv Git - blank.git/blob - src/world.hpp
get world seed from command line arguments
[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         explicit World(unsigned int seed);
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 &PlayerChunk();
36         Chunk &Next(const Chunk &to, const glm::tvec3<int> &dir);
37
38         void Update(int dt);
39
40         void Render(DirectionalLighting &);
41
42 private:
43         BlockTypeRegistry blockType;
44         CuboidShape blockShape;
45         StairShape stairShape;
46         CuboidShape slabShape;
47
48         Generator generate;
49         ChunkLoader chunks;
50
51         Entity *player;
52         std::list<Entity> entities;
53
54 };
55
56 }
57
58 #endif