]> git.localhorst.tv Git - blank.git/blobdiff - src/world.hpp
get world seed from command line arguments
[blank.git] / src / world.hpp
index 461da5623f5874c7fae25e9923359eaa29e4ead5..bca1e0c082e190aadfe147abd2efcd7b852b69d5 100644 (file)
@@ -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"
 
@@ -17,9 +17,7 @@ namespace blank {
 class World {
 
 public:
-       World();
-
-       void Generate(const Chunk::Pos &from, const Chunk::Pos &to);
+       explicit World(unsigned int seed);
 
        bool Intersection(
                const Ray &,
@@ -30,38 +28,28 @@ public:
                glm::vec3 *normal = nullptr);
 
        BlockTypeRegistry &BlockTypes() { return blockType; }
-       std::list<Chunk> &LoadedChunks() { return loaded; }
 
-       Entity &Player() { return player; }
+       Entity &Player() { return *player; }
+       Entity &AddEntity() { entities.emplace_back(); return entities.back(); }
 
-       Chunk *ChunkLoaded(const Chunk::Pos &);
-       Chunk *ChunkQueued(const Chunk::Pos &);
-       Chunk *ChunkAvailable(const Chunk::Pos &);
-       Chunk &Next(const Chunk &, const glm::tvec3<int> &dir);
+       Chunk &PlayerChunk();
+       Chunk &Next(const Chunk &to, const glm::tvec3<int> &dir);
 
        void Update(int dt);
-       void CheckChunkGeneration();
 
        void Render(DirectionalLighting &);
 
-private:
-       void Generate(Chunk &);
-
 private:
        BlockTypeRegistry blockType;
        CuboidShape blockShape;
        StairShape stairShape;
        CuboidShape slabShape;
 
-       SimplexNoise blockNoise;
-       SimplexNoise colorNoise;
-
-       Entity player;
-       Chunk::Pos player_chunk;
+       Generator generate;
+       ChunkLoader chunks;
 
-       std::list<Chunk> loaded;
-       std::list<Chunk> to_generate;
-       std::list<Chunk> to_free;
+       Entity *player;
+       std::list<Entity> entities;
 
 };