Made temperature biomes larger, added savannah ground

This commit is contained in:
Joshua Barretto 2019-07-07 16:56:36 +01:00
parent e1ede61c06
commit 29803524fd
4 changed files with 20 additions and 13 deletions

View File

@ -294,8 +294,8 @@ impl<'a> BlockGen<'a> {
StructureBlock::PalmLeaves => Block::new( StructureBlock::PalmLeaves => Block::new(
1, 1,
Lerp::lerp( Lerp::lerp(
Rgb::new(30.0, 100.0, 30.0), Rgb::new(25.0, 100.0, 30.0),
Rgb::new(120.0, 255.0, 0.0), Rgb::new(75.0, 255.0, 0.0),
lerp, lerp,
) )
.map(|e| e as u8), .map(|e| e as u8),

View File

@ -106,24 +106,28 @@ impl<'a> Sampler for ColumnGen<'a> {
let desert_sand = Rgb::new(0.98, 0.8, 0.15); let desert_sand = Rgb::new(0.98, 0.8, 0.15);
let snow = Rgb::broadcast(1.0); let snow = Rgb::broadcast(1.0);
let grass = Rgb::lerp(cold_grass, warm_grass, marble); let dirt = Lerp::lerp(Rgb::new(0.2, 0.1, 0.05), Rgb::new(0.4, 0.25, 0.0), marble);
let sand = Rgb::lerp(beach_sand, desert_sand, marble);
let cliff = Rgb::lerp(cold_stone, warm_stone, marble); let cliff = Rgb::lerp(cold_stone, warm_stone, marble);
let dirt = Lerp::lerp(Rgb::new(0.2, 0.1, 0.05), Rgb::new(0.4, 0.25, 0.0), marble); let grass = Rgb::lerp(cold_grass, warm_grass, marble);
let sand = Rgb::lerp(beach_sand, desert_sand, marble);
let turf = grass; let tropical = Rgb::lerp(
grass,
Rgb::new(0.95, 0.85, 0.1),
marble_small.sub(0.5).mul(0.05).add(0.3),
);
let ground = Rgb::lerp( let ground = Rgb::lerp(
Rgb::lerp( Rgb::lerp(
snow, snow,
turf, grass,
temp.sub(CONFIG.snow_temp) temp.sub(CONFIG.snow_temp)
.sub((marble - 0.5) * 0.05) .sub((marble - 0.5) * 0.05)
.mul(256.0), .mul(256.0),
), ),
sand, Rgb::lerp(tropical, sand, temp.sub(CONFIG.desert_temp).mul(32.0)),
temp.sub(CONFIG.desert_temp).mul(32.0), temp.sub(CONFIG.tropical_temp).mul(128.0),
); );
// Work out if we're on a path or near a town // Work out if we're on a path or near a town

View File

@ -2,6 +2,7 @@ pub struct Config {
pub sea_level: f32, pub sea_level: f32,
pub mountain_scale: f32, pub mountain_scale: f32,
pub snow_temp: f32, pub snow_temp: f32,
pub tropical_temp: f32,
pub desert_temp: f32, pub desert_temp: f32,
} }
@ -9,5 +10,6 @@ pub const CONFIG: Config = Config {
sea_level: 140.0, sea_level: 140.0,
mountain_scale: 1200.0, mountain_scale: 1200.0,
snow_temp: -0.4, snow_temp: -0.4,
desert_temp: 0.4, tropical_temp: 0.25,
desert_temp: 0.45,
}; };

View File

@ -16,7 +16,7 @@ use common::{
}; };
use noise::{BasicMulti, HybridMulti, MultiFractal, NoiseFn, RidgedMulti, Seedable, SuperSimplex}; use noise::{BasicMulti, HybridMulti, MultiFractal, NoiseFn, RidgedMulti, Seedable, SuperSimplex};
use rand::{prng::XorShiftRng, Rng, SeedableRng}; use rand::{prng::XorShiftRng, Rng, SeedableRng};
use std::ops::{Add, Div, Mul, Sub}; use std::ops::{Add, Div, Mul, Neg, Sub};
use vek::*; use vek::*;
pub const WORLD_SIZE: Vec2<usize> = Vec2 { x: 1024, y: 1024 }; pub const WORLD_SIZE: Vec2<usize> = Vec2 { x: 1024, y: 1024 };
@ -353,6 +353,8 @@ impl SimChunk {
.add(0.3) .add(0.3)
.max(0.0); .max(0.0);
let temp = gen_ctx.temp_nz.get((wposf.div(15000.0)).into_array()) as f32;
let dryness = gen_ctx.dry_nz.get( let dryness = gen_ctx.dry_nz.get(
(wposf (wposf
.add(Vec2::new( .add(Vec2::new(
@ -375,6 +377,7 @@ impl SimChunk {
.add(0.5) .add(0.5)
.min(1.0), .min(1.0),
) )
.mul(temp.mul(4.0).sub(1.0).neg().add(0.25).max(0.05).min(1.0))
.powf(1.5) .powf(1.5)
.add(0.1 * hill); .add(0.1 * hill);
@ -403,8 +406,6 @@ impl SimChunk {
.mul(chaos) .mul(chaos)
.mul(CONFIG.mountain_scale); .mul(CONFIG.mountain_scale);
let temp = gen_ctx.temp_nz.get((wposf.div(8192.0)).into_array()) as f32;
let cliff = gen_ctx.cliff_nz.get((wposf.div(2048.0)).into_array()) as f32 + chaos * 0.2; let cliff = gen_ctx.cliff_nz.get((wposf.div(2048.0)).into_array()) as f32 + chaos * 0.2;
Self { Self {