split WorldGenerator::generatePrototype

This commit is contained in:
MihailRis
2024-08-24 07:56:54 +03:00
parent 4c697c0f46
commit a1129ccf38
3 changed files with 33 additions and 9 deletions
+14 -2
View File
@@ -13,15 +13,25 @@ struct GeneratorDef;
class Heightmap;
struct Biome;
enum class ChunkPrototypeLevel {
BIOME, HEIGHTMAP
};
struct ChunkPrototype {
ChunkPrototypeLevel level;
/// @brief chunk heightmap
std::shared_ptr<Heightmap> heightmap;
/// @brief chunk biomes matrix
std::vector<const Biome*> biomes;
ChunkPrototype(
std::shared_ptr<Heightmap> heightmap, std::vector<const Biome*> biomes
) : heightmap(std::move(heightmap)), biomes(std::move(biomes)) {};
ChunkPrototypeLevel level,
std::shared_ptr<Heightmap> heightmap,
std::vector<const Biome*> biomes
) : level(level),
heightmap(std::move(heightmap)),
biomes(std::move(biomes)) {};
};
/// @brief High-level world generation controller
@@ -37,6 +47,8 @@ class WorldGenerator {
/// @param x chunk position X divided by CHUNK_W
/// @param z chunk position Y divided by CHUNK_D
std::unique_ptr<ChunkPrototype> generatePrototype(int x, int z);
void generateHeightmap(ChunkPrototype* prototype, int x, int z);
public:
WorldGenerator(
const GeneratorDef& def,