1 #ifndef BLANK_WORLD_WORLD_HPP_
2 #define BLANK_WORLD_WORLD_HPP_
4 #include "BlockTypeRegistry.hpp"
5 #include "ChunkLoader.hpp"
7 #include "Generator.hpp"
8 #include "../model/shapes.hpp"
12 #include <glm/glm.hpp>
24 // initial player position
25 glm::vec3 spawn = { 0.0f, 0.0f, 0.0f };
26 // direction facing towards(!) the light
27 glm::vec3 light_direction = { -1.0f, -3.0f, -2.0f };
28 // fade out reaches 1/e (0.3679) at 1/fog_density,
29 // gets less than 0.01 at e/(2 * fog_density)
30 // I chose 0.011 because it yields 91 and 124 for those, so
31 // slightly less than 6 and 8 chunks
32 float fog_density = 0.011f;
34 Generator::Config gen = Generator::Config();
35 ChunkLoader::Config load = ChunkLoader::Config();
38 explicit World(const Config &);
48 bool Intersection(const Entity &e, std::vector<WorldCollision> &);
49 void Resolve(Entity &e, std::vector<WorldCollision> &);
51 BlockTypeRegistry &BlockTypes() { return blockType; }
53 Entity &Player() { return *player; }
54 Entity &AddEntity() { entities.emplace_back(); return entities.back(); }
57 Chunk &Next(const Chunk &to, const glm::tvec3<int> &dir);
61 void Render(Viewport &);
64 BlockTypeRegistry blockType;
65 CuboidShape blockShape;
66 StairShape stairShape;
67 CuboidShape slabShape;
73 std::list<Entity> entities;
75 glm::vec3 light_direction;