]> git.localhorst.tv Git - blank.git/blobdiff - src/world.hpp
begun block lighting implementation
[blank.git] / src / world.hpp
index 4c7a59f4f607fae03c9ef297f5a4657466199d55..b5c4a29cc66688f9c7a10b0a9150c71122c37718 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"
 
@@ -19,8 +19,6 @@ class World {
 public:
        World();
 
-       void Generate(const glm::tvec3<int> &from, const glm::tvec3<int> &to);
-
        bool Intersection(
                const Ray &,
                const glm::mat4 &M,
@@ -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 glm::tvec3<int> &);
-       Chunk *ChunkQueued(const glm::tvec3<int> &);
-       Chunk *ChunkAvailable(const glm::tvec3<int> &);
-       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;
-       glm::tvec3<int> 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;
 
 };