diff options
Diffstat (limited to 'src/World/Generation/Decoration.cpp')
| -rw-r--r-- | src/World/Generation/Decoration.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/World/Generation/Decoration.cpp b/src/World/Generation/Decoration.cpp index bcabffa..556b5e7 100644 --- a/src/World/Generation/Decoration.cpp +++ b/src/World/Generation/Decoration.cpp @@ -45,7 +45,7 @@ void TreeDecorator::decorate_chunk(Chunk& chunk) { Pos last_tree = Pos::max(); for (UInt x = 0; x < Chunk::Width; x++) { for (UInt z = 0; z < Chunk::Width; z++) { - for (UInt y = Chunk::Height; y > 1; y--) { + for (UInt y = Chunk::Height - 1; y != 0; y--) { Pos pos{x, y, z}; if (!is_valid_position(pos)) continue; @@ -96,4 +96,16 @@ Bool TreeDecorator::is_valid_position(Vector<3, UInt> pos) { && pos.z() + tree_radius <= Chunk::Width; } +void DefaultLightDecorator::decorate_chunk(Chunk& chunk) { + for (UInt x = 0; x < Chunk::Width; x++) { + for (UInt z = 0; z < Chunk::Width; z++) { + for (UInt y = Chunk::Height - 1; y != 0; y--) { + auto& block = chunk.at(x, y, z); + if (!block.type.is_translucent()) break; + chunk.at(x, y, z).light = 200; + } + } + } +} + } |
