X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld.hpp;h=b5c4a29cc66688f9c7a10b0a9150c71122c37718;hb=3072e2cd49ad1614100d1a1c73afe6a4888fb875;hp=8ef2b21b2b05ee7d7106a8af536e0a2bf36e85b4;hpb=cb959294a8271969ddfe411471d7f04e82c4788a;p=blank.git diff --git a/src/world.hpp b/src/world.hpp index 8ef2b21..b5c4a29 100644 --- a/src/world.hpp +++ b/src/world.hpp @@ -4,7 +4,7 @@ #include "block.hpp" #include "chunk.hpp" #include "entity.hpp" -#include "noise.hpp" +#include "generator.hpp" #include "shader.hpp" #include "shape.hpp" @@ -19,8 +19,6 @@ class World { public: World(); - void Generate(const glm::tvec3 &from, const glm::tvec3 &to); - bool Intersection( const Ray &, const glm::mat4 &M, @@ -30,32 +28,28 @@ public: glm::vec3 *normal = nullptr); BlockTypeRegistry &BlockTypes() { return blockType; } - std::list &LoadedChunks() { return loaded; } - Entity &Player() { return player; } + Entity &Player() { return *player; } + Entity &AddEntity() { entities.emplace_back(); return entities.back(); } - Chunk &Next(const Chunk &, const glm::vec3 &dir); + Chunk &PlayerChunk(); + Chunk &Next(const Chunk &to, const glm::tvec3 &dir); void Update(int dt); void Render(DirectionalLighting &); -private: - void Generate(Chunk &); - private: BlockTypeRegistry blockType; CuboidShape blockShape; StairShape stairShape; CuboidShape slabShape; - SimplexNoise blockNoise; - SimplexNoise colorNoise; - - Entity player; + Generator generate; + ChunkLoader chunks; - std::list loaded; - std::list to_generate; + Entity *player; + std::list entities; };