More rocks near rivers

This commit is contained in:
Joshua Barretto 2022-05-15 18:31:24 +01:00
parent 6ace5adda6
commit 30b041282f
4 changed files with 9 additions and 13 deletions

View File

@ -58,9 +58,6 @@ impl<'a> BlockGen<'a> {
}
pub fn get_with_z_cache(&mut self, wpos: Vec3<i32>, z_cache: Option<&ZCache>) -> Option<Block> {
let BlockGen { column_gen } = self;
let world = column_gen.sim;
let z_cache = z_cache?;
let sample = &z_cache.sample;
let &ColumnSample {
@ -68,7 +65,6 @@ impl<'a> BlockGen<'a> {
basement,
chaos,
water_level,
warp_factor,
surface_color,
sub_surface_color,
stone_col,
@ -76,7 +72,6 @@ impl<'a> BlockGen<'a> {
cliff_offset,
cliff_height,
ice_depth,
gradient,
..
} = sample;

View File

@ -87,7 +87,6 @@ impl<'a> Sampler<'a> for ColumnGen<'a> {
let rockiness = sim.get_interpolated(wpos, |chunk| chunk.rockiness)?;
let tree_density = sim.get_interpolated(wpos, |chunk| chunk.tree_density)?;
let spawn_rate = sim.get_interpolated(wpos, |chunk| chunk.spawn_rate)?;
let flux = sim.get_interpolated(wpos, |chunk| chunk.flux)?;
let near_water =
sim.get_interpolated(
wpos,
@ -865,7 +864,7 @@ impl<'a> Sampler<'a> for ColumnGen<'a> {
let basement_sub_alt =
sim.get_interpolated_monotone(wpos, |chunk| chunk.basement.sub(chunk.alt))?;
let warp_factor = water_dist.map_or(1.0, |d| (d / 64.0).clamped(0.0, 1.0));
let warp_factor = water_dist.map_or(1.0, |d| ((d - 0.0) / 64.0).clamped(0.0, 1.0));
// NOTE: To disable warp, uncomment this line.
// let warp_factor = 0.0;
@ -885,7 +884,11 @@ impl<'a> Sampler<'a> for ColumnGen<'a> {
let alt = alt + riverless_alt_delta + warp;
let basement = alt + basement_sub_alt;
// Adjust this to make rock placement better
let rock_density = rockiness;
let rock_density = rockiness
+ water_dist
.filter(|wd| *wd > 2.0)
.map(|wd| (1.0 - wd / 32.0).clamped(0.0, 1.0).powf(0.5) * 10.0)
.unwrap_or(0.0);
// Columns near water have a more stable temperature and so get pushed towards
// the average (0)

View File

@ -51,17 +51,17 @@ pub fn apply_rocks_to(canvas: &mut Canvas, _dynamic_rng: &mut impl Rng) {
rng.gen_range(1.0..4.0),
&mut rng,
))),
(5..=i32::MAX, _, 10..=i32::MAX) => {
(5..=i32::MAX, _, 0..=i32::MAX) => {
if col.temp > CONFIG.desert_temp - 0.1
&& col.humidity < CONFIG.desert_hum + 0.1
{
Some(RockKind::Sandstone(VoronoiCell::generate(
rng.gen_range(2.0..20.0 - 15.0 * col.tree_density),
rng.gen_range(2.0..20.0 - 10.0 * col.tree_density),
&mut rng,
)))
} else {
Some(RockKind::Rock(VoronoiCell::generate(
rng.gen_range(2.0..20.0 - 15.0 * col.tree_density),
rng.gen_range(2.0..20.0 - 10.0 * col.tree_density),
&mut rng,
)))
}

View File

@ -115,7 +115,6 @@ pub(crate) struct GenCtx {
// Small amounts of noise for simulating rough terrain.
pub small_nz: BasicMulti,
pub rock_nz: HybridMulti,
pub warp_nz: FastNoise,
pub tree_nz: BasicMulti,
// TODO: unused, remove??? @zesterer
@ -559,7 +558,6 @@ impl WorldSim {
small_nz: BasicMulti::new().set_octaves(2).set_seed(rng.gen()),
rock_nz: HybridMulti::new().set_persistence(0.3).set_seed(rng.gen()),
warp_nz: FastNoise::new(rng.gen()),
tree_nz: BasicMulti::new()
.set_octaves(12)
.set_persistence(0.75)