From 29ecb14c45cc73eccb934717eb9b6b07219c5769 Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Wed, 12 Jun 2019 10:02:18 +0100 Subject: [PATCH] Added dirt/stone gradient --- world/src/block/mod.rs | 17 +++++++++++------ world/src/column/mod.rs | 2 +- world/src/sim/mod.rs | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/world/src/block/mod.rs b/world/src/block/mod.rs index d6a9895765..ecd4790eef 100644 --- a/world/src/block/mod.rs +++ b/world/src/block/mod.rs @@ -65,7 +65,7 @@ impl<'a> Sampler for BlockGen<'a> { .get((wposf.div(Vec3::new(150.0, 150.0, 150.0))).into_array()) as f32) .mul((chaos - 0.1).max(0.0)) - .mul(130.0); + .mul(115.0); let is_cliff = if cliff > 0.0 { (self.world.sim() @@ -99,20 +99,25 @@ impl<'a> Sampler for BlockGen<'a> { // Sample blocks + let stone_col = Rgb::new(200, 220, 255); + let dirt_col = Rgb::new(79, 67, 60); + let air = Block::empty(); - let stone = Block::new(2, Rgb::new(200, 220, 255)); + let stone = Block::new(2, stone_col); let surface_stone = Block::new(1, Rgb::new(200, 220, 255)); - let dirt = Block::new(1, Rgb::new(128, 90, 0)); + let dirt = Block::new(1, dirt_col); let sand = Block::new(1, Rgb::new(180, 150, 50)); let water = Block::new(1, Rgb::new(100, 150, 255)); let warm_stone = Block::new(1, Rgb::new(165, 165, 130)); let block = if (wposf.z as f32) < height - 3.0 { + let col = Lerp::lerp(dirt_col, stone_col, (height - 4.0 - wposf.z as f32) * 0.15); + // Underground - if (wposf.z as f32) > alt { - Some(surface_stone) + if (wposf.z as f32) > alt - 32.0 * chaos { + Some(Block::new(1, col)) } else { - Some(stone) + Some(Block::new(2, col)) } } else if (wposf.z as f32) < height { // Surface diff --git a/world/src/column/mod.rs b/world/src/column/mod.rs index 4664d2431c..f4d03294c9 100644 --- a/world/src/column/mod.rs +++ b/world/src/column/mod.rs @@ -79,7 +79,7 @@ impl<'a> Sampler for ColumnGen<'a> { Rgb::lerp( snow, grass, - temp.sub(CONFIG.snow_temp).sub(marble * 0.05).mul(256.0), + temp.sub(CONFIG.snow_temp).sub((marble - 0.5) * 0.05).mul(256.0), ), sand, temp.sub(CONFIG.desert_temp).mul(32.0), diff --git a/world/src/sim/mod.rs b/world/src/sim/mod.rs index 44829d60d9..a6fb4351c9 100644 --- a/world/src/sim/mod.rs +++ b/world/src/sim/mod.rs @@ -238,7 +238,7 @@ impl SimChunk { tree_density: (gen_ctx.tree_nz.get((wposf.div(1024.0)).into_array()) as f32) .add(1.0) .mul(0.5) - .mul(1.0 - chaos * 0.85) + .mul(1.2 - chaos * 0.85) .add(0.1) .mul(if alt > CONFIG.sea_level + 2.0 { 1.0 } else { 0.0 }), forest_kind: if temp > 0.0 {