From bddf070b54bdc6bf214ce21a32fcea290fd3d758 Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Thu, 25 Apr 2019 15:16:10 +0100 Subject: [PATCH] Mildly better worldgen Former-commit-id: e8d77b75b164611ccfd144b1d6e6d6c5e396e515 --- world/src/lib.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/world/src/lib.rs b/world/src/lib.rs index f8d4857c13..8b80766b49 100644 --- a/world/src/lib.rs +++ b/world/src/lib.rs @@ -32,7 +32,8 @@ impl World { let air = Block::empty(); let stone = Block::new(1, Rgb::new(200, 220, 255)); let grass = Block::new(2, Rgb::new(50, 255, 0)); - let sand = Block::new(3, Rgb::new(180, 150, 50)); + let dirt = Block::new(3, Rgb::new(128, 90, 0)); + let sand = Block::new(4, Rgb::new(180, 150, 50)); let perlin_nz = Perlin::new(); @@ -42,20 +43,20 @@ impl World { let freq = 1.0 / 128.0; let ampl = 32.0; - let small_freq = 1.0 / 16.0; - let small_ampl = 8.0; + let small_freq = 1.0 / 32.0; + let small_ampl = 6.0; let offs = 32.0; let height = perlin_nz.get(Vec2::from(wposf * freq).into_array()) * ampl + perlin_nz.get(Vec2::from(wposf * small_freq).into_array()) * small_ampl + offs; - chunk.set(lpos, if wposf.z < height { - if wposf.z < height - 1.0 { - stone - } else { - grass - } + chunk.set(lpos, if wposf.z < height - 4.0 { + stone + } else if wposf.z < height - 1.0 { + dirt + } else if wposf.z < height { + grass } else { air }).unwrap();