More varied cliff placement

This commit is contained in:
Joshua Barretto 2021-02-15 00:58:58 +00:00
parent 7ea9e32acf
commit 81b93b548e
2 changed files with 7 additions and 8 deletions

View File

@ -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(

View File

@ -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 {