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"
11 #include <glm/glm.hpp>
17 class DirectionalLighting;
23 // initial player position
24 glm::vec3 spawn = { 4.0f, 4.0f, 4.0f };
25 // direction facing towards(!) the light
26 glm::vec3 light_direction = { -1.0f, -3.0f, -2.0f };
27 // fade out reaches 1/e (0.3679) at 1/fog_density,
28 // gets less than 0.01 at e/(2 * fog_density)
29 // I chose 0.011 because it yields 91 and 124 for those, so
30 // slightly less than 6 and 8 chunks
31 float fog_density = 0.011f;
33 Generator::Config gen = Generator::Config();
34 ChunkLoader::Config load = ChunkLoader::Config();
37 explicit World(const Config &);
42 Chunk **chunk = nullptr,
44 float *dist = nullptr,
45 glm::vec3 *normal = nullptr);
47 BlockTypeRegistry &BlockTypes() { return blockType; }
49 Entity &Player() { return *player; }
50 Entity &AddEntity() { entities.emplace_back(); return entities.back(); }
53 Chunk &Next(const Chunk &to, const glm::tvec3<int> &dir);
57 void Render(BlockLighting &, DirectionalLighting &);
60 BlockTypeRegistry blockType;
61 CuboidShape blockShape;
62 StairShape stairShape;
63 CuboidShape slabShape;
69 std::list<Entity> entities;
71 glm::vec3 light_direction;