From dbcecbdb927a5f31bbc1b7f734ec64e5af0bc062 Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Mon, 15 Feb 2021 00:58:58 +0000 Subject: [PATCH] More varied cliff placement --- world/src/block/mod.rs | 2 +- world/src/column/mod.rs | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/world/src/block/mod.rs b/world/src/block/mod.rs index 0a08ecc6ed..b193f09ffa 100644 --- a/world/src/block/mod.rs +++ b/world/src/block/mod.rs @@ -121,7 +121,7 @@ impl<'a> BlockGen<'a> { if stone_factor >= 0.5 { if wposf.z as f32 > height - cliff_offset.max(0.0) { - if cliff_offset.max(0.0) > cliff_height - (FastNoise::new(37).get(wposf / Vec3::new(6.0, 6.0, 10.0)) * 0.5 + 0.5) * (height - wposf.z as f32).mul(0.25).clamped(0.0, 6.0) { + if cliff_offset.max(0.0) > cliff_height - (FastNoise::new(37).get(wposf / Vec3::new(6.0, 6.0, 10.0)) * 0.5 + 0.5) * (height - grass_depth - wposf.z as f32).mul(0.25).clamped(0.0, 8.0) { Some(Block::empty()) } else { let col = Lerp::lerp( diff --git a/world/src/column/mod.rs b/world/src/column/mod.rs index fe0e01187b..dab7a5b328 100644 --- a/world/src/column/mod.rs +++ b/world/src/column/mod.rs @@ -266,18 +266,17 @@ impl<'a> Sampler<'a> for ColumnGen<'a> { }); // Cliffs - let cliff_height = - sim.get_interpolated(wpos, |chunk| chunk.cliff_height)?; let cliff_factor = (alt - + self.sim.gen_ctx.hill_nz.get(wposf.div(32.0).into_array()) as f32 * 8.0 + + self.sim.gen_ctx.hill_nz.get(wposf.div(64.0).into_array()) as f32 * 8.0 + self.sim.gen_ctx.hill_nz.get(wposf.div(256.0).into_array()) as f32 * 64.0) .rem_euclid(128.0) / 64.0 - 1.0; - let cliff_scale = ((self.sim.gen_ctx.hill_nz.get(wposf.div(128.0).into_array()) * 2.0 - 1.0) - + self.sim.gen_ctx.hill_nz.get(wposf.div(48.0).into_array()) * 0.1 - + 0.5) - .max(0.0) as f32; + let cliff_scale = ((self.sim.gen_ctx.hill_nz.get(wposf.div(128.0).into_array()) * 2.0 + 1.0) + + self.sim.gen_ctx.hill_nz.get(wposf.div(48.0).into_array()) * 0.1) + .clamped(0.0, 1.0) as f32; + let cliff_height = + sim.get_interpolated(wpos, |chunk| chunk.cliff_height)? * cliff_scale; let cliff = if cliff_factor < 0.0 { cliff_factor.abs().powf(1.5) } else {