mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 12:31:51 +00:00
add struct Biome & move generator-related scripting to scripting_world_generation.cpp
This commit is contained in:
parent
810519fb4d
commit
685cd414c4
5 changed files with 181 additions and 164 deletions
|
|
@ -33,6 +33,12 @@ struct BlocksLayers {
|
|||
uint lastLayersHeight;
|
||||
};
|
||||
|
||||
struct Biome {
|
||||
std::string name;
|
||||
BlocksLayers groundLayers;
|
||||
BlocksLayers seaLayers;
|
||||
};
|
||||
|
||||
/// @brief Generator behaviour and settings interface
|
||||
class GeneratorScript {
|
||||
public:
|
||||
|
|
@ -46,8 +52,7 @@ public:
|
|||
virtual std::shared_ptr<Heightmap> generateHeightmap(
|
||||
const glm::ivec2& offset, const glm::ivec2& size, uint64_t seed) = 0;
|
||||
|
||||
virtual const BlocksLayers& getGroundLayers() const = 0;
|
||||
virtual const BlocksLayers& getSeaLayers() const = 0;
|
||||
virtual const Biome& getBiome() const = 0;
|
||||
|
||||
virtual uint getSeaLevel() const = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -56,8 +56,9 @@ void WorldGenerator::generate(
|
|||
{chunkX * CHUNK_W, chunkZ * CHUNK_D}, {CHUNK_W, CHUNK_D}, seed
|
||||
);
|
||||
auto values = heightmap->getValues();
|
||||
const auto& groundLayers = def.script->getGroundLayers();
|
||||
const auto& seaLayers = def.script->getSeaLayers();
|
||||
const auto& biome = def.script->getBiome();
|
||||
const auto& groundLayers = biome.groundLayers;
|
||||
const auto& seaLayers = biome.seaLayers;
|
||||
|
||||
uint seaLevel = def.script->getSeaLevel();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue