Compare commits

..

2 Commits

10 changed files with 14 additions and 10 deletions

View File

@@ -9,10 +9,10 @@ public:
virtual ChunkGenerator& get_chunk_generator() = 0;
virtual void build_biome() = 0;
virtual void build_vegetation() = 0;
void ocean_water_build();
protected:
void build_bottom();
void place_grass();
void ocean_water_build();
};
} // namespace Cubed

View File

@@ -45,6 +45,7 @@ public:
Chunk& chunk();
Random& random();
const std::array<BiomeType, 8>& neighbor_biome() const;
void ocean_build();
void generate_cave();
void generate_river();

View File

@@ -27,7 +27,6 @@ void DesertBuilder::build_blocks() {
}
}
}
ocean_water_build();
}
void DesertBuilder::build_vegetation() {}

View File

@@ -32,7 +32,6 @@ void ForestBuilder::build_blocks() {
m_blocks[Chunk::index(x, height, z)] = 1;
}
}
ocean_water_build();
}
void ForestBuilder::build_vegetation() {

View File

@@ -23,7 +23,6 @@ void MountainBuilder::build_blocks() {
}
}
}
ocean_water_build();
}
void MountainBuilder::build_vegetation() {}

View File

@@ -23,7 +23,6 @@ void OceanBuilder::build_blocks() {
}
}
}
ocean_water_build();
}
void OceanBuilder::build_vegetation() {}

View File

@@ -27,7 +27,6 @@ void PlainBuilder::build_blocks() {
m_blocks[Chunk::index(x, height, z)] = 1;
}
}
ocean_water_build();
}
void PlainBuilder::build_vegetation() { place_grass(); }

View File

@@ -27,7 +27,6 @@ void SnowyPlainBuilder::build_blocks() {
m_blocks[Chunk::index(x, height, z)] = 8;
}
}
ocean_water_build();
}
void SnowyPlainBuilder::build_vegetation() {}

View File

@@ -199,9 +199,8 @@ void Chunk::gen_phase_six(
Logger::error("ChunkGenerator is Nullptr");
return;
}
// m_generator->blend_surface_blocks_borders(neighbor_block);
m_generator->generate_cave();
m_generator->generate_river();
// This must be fully completed before any other operations can proceed!
m_generator->blend_surface_blocks_borders(neighbor_block);
}
void Chunk::gen_phase_seven() {
@@ -209,6 +208,10 @@ void Chunk::gen_phase_seven() {
Logger::error("ChunkGenerator is Nullptr");
return;
}
m_generator->ocean_build();
m_generator->generate_river();
m_generator->generate_cave();
m_generator->generate_vegetation();
mark_dirty();
m_generator = nullptr;

View File

@@ -635,6 +635,8 @@ void ChunkGenerator::make_biome_builder() {
}
}
void ChunkGenerator::ocean_build() { m_biome_builder->ocean_water_build(); }
void ChunkGenerator::generate_cave() {
auto& cave_carver = m_chunk.world().cave_carcer();
auto& paths = cave_carver.paths();
@@ -688,6 +690,10 @@ void ChunkGenerator::generate_cave() {
if (blocks[Chunk::index(x, y, z)] == 7) {
continue;
}
if (y < WORLD_SIZE_Y - 1 &&
blocks[Chunk::index(x, y + 1, z)] == 7) {
continue;
}
blocks[Chunk::index(x, y, z)] = 0;
}
}