mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-22 06:48:43 -06:00
even better trees
This commit is contained in:
parent
f9b4628b49
commit
4a84fec041
|
@ -120,11 +120,13 @@ pub fn generate_world(chunk_position: IVec3, seed: u64) -> (BlockData, Vec<Queue
|
||||||
for tree_y in 0..tree_height {
|
for tree_y in 0..tree_height {
|
||||||
smart_place(&mut blocks, tree_pos + IVec3::Y * tree_y, Block::Wood);
|
smart_place(&mut blocks, tree_pos + IVec3::Y * tree_y, Block::Wood);
|
||||||
}
|
}
|
||||||
|
// Part that wraps around the tree
|
||||||
|
{
|
||||||
let tree_leaf_height = tree_height - 3;
|
let tree_leaf_height = tree_height - 3;
|
||||||
let tree_width = 2;
|
let leaf_width = 2;
|
||||||
for tree_y in tree_leaf_height..tree_height {
|
for tree_y in tree_leaf_height..tree_height {
|
||||||
for tree_x in (-tree_width)..=tree_width {
|
for tree_x in (-leaf_width)..=leaf_width {
|
||||||
for tree_z in (-tree_width)..=tree_width {
|
for tree_z in (-leaf_width)..=leaf_width {
|
||||||
let tree_offset = ivec3(tree_x, tree_y, tree_z);
|
let tree_offset = ivec3(tree_x, tree_y, tree_z);
|
||||||
if tree_offset.xz() == IVec2::ZERO { continue }
|
if tree_offset.xz() == IVec2::ZERO { continue }
|
||||||
smart_place(&mut blocks, tree_pos + tree_offset, Block::Leaf);
|
smart_place(&mut blocks, tree_pos + tree_offset, Block::Leaf);
|
||||||
|
@ -132,6 +134,20 @@ pub fn generate_world(chunk_position: IVec3, seed: u64) -> (BlockData, Vec<Queue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//part above the tree
|
||||||
|
{
|
||||||
|
let leaf_above_height = 2;
|
||||||
|
let leaf_width = 1;
|
||||||
|
for tree_y in tree_height..(tree_height + leaf_above_height) {
|
||||||
|
for tree_x in (-leaf_width)..=leaf_width {
|
||||||
|
for tree_z in (-leaf_width)..=leaf_width {
|
||||||
|
let tree_offset = ivec3(tree_x, tree_y, tree_z);
|
||||||
|
smart_place(&mut blocks, tree_pos + tree_offset, Block::Leaf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue