mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-06-18 00:27:02 +08:00
* fix: correct snowy grass block texture * refactor: river generation * fix: water placement error due to interpolation * perf: improve river naturalness * feat: add river tab item * fix: path truncation
62 lines
1.8 KiB
C++
62 lines
1.8 KiB
C++
#include "Cubed/gameplay/builders/river_builder.hpp"
|
|
|
|
#include "Cubed/gameplay/chunk_generator.hpp"
|
|
namespace Cubed {
|
|
RiverBuilder::RiverBuilder(ChunkGenerator& chunk_generator)
|
|
: m_chunk_generator(chunk_generator) {}
|
|
|
|
void RiverBuilder::build_biome() {
|
|
BiomeBuilder::build_bottom();
|
|
build_blocks();
|
|
};
|
|
|
|
void RiverBuilder::build_blocks() {
|
|
/*
|
|
auto& m_chunk = m_chunk_generator.chunk();
|
|
auto& m_blocks = m_chunk.blocks();
|
|
auto& m_heightmap = m_chunk.heightmap();
|
|
for (int x = 0; x < CHUNK_SIZE; x++) {
|
|
for (int z = 0; z < CHUNK_SIZE; z++) {
|
|
int height = static_cast<int>(m_heightmap[x][z]);
|
|
for (int y = 5; y < height - 5; y++) {
|
|
m_blocks[Chunk::index(x, y, z)] = 3;
|
|
}
|
|
for (int y = height - 5; y <= height - 1; y++) {
|
|
m_blocks[Chunk::index(x, y, z)] = 2;
|
|
}
|
|
for (int y = height; y <= height; y++) {
|
|
if (y >= SEA_LEVEL - 1) {
|
|
m_blocks[Chunk::index(x, y, z)] = 1;
|
|
} else {
|
|
m_blocks[Chunk::index(x, y, z)] = 2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
*/
|
|
}
|
|
|
|
void RiverBuilder::build_vegetation() {
|
|
/*
|
|
auto& m_chunk = m_chunk_generator.chunk();
|
|
auto& m_blocks = m_chunk.blocks();
|
|
auto& m_heightmap = m_chunk.heightmap();
|
|
for (int x = 0; x < SIZE_X; x++) {
|
|
for (int z = 0; z < SIZE_Z; z++) {
|
|
int height = static_cast<int>(m_heightmap[x][z]);
|
|
if (height >= SEA_LEVEL) {
|
|
continue;
|
|
}
|
|
for (int y = height + 1; y < SEA_LEVEL; y++) {
|
|
m_blocks[Chunk::index(x, y, z)] = 7;
|
|
}
|
|
}
|
|
}
|
|
*/
|
|
}
|
|
|
|
ChunkGenerator& RiverBuilder::get_chunk_generator() {
|
|
return m_chunk_generator;
|
|
};
|
|
|
|
} // namespace Cubed
|