mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Added Autumn ForestKind
This commit is contained in:
parent
43cbcf2514
commit
554e5b6c80
@ -35,6 +35,7 @@
|
||||
Baobab: [(start: (50, 100, 40), end: (50, 90, 0))],
|
||||
MapleLeaves: [(start: (103, 32, 21), end: (131, 24, 26)), (start: (96, 30, 44), end: (92, 9, 46))],
|
||||
CherryLeaves: [(start: (210, 109, 116), end: (217, 102, 102)), (start: (191, 128, 151), end: (206, 113, 123))]
|
||||
AutumnLeaves: [(start: (198, 87, 24), end: (184, 57, 15)), (start: (230, 151, 27), end: (213, 130, 20)), (start: (131, 23, 31), end: (115, 5, 31))],
|
||||
)
|
||||
|
||||
// Water blocks ignore color now so this isn't used, but just in case this color was worth
|
||||
|
@ -50,6 +50,7 @@ make_case_elim!(
|
||||
HaniwaKeyhole(consumes: String) = 30,
|
||||
MapleLeaves = 31,
|
||||
CherryLeaves = 32,
|
||||
AutumnLeaves = 33,
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -21,6 +21,7 @@ pub enum ForestKind {
|
||||
Dead,
|
||||
Mapletree,
|
||||
Cherry,
|
||||
AutumnTree,
|
||||
}
|
||||
|
||||
pub struct Environment {
|
||||
@ -47,6 +48,7 @@ impl ForestKind {
|
||||
ForestKind::Dead => 0.0..1.5,
|
||||
ForestKind::Mapletree => 0.65..1.25,
|
||||
ForestKind::Cherry => 0.45..0.75,
|
||||
ForestKind::AutumnTree => 0.25..0.65,
|
||||
_ => 0.0..0.0,
|
||||
}
|
||||
}
|
||||
@ -68,6 +70,7 @@ impl ForestKind {
|
||||
ForestKind::Dead => -1.5..1.0,
|
||||
ForestKind::Mapletree => -0.15..0.25,
|
||||
ForestKind::Cherry => -0.10..0.15,
|
||||
ForestKind::AutumnTree => -0.45..0.05,
|
||||
_ => 0.0..0.0,
|
||||
}
|
||||
}
|
||||
@ -98,6 +101,7 @@ impl ForestKind {
|
||||
ForestKind::Dead => 0.01,
|
||||
ForestKind::Mapletree => 0.65,
|
||||
ForestKind::Cherry => 12.0,
|
||||
ForestKind::AutumnTree => 125.0,
|
||||
_ => 0.0,
|
||||
}
|
||||
}
|
||||
@ -117,6 +121,7 @@ impl ForestKind {
|
||||
ForestKind::Swamp => 0.4,
|
||||
ForestKind::Mapletree => 0.4,
|
||||
ForestKind::Cherry => 0.3,
|
||||
ForestKind::AutumnTree => 0.4,
|
||||
_ => 1.0,
|
||||
}
|
||||
}
|
||||
|
@ -282,7 +282,8 @@ pub fn block_from_structure(
|
||||
| StructureBlock::Chestnut
|
||||
| StructureBlock::Baobab
|
||||
| StructureBlock::MapleLeaves
|
||||
| StructureBlock::CherryLeaves => {
|
||||
| StructureBlock::CherryLeaves
|
||||
| StructureBlock::AutumnLeaves => {
|
||||
let ranges = sblock
|
||||
.elim_case_pure(&index.colors.block.structure_blocks)
|
||||
.as_ref()
|
||||
|
@ -242,6 +242,15 @@ pub fn apply_trees_to(
|
||||
StructureBlock::CherryLeaves,
|
||||
);
|
||||
},
|
||||
ForestKind::AutumnTree => {
|
||||
break 'model TreeModel::Procedural(
|
||||
ProceduralTree::generate(
|
||||
TreeConfig::autumn_tree(&mut RandomPerm::new(seed), scale),
|
||||
&mut RandomPerm::new(seed),
|
||||
),
|
||||
StructureBlock::AutumnLeaves,
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
let models = models.read();
|
||||
@ -766,6 +775,31 @@ impl TreeConfig {
|
||||
trunk_block: StructureBlock::Filled(BlockKind::Wood, Rgb::new(69, 37, 17)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn autumn_tree(rng: &mut impl Rng, scale: f32) -> Self {
|
||||
let scale = scale * (0.8 + rng.gen::<f32>().powi(2) * 0.5);
|
||||
let log_scale = 1.0 + scale.log2().max(0.0);
|
||||
|
||||
Self {
|
||||
trunk_len: 9.0 * scale,
|
||||
trunk_radius: 2.0 * scale,
|
||||
branch_child_len: 0.9,
|
||||
branch_child_radius: 0.75,
|
||||
branch_child_radius_lerp: true,
|
||||
leaf_radius: 2.5 * log_scale..3.25 * log_scale,
|
||||
leaf_radius_scaled: 0.0,
|
||||
straightness: 0.45,
|
||||
max_depth: 4,
|
||||
splits: 2.25..3.25,
|
||||
split_range: 0.75..1.5,
|
||||
branch_len_bias: 0.0,
|
||||
leaf_vertical_scale: 1.0,
|
||||
proportionality: 0.0,
|
||||
inhabited: false,
|
||||
hanging_sprites: &[(0.0002, SpriteKind::Apple), (0.00007, SpriteKind::Beehive)],
|
||||
trunk_block: StructureBlock::Filled(BlockKind::Wood, Rgb::new(90, 45, 15)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Rename this to `Tree` when the name conflict is gone
|
||||
|
Loading…
Reference in New Issue
Block a user