fix layers generation
This commit is contained in:
parent
f413a6f0ac
commit
54067d0ab2
@ -40,7 +40,7 @@ static inline void generate_pole(
|
|||||||
} else {
|
} else {
|
||||||
layerHeight += layerExtension;
|
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--) {
|
for (uint i = 0; i < layerHeight; i++, y--) {
|
||||||
voxels[vox_index(x, y, z)].id = layer.rt.id;
|
voxels[vox_index(x, y, z)].id = layer.rt.id;
|
||||||
|
|||||||
@ -26,17 +26,18 @@ struct ChunkPrototype {
|
|||||||
|
|
||||||
/// @brief High-level world generation controller
|
/// @brief High-level world generation controller
|
||||||
class WorldGenerator {
|
class WorldGenerator {
|
||||||
|
/// @param def generator definition
|
||||||
const GeneratorDef& def;
|
const GeneratorDef& def;
|
||||||
|
/// @param content world content
|
||||||
const Content* content;
|
const Content* content;
|
||||||
|
/// @param seed world seed
|
||||||
uint64_t 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);
|
std::unique_ptr<ChunkPrototype> generatePrototype(int x, int z);
|
||||||
public:
|
public:
|
||||||
/// @param def generator definition
|
|
||||||
/// @param content world content
|
|
||||||
/// @param seed world seed
|
|
||||||
WorldGenerator(
|
WorldGenerator(
|
||||||
const GeneratorDef& def,
|
const GeneratorDef& def,
|
||||||
const Content* content,
|
const Content* content,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user