From 0b91f5ba90cab7606115514f964b2f443ba4f8a4 Mon Sep 17 00:00:00 2001 From: Joshua Yanovski Date: Mon, 18 Jul 2022 09:19:20 -0700 Subject: [PATCH] Fix paths (sorta) and rock moss. --- world/src/layer/mod.rs | 12 ++++++------ world/src/layer/rock.rs | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/world/src/layer/mod.rs b/world/src/layer/mod.rs index e06b7bd588..68b2f278bc 100644 --- a/world/src/layer/mod.rs +++ b/world/src/layer/mod.rs @@ -69,17 +69,17 @@ pub fn apply_paths_to(canvas: &mut Canvas) { // Try to use the column at the centre of the path for sampling to make them // flatter let col_pos = -info.wpos().map(|e| e as f32) + path_nearest; - let col00 = info.col(info.wpos() + col_pos.map(|e| e.floor() as i32) + Vec2::new(0, 0)); - let col10 = info.col(info.wpos() + col_pos.map(|e| e.floor() as i32) + Vec2::new(1, 0)); - let col01 = info.col(info.wpos() + col_pos.map(|e| e.floor() as i32) + Vec2::new(0, 1)); - let col11 = info.col(info.wpos() + col_pos.map(|e| e.floor() as i32) + Vec2::new(1, 1)); + let col00 = info.col_or_gen(info.wpos() + col_pos.map(|e| e.floor() as i32) + Vec2::new(0, 0)); + let col10 = info.col_or_gen(info.wpos() + col_pos.map(|e| e.floor() as i32) + Vec2::new(1, 0)); + let col01 = info.col_or_gen(info.wpos() + col_pos.map(|e| e.floor() as i32) + Vec2::new(0, 1)); + let col11 = info.col_or_gen(info.wpos() + col_pos.map(|e| e.floor() as i32) + Vec2::new(1, 1)); let col_attr = |col: &ColumnSample| { Vec3::new(col.riverless_alt, col.alt, col.water_dist.unwrap_or(1000.0)) }; let [riverless_alt, alt, water_dist] = match (col00, col10, col01, col11) { (Some(col00), Some(col10), Some(col01), Some(col11)) => Lerp::lerp( - Lerp::lerp(col_attr(col00), col_attr(col10), path_nearest.x.fract()), - Lerp::lerp(col_attr(col01), col_attr(col11), path_nearest.x.fract()), + Lerp::lerp(col_attr(&col00), col_attr(&col10), path_nearest.x.fract()), + Lerp::lerp(col_attr(&col01), col_attr(&col11), path_nearest.x.fract()), path_nearest.y.fract(), ), _ => col_attr(col), diff --git a/world/src/layer/rock.rs b/world/src/layer/rock.rs index a798015efc..bcbdbeb8ef 100644 --- a/world/src/layer/rock.rs +++ b/world/src/layer/rock.rs @@ -122,7 +122,6 @@ pub fn apply_rocks_to(canvas: &mut Canvas, _dynamic_rng: &mut impl Rng) { } */ /* let mut is_top = true; */ - let mut last_block = Block::empty(); (/*bounds*/aabb.min.x../*bounds*/aabb.max.x).for_each(|x| { (/*bounds*/aabb.min.y../*bounds*/aabb.max.y).for_each(|y| { let col = if let Some(col) = info.col(Vec2::new(x, y)) { @@ -131,6 +130,7 @@ pub fn apply_rocks_to(canvas: &mut Canvas, _dynamic_rng: &mut impl Rng) { // NOTE: Should never happen as we're always within the render area. return; }; + let mut last_block = Block::empty(); for z in (/*bounds*/aabb.min.z../*bounds*/aabb.max.z).rev() { let wpos = Vec3::new(x, y, z); let model_pos = wpos - rock.wpos;