}
}
// add missing new chunks
+ GenerateSurrounding(base);
+}
+
+void ChunkLoader::GenerateSurrounding(const Chunk::Pos &pos) {
const Chunk::Pos offset(load_dist, load_dist, load_dist);
- Generate(base - offset, base + offset);
+ Generate(pos - offset, pos + offset);
}
void ChunkLoader::Update() {
ChunkLoader(const BlockTypeRegistry &, const Generator &);
void Generate(const Chunk::Pos &from, const Chunk::Pos &to);
+ void GenerateSurrounding(const Chunk::Pos &);
std::list<Chunk> &Loaded() { return loaded; }
player = &AddEntity();
player->Position({ 4.0f, 4.0f, 4.0f });
- chunks.Generate({ -4, -4, -4 }, { 5, 5, 5});
+ chunks.GenerateSurrounding(player->ChunkCoords());
}