fix layers generation

This commit is contained in:
MihailRis 2024-08-23 23:29:40 +03:00
parent f413a6f0ac
commit 54067d0ab2
2 changed files with 7 additions and 6 deletions

View File

@ -40,7 +40,7 @@ static inline void generate_pole(
} else {
layerHeight += layerExtension;
}
layerHeight = std::min(static_cast<uint>(layerHeight), y);
layerHeight = std::min(static_cast<uint>(layerHeight), y+1);
for (uint i = 0; i < layerHeight; i++, y--) {
voxels[vox_index(x, y, z)].id = layer.rt.id;

View File

@ -26,17 +26,18 @@ struct ChunkPrototype {
/// @brief High-level world generation controller
class WorldGenerator {
/// @param def generator definition
const GeneratorDef& def;
/// @param content world content
const Content* content;
/// @param seed world seed
uint64_t seed;
std::vector<std::unique_ptr<ChunkPrototype>> chunks;
/// @brief Generate chunk prototype (see ChunkPrototype)
/// @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);
public:
/// @param def generator definition
/// @param content world content
/// @param seed world seed
WorldGenerator(
const GeneratorDef& def,
const Content* content,