Added redwoods

This commit is contained in:
Joshua Barretto 2022-03-02 19:04:34 +00:00 committed by IsseW
parent 1392a8662f
commit 68df88a721
2 changed files with 44 additions and 2 deletions

View File

@ -12,6 +12,7 @@ pub enum ForestKind {
Chestnut,
Cedar,
Pine,
Redwood,
Birch,
Mangrove,
Giant,
@ -36,6 +37,7 @@ impl ForestKind {
ForestKind::Chestnut => 0.35..1.5,
ForestKind::Cedar => 0.275..1.45,
ForestKind::Pine => 0.2..1.4,
ForestKind::Redwood => 0.6..1.0,
ForestKind::Frostpine => 0.2..1.4,
ForestKind::Birch => 0.0..0.6,
ForestKind::Mangrove => 0.5..1.3,
@ -54,6 +56,7 @@ impl ForestKind {
ForestKind::Chestnut => -0.35..0.45,
ForestKind::Cedar => -0.65..0.15,
ForestKind::Pine => -0.85..-0.2,
ForestKind::Redwood => -0.5..-0.3,
ForestKind::Frostpine => -1.8..-0.8,
ForestKind::Birch => -0.7..0.25,
ForestKind::Mangrove => 0.35..1.6,
@ -81,6 +84,7 @@ impl ForestKind {
ForestKind::Chestnut => 0.3,
ForestKind::Cedar => 0.3,
ForestKind::Pine => 1.0,
ForestKind::Redwood => 2.5,
ForestKind::Frostpine => 1.0,
ForestKind::Birch => 0.65,
ForestKind::Mangrove => 2.0,

View File

@ -177,6 +177,19 @@ pub fn apply_trees_to(
StructureBlock::PineLeaves,
);
},
ForestKind::Redwood => {
break 'model TreeModel::Procedural(
ProceduralTree::generate(
TreeConfig::redwood(
&mut RandomPerm::new(seed),
scale,
calendar,
),
&mut RandomPerm::new(seed),
),
StructureBlock::PineLeaves,
);
},
ForestKind::Birch => {
break 'model TreeModel::Procedural(
ProceduralTree::generate(
@ -641,10 +654,10 @@ impl TreeConfig {
branch_child_radius_lerp: false,
leaf_radius: 1.9..2.1,
leaf_radius_scaled: 1.5 * log_scale,
straightness: 0.0,
straightness: -0.25,
max_depth: 1,
splits: 34.0 * scale..35.0 * scale,
split_range: 0.165..1.2,
split_range: 0.2..1.2,
branch_len_bias: 0.75,
leaf_vertical_scale: 0.3,
proportionality: 1.0,
@ -658,6 +671,31 @@ impl TreeConfig {
}
}
pub fn redwood(rng: &mut impl Rng, scale: f32, calendar: Option<&Calendar>) -> Self {
let scale = scale * (1.0 + rng.gen::<f32>().powi(4) * 0.5);
let log_scale = 1.0 + scale.log2().max(0.0);
Self {
trunk_len: 80.0 * scale,
trunk_radius: 3.25 * scale,
branch_child_len: 0.25 / scale,
branch_child_radius: 0.0,
branch_child_radius_lerp: false,
leaf_radius: 2.0..3.0,
leaf_radius_scaled: 1.5 * log_scale,
straightness: -0.3,
max_depth: 1,
splits: 45.0 * scale..50.0 * scale,
split_range: 0.45..1.2,
branch_len_bias: 0.75,
leaf_vertical_scale: 0.45,
proportionality: 1.0,
inhabited: false,
hanging_sprites: &[(0.001, SpriteKind::Beehive)],
trunk_block: StructureBlock::Filled(BlockKind::Wood, Rgb::new(110, 55, 10)),
}
}
pub fn giant(_rng: &mut impl Rng, scale: f32, inhabited: bool) -> Self {
let log_scale = 1.0 + scale.log2().max(0.0);