From 6067c9a1f5bd4e30972fa5fe990cc9c0b5437708 Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Fri, 31 May 2019 22:27:34 +0100 Subject: [PATCH] Made caves wider --- world/src/sim.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/world/src/sim.rs b/world/src/sim.rs index 572b66df4a..367a0f52fe 100644 --- a/world/src/sim.rs +++ b/world/src/sim.rs @@ -201,13 +201,14 @@ impl<'a> Sampler<'a> { ); // Caves - let cave_xy = (sim.gen_ctx.cave_0_nz.get(Vec3::new(wposf.x, wposf.y, alt as f64 * 8.0).div(800.0).into_array()) as f32) + let cave_at = |wposf: Vec2| (sim.gen_ctx.cave_0_nz.get(Vec3::new(wposf.x, wposf.y, alt as f64 * 8.0).div(800.0).into_array()) as f32) .powf(2.0) .neg() .add(1.0) .mul((1.15 - chaos).min(1.0)); - let cave_alt = alt - 24.0 - + (sim.gen_ctx.cave_1_nz.get(Vec2::new(wposf.x, wposf.y).div(32.0).into_array()) as f32) * 6.0 + let cave_xy = cave_at(wposf).min(cave_at(-wposf)); + let cave_alt = alt - 32.0 + + (sim.gen_ctx.cave_1_nz.get(Vec2::new(wposf.x, wposf.y).div(48.0).into_array()) as f32) * 8.0 + (sim.gen_ctx.cave_1_nz.get(Vec2::new(wposf.x, wposf.y).div(300.0).into_array()) as f32).add(1.0).mul(0.5).powf(8.0).mul(256.0); Some(Sample2d { @@ -268,7 +269,7 @@ impl<'a> Sampler<'a> { .get((wposf.div(Vec3::new(120.0, 120.0, 150.0))).into_array()) as f32) .mul((chaos - 0.1).max(0.0)) - .mul(90.0); + .mul(110.0); let height = alt + warp; let temp = 0.0; @@ -295,7 +296,7 @@ impl<'a> Sampler<'a> { }; let ground_block = if let Some(block) = ground_block { // Underground - let cave = cave_xy.powf(2.0) * (wposf.z as f32 - cave_alt).div(40.0).powf(4.0).neg().add(1.0) > 0.9996; + let cave = cave_xy.powf(2.0) * (wposf.z as f32 - cave_alt).div(40.0).powf(4.0).neg().add(1.0) > 0.9993; if cave { None