refactor: terrain generation (#9)

* feat: add BlockType

* refactor: use fBM for heightmap generation

* feat: improve mountain realism

* refactor: adjust mountain spawn probability

* feat: add biome boundary blending

* refactor: remove resolve_biome_adjacency_conflict function

* feat: add snowy plain

* perf: speed up world generation

* refactor: lower overall terrain height
This commit is contained in:
zhenyan121
2026-05-23 10:33:52 +08:00
committed by GitHub
parent 1a26474a05
commit a54e87dbc6
28 changed files with 455 additions and 155 deletions

View File

@@ -2,6 +2,7 @@
#include "Cubed/constants.hpp"
#include "Cubed/gameplay/biome.hpp"
#include "Cubed/gameplay/block.hpp"
#include "Cubed/gameplay/builders/biome_builder.hpp"
#include "Cubed/tools/cubed_random.hpp"
@@ -36,7 +37,7 @@ public:
void generate_terrain_blocks();
// Adjust Block;
void blend_surface_blocks_borders(
const std::array<std::optional<std::vector<uint8_t>>, 4>&
const std::array<std::optional<std::vector<BlockType>>, 4>&
neighbor_block);
// Generate Structure
void generate_vegetation();
@@ -44,6 +45,7 @@ public:
Chunk& chunk();
Random& random();
const std::array<BiomeType, 8>& neighbor_biome() const;
void generate_cave();
private:
static inline std::atomic<bool> is_init{false};
@@ -57,7 +59,6 @@ private:
unsigned m_chunk_seed = 0;
void make_biome_builder();
void generate_cave();
};
} // namespace Cubed