diff --git a/world/src/block/mod.rs b/world/src/block/mod.rs index e9e40d8ab8..073b390f28 100644 --- a/world/src/block/mod.rs +++ b/world/src/block/mod.rs @@ -1,7 +1,7 @@ use crate::{ column::{ColumnGen, ColumnSample}, util::{FastNoise, RandomField, RandomPerm, Sampler, SmallCache}, - IndexRef, + IndexRef, CONFIG, }; use common::{ calendar::{Calendar, CalendarEvent}, @@ -211,7 +211,7 @@ impl<'a> BlockGen<'a> { // Water if over_water && (wposf.z as f32 - water_height).abs() < ice_depth { // TODO: Ice block - Some(Block::new(BlockKind::WeakRock, Rgb::new(200, 225, 255))) + Some(Block::new(BlockKind::WeakRock, CONFIG.ice_color)) } else if (wposf.z as f32) < water_height { // Ocean Some(water) diff --git a/world/src/column/mod.rs b/world/src/column/mod.rs index 5a3a4fd6bb..e54de9d2c1 100644 --- a/world/src/column/mod.rs +++ b/world/src/column/mod.rs @@ -1120,9 +1120,21 @@ impl<'a> Sampler<'a> for ColumnGen<'a> { let ice_depth = if snow_factor < -0.25 && water_vel.magnitude_squared() < (0.1f32 + marble_mid * 0.2).powi(2) { + let cliff = (sim.gen_ctx.hill_nz.get((wposf3d.div(180.0)).into_array()) as f32) + .add((marble_mid - 0.5) * 0.2) + .abs() + .powi(3) + .mul(32.0); + let cliff_ctrl = (sim.gen_ctx.hill_nz.get((wposf3d.div(128.0)).into_array()) as f32) + .sub(0.4) + .add((marble_mid - 0.5) * 0.2) + .mul(32.0) + .clamped(0.0, 1.0); + ((1.0 - Lerp::lerp(marble, Lerp::lerp(marble_mid, marble_small, 0.25), 0.5)) * 5.0 - 1.5) .max(0.0) + + cliff * cliff_ctrl } else { 0.0 }; diff --git a/world/src/config.rs b/world/src/config.rs index ce9a27c65b..2a4430885e 100644 --- a/world/src/config.rs +++ b/world/src/config.rs @@ -1,5 +1,6 @@ use common::assets; use serde::Deserialize; +use vek::*; pub struct Config { pub sea_level: f32, @@ -51,6 +52,8 @@ pub struct Config { /// Rough desired river width-to-depth ratio (in terms of horizontal chunk /// width / m, for some reason). Not exact. pub river_width_to_depth: f32, + /// TODO: Move to colors.ron when blockgen can access it + pub ice_color: Rgb, } pub const CONFIG: Config = Config { @@ -71,6 +74,7 @@ pub const CONFIG: Config = Config { river_max_width: 2.0, river_min_height: 0.25, river_width_to_depth: 8.0, + ice_color: Rgb::new(175, 200, 255), }; #[derive(Deserialize)] diff --git a/world/src/sim/map.rs b/world/src/sim/map.rs index c4599f12bd..77b3d79821 100644 --- a/world/src/sim/map.rs +++ b/world/src/sim/map.rs @@ -216,7 +216,7 @@ pub fn sample_pos( }; let rgb = if is_water && is_ice && column_data.map_or(false, |(_, _, ice_depth)| ice_depth > 0.0) { - Rgb::new(200, 225, 255) + CONFIG.ice_color } else { match (river_kind, (is_water, true_alt >= true_sea_level)) { (_, (false, _)) | (None, (_, true)) | (Some(RiverKind::River { .. }), _) => {