mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Specialised giant trees
This commit is contained in:
parent
abd1eec815
commit
185b1c3053
@ -275,7 +275,7 @@ void main() {
|
||||
vec3(0, 0, -2)
|
||||
) + vec3(sin(lifetime), sin(lifetime + 0.7), sin(lifetime * 0.5)) * 2.0,
|
||||
vec3(4),
|
||||
vec4(vec3(0.2 + rand7 * 0.2, 0.2 + (0.5 + rand6 * 0.5) * 0.6, 0) * (0.25 + rand1 * 0.5), 1),
|
||||
vec4(vec3(0.2 + rand7 * 0.2, 0.2 + (0.25 + rand6 * 0.5) * 0.3, 0) * (0.75 + rand1 * 0.5), 1),
|
||||
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3 + lifetime * 5)
|
||||
);
|
||||
} else if (inst_mode == SNOW) {
|
||||
|
@ -196,8 +196,8 @@ impl Block {
|
||||
#[inline]
|
||||
pub fn get_max_sunlight(&self) -> Option<u8> {
|
||||
match self.kind() {
|
||||
BlockKind::Water => Some(3),
|
||||
BlockKind::Leaves => Some(6),
|
||||
BlockKind::Water => Some(4),
|
||||
BlockKind::Leaves => Some(10),
|
||||
_ if self.is_opaque() => Some(0),
|
||||
_ => None,
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ pub enum ForestKind {
|
||||
Birch,
|
||||
Mangrove,
|
||||
Swamp,
|
||||
Giant,
|
||||
}
|
||||
|
||||
pub struct Environment {
|
||||
@ -25,26 +26,28 @@ impl ForestKind {
|
||||
pub fn humid_range(&self) -> Range<f32> {
|
||||
match self {
|
||||
ForestKind::Palm => 0.25..1.4,
|
||||
ForestKind::Acacia => 0.1..0.6,
|
||||
ForestKind::Acacia => 0.05..0.55,
|
||||
ForestKind::Baobab => 0.2..0.6,
|
||||
ForestKind::Oak => 0.5..1.5,
|
||||
ForestKind::Oak => 0.35..1.5,
|
||||
ForestKind::Pine => 0.2..1.4,
|
||||
ForestKind::Birch => 0.0..0.6,
|
||||
ForestKind::Mangrove => 0.7..1.3,
|
||||
ForestKind::Mangrove => 0.65..1.3,
|
||||
ForestKind::Swamp => 0.5..1.1,
|
||||
_ => 0.0..0.0
|
||||
}
|
||||
}
|
||||
|
||||
pub fn temp_range(&self) -> Range<f32> {
|
||||
match self {
|
||||
ForestKind::Palm => 0.4..1.6,
|
||||
ForestKind::Acacia => 0.4..1.6,
|
||||
ForestKind::Acacia => 0.3..1.6,
|
||||
ForestKind::Baobab => 0.4..0.9,
|
||||
ForestKind::Oak => -0.35..0.5,
|
||||
ForestKind::Oak => -0.35..0.6,
|
||||
ForestKind::Pine => -1.8..-0.2,
|
||||
ForestKind::Birch => -0.7..0.25,
|
||||
ForestKind::Mangrove => 0.4..1.6,
|
||||
ForestKind::Swamp => -0.6..0.8,
|
||||
_ => 0.0..0.0,
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,6 +70,7 @@ impl ForestKind {
|
||||
ForestKind::Birch => 0.65,
|
||||
ForestKind::Mangrove => 1.0,
|
||||
ForestKind::Swamp => 1.0,
|
||||
_ => 0.0,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,6 +124,15 @@ pub fn apply_trees_to(canvas: &mut Canvas) {
|
||||
ForestKind::Birch => *BIRCHES,
|
||||
ForestKind::Mangrove => *MANGROVE_TREES,
|
||||
ForestKind::Swamp => *SWAMP_TREES,
|
||||
ForestKind::Giant => {
|
||||
break 'model TreeModel::Procedural(
|
||||
ProceduralTree::generate(
|
||||
TreeConfig::giant(&mut RandomPerm::new(seed), scale),
|
||||
&mut RandomPerm::new(seed),
|
||||
),
|
||||
StructureBlock::TemperateLeaves,
|
||||
);
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
@ -283,12 +292,32 @@ impl TreeConfig {
|
||||
straightness: 0.0,
|
||||
max_depth: 1,
|
||||
splits: 50.0..70.0,
|
||||
split_range: 0.2..1.2,
|
||||
split_range: 0.1..1.2,
|
||||
branch_len_bias: 0.75,
|
||||
leaf_vertical_scale: 0.3,
|
||||
proportionality: 1.0,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn giant(rng: &mut impl Rng, scale: f32) -> Self {
|
||||
let scale = scale * (1.0 + rng.gen::<f32>().powi(4));
|
||||
let log_scale = 1.0 + scale.log2().max(0.0);
|
||||
|
||||
Self {
|
||||
trunk_len: 9.0 * scale,
|
||||
trunk_radius: 4.0 * scale,
|
||||
branch_child_len: 0.9,
|
||||
branch_child_radius: 0.7,
|
||||
leaf_radius: 1.5 * log_scale..2.0 * log_scale,
|
||||
straightness: 0.4,
|
||||
max_depth: (6.0 + log_scale) as usize,
|
||||
splits: 1.8..3.0,
|
||||
split_range: 0.8..1.5,
|
||||
branch_len_bias: 0.0,
|
||||
leaf_vertical_scale: 1.0,
|
||||
proportionality: 0.0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Rename this to `Tree` when the name conflict is gone
|
||||
|
@ -2017,7 +2017,7 @@ impl WorldSim {
|
||||
.enumerate()
|
||||
.map(|(i, fk)| {
|
||||
const CLUSTER_SIZE: f64 = 48.0;
|
||||
let nz = (FastNoise2d::new(i as u32).get(wpos.map(|e| e as f64) / CLUSTER_SIZE) + 1.0) / 2.0;
|
||||
let nz = (FastNoise2d::new(i as u32).get(pos.map(|e| e as f64) / CLUSTER_SIZE) + 1.0) / 2.0;
|
||||
(fk.proclivity(&env) * nz, fk)
|
||||
})
|
||||
.collect::<Vec<_>>())
|
||||
@ -2029,8 +2029,8 @@ impl WorldSim {
|
||||
.map(move |(pos, seed)| TreeAttr {
|
||||
pos,
|
||||
seed,
|
||||
scale: 4.0,
|
||||
forest_kind: ForestKind::Oak,
|
||||
scale: 5.0,
|
||||
forest_kind: ForestKind::Giant,
|
||||
});
|
||||
|
||||
normal_trees.chain(giant_trees)
|
||||
|
Loading…
Reference in New Issue
Block a user