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 "../graphics/ArrayTexture.hpp"
12 #include <glm/glm.hpp>
25 // initial player position
26 glm::vec3 spawn = { 0.0f, 0.0f, 0.0f };
27 // direction facing towards(!) the light
28 glm::vec3 light_direction = { -1.0f, -3.0f, -2.0f };
29 // fade out reaches 1/e (0.3679) at 1/fog_density,
30 // gets less than 0.01 at e/(2 * fog_density)
31 // I chose 0.011 because it yields 91 and 124 for those, so
32 // slightly less than 6 and 8 chunks
33 float fog_density = 0.011f;
35 Generator::Config gen = Generator::Config();
36 ChunkLoader::Config load = ChunkLoader::Config();
39 World(const Assets &, const Config &, const WorldSave &);
49 bool Intersection(const Entity &e, std::vector<WorldCollision> &);
50 void Resolve(Entity &e, std::vector<WorldCollision> &);
52 BlockTypeRegistry &BlockTypes() noexcept { return block_type; }
53 ChunkLoader &Loader() noexcept { return chunks; }
55 Entity &Player() { return *player; }
56 Entity &AddEntity() { entities.emplace_back(); return entities.back(); }
59 Chunk &Next(const Chunk &to, const glm::ivec3 &dir);
63 void Render(Viewport &);
66 BlockTypeRegistry block_type;
68 ArrayTexture block_tex;
74 std::list<Entity> entities;
76 glm::vec3 light_direction;