add ChunkPrototype

This commit is contained in:
MihailRis
2024-08-23 12:07:38 +03:00
parent f40ff7cd28
commit f413a6f0ac
2 changed files with 43 additions and 11 deletions
+19 -1
View File
@@ -2,19 +2,37 @@
#include <string>
#include <memory>
#include <vector>
#include "constants.hpp"
#include "typedefs.hpp"
#include "voxels/voxel.hpp"
struct voxel;
class Content;
struct GeneratorDef;
class Heightmap;
struct Biome;
struct ChunkPrototype {
/// @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)) {};
};
/// @brief High-level world generation controller
class WorldGenerator {
const GeneratorDef& def;
const Content* content;
uint64_t seed;
std::vector<std::unique_ptr<ChunkPrototype>> chunks;
std::unique_ptr<ChunkPrototype> generatePrototype(int x, int z);
public:
/// @param def generator definition
/// @param content world content