mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Avoid extra StructureBlock clones in layer/tree.rs
This commit is contained in:
parent
dd6e6ccf91
commit
475ae65d16
@ -271,19 +271,24 @@ pub fn apply_trees_to(
|
|||||||
})
|
})
|
||||||
.sum(),
|
.sum(),
|
||||||
) + Vec3::unit_z() * (wpos.z - tree.pos.z);
|
) + Vec3::unit_z() * (wpos.z - tree.pos.z);
|
||||||
|
let sblock;
|
||||||
block_from_structure(
|
block_from_structure(
|
||||||
info.index(),
|
info.index(),
|
||||||
&if let Some(block) = match &tree.model {
|
if let Some(block) = match &tree.model {
|
||||||
TreeModel::Structure(s) => s.get(model_pos).ok().cloned(),
|
TreeModel::Structure(s) => s.get(model_pos).ok(),
|
||||||
TreeModel::Procedural(t, leaf_block) => Some(
|
TreeModel::Procedural(t, leaf_block) => Some(
|
||||||
match t.is_branch_or_leaves_at(model_pos.map(|e| e as f32 + 0.5)) {
|
match t.is_branch_or_leaves_at(model_pos.map(|e| e as f32 + 0.5)) {
|
||||||
(_, _, true, _) => {
|
(_, _, true, _) => {
|
||||||
StructureBlock::Filled(BlockKind::Wood, Rgb::new(150, 98, 41))
|
sblock = StructureBlock::Filled(
|
||||||
|
BlockKind::Wood,
|
||||||
|
Rgb::new(150, 98, 41),
|
||||||
|
);
|
||||||
|
&sblock
|
||||||
},
|
},
|
||||||
(_, _, _, true) => StructureBlock::None,
|
(_, _, _, true) => &StructureBlock::None,
|
||||||
(true, _, _, _) => t.config.trunk_block.clone(),
|
(true, _, _, _) => &t.config.trunk_block,
|
||||||
(_, true, _, _) => leaf_block.clone(),
|
(_, true, _, _) => &leaf_block,
|
||||||
_ => StructureBlock::None,
|
_ => &StructureBlock::None,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
} {
|
} {
|
||||||
|
Loading…
Reference in New Issue
Block a user