diff --git a/world/src/block/mod.rs b/world/src/block/mod.rs index f1a7133d63..0fb4ab3396 100644 --- a/world/src/block/mod.rs +++ b/world/src/block/mod.rs @@ -379,9 +379,15 @@ impl<'a> ZCache<'a> { 0, |a, (st_info, st_sample)| { let bounds = st_info.volume.get_bounds(); - let min = Vec2::from(bounds.min + st_info.pos); - let max = Vec2::from(bounds.max + st_info.pos); - if (Aabr { min, max }).contains_point(self.wpos) { + let st_area = Aabr { + min: Vec2::from(bounds.min), + max: Vec2::from(bounds.max), + }; + + let rpos = self.wpos - st_info.pos; + let unit_rpos = st_info.units.0 * rpos.x + st_info.units.1 * rpos.y; + + if st_area.contains_point(unit_rpos) { a.max(bounds.max.z) } else { a diff --git a/world/src/column/mod.rs b/world/src/column/mod.rs index 7f2ee6724b..d7736999ec 100644 --- a/world/src/column/mod.rs +++ b/world/src/column/mod.rs @@ -78,7 +78,7 @@ impl<'a> Sampler for ColumnGen<'a> { let water_level = (riverless_alt - 4.0 - 5.0 * chaos).max(CONFIG.sea_level); let rock = (sim.gen_ctx.small_nz.get( - Vec3::new(wposf.x, wposf.y, alt as f64 * 3.0) + Vec3::new(wposf.x, wposf.y, alt as f64) .div(100.0) .into_array(), ) as f32) diff --git a/world/src/lib.rs b/world/src/lib.rs index 751cd6fd7c..2f0d76323c 100644 --- a/world/src/lib.rs +++ b/world/src/lib.rs @@ -76,7 +76,7 @@ impl World { let meta = TerrainChunkMeta::new(sim_chunk.get_name(&self.sim), sim_chunk.get_biome()); - let mut chunk = TerrainChunk::new(base_z - 8, stone, air, meta); + let mut chunk = TerrainChunk::new(base_z, stone, air, meta); let mut sampler = self.sample_blocks(); @@ -85,18 +85,6 @@ impl World { let wpos2d = Vec2::new(x, y) + Vec3::from(chunk_pos) * TerrainChunkSize::SIZE.map(|e| e as i32); - /* - let min_z = self - .sim - .get_interpolated(wpos2d, |chunk| chunk.get_min_z()) - .unwrap_or(0.0) as i32; - - let max_z = self - .sim - .get_interpolated(wpos2d, |chunk| chunk.get_max_z()) - .unwrap_or(0.0) as i32; - */ - let z_cache = match sampler.get_z_cache(wpos2d) { Some(z_cache) => z_cache, None => continue, @@ -104,7 +92,7 @@ impl World { let (min_z, max_z) = z_cache.get_z_limits(); - for z in base_z - 16..min_z as i32 { + for z in base_z..(min_z as i32).max(base_z) { let _ = chunk.set(Vec3::new(x, y, z), stone); } diff --git a/world/src/sim/mod.rs b/world/src/sim/mod.rs index 8e5e0daa93..5cb20482f9 100644 --- a/world/src/sim/mod.rs +++ b/world/src/sim/mod.rs @@ -423,7 +423,7 @@ impl SimChunk { && dryness > 0.05 && alt > CONFIG.sea_level + 5.0 && dryness.abs() > 0.075, - near_cliffs: cliff > 0.325, + near_cliffs: cliff > 0.3, tree_density: (gen_ctx.tree_nz.get((wposf.div(1024.0)).into_array()) as f32) .mul(1.5) .add(1.0) @@ -457,7 +457,7 @@ impl SimChunk { } pub fn get_base_z(&self) -> f32 { - self.alt - self.chaos * 50.0 + self.alt - self.chaos * 50.0 - 16.0 } pub fn get_name(&self, world: &WorldSim) -> Option {