mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Better hills
This commit is contained in:
parent
46fdc87014
commit
b62830b8b4
@ -112,7 +112,9 @@ fn create_quad<P: Pipeline, F: Fn(Vec3<f32>, Vec3<f32>, Rgb<f32>, f32, f32) -> P
|
||||
|
||||
let ao_map = ao.map(|e| e); //0.05 + e.powf(1.2) * 0.95);
|
||||
|
||||
if ao[0].min(ao[2]) < ao[1].min(ao[3]) {
|
||||
if ao[0].min(ao[2]).min(darkness[0]).min(darkness[2])
|
||||
< ao[1].min(ao[3]).min(darkness[1]).min(darkness[3])
|
||||
{
|
||||
Quad::new(
|
||||
vcons(origin + unit_y, norm, cols[3], darkness[3], ao_map[3]),
|
||||
vcons(origin, norm, cols[0], darkness[0], ao_map[0]),
|
||||
|
@ -58,7 +58,8 @@ impl<'a> BlockGen<'a> {
|
||||
let cliff_pos3d = Vec3::from(*cliff_pos);
|
||||
|
||||
let height = (RandomField::new(seed + 1).get(cliff_pos3d) % 64) as f32
|
||||
/ (1.0 + 3.0 * cliff_sample.chaos);
|
||||
/ (1.0 + 3.0 * cliff_sample.chaos)
|
||||
+ 3.0;
|
||||
let radius = RandomField::new(seed + 2).get(cliff_pos3d) % 48 + 8;
|
||||
|
||||
max_height.max(
|
||||
|
@ -175,11 +175,11 @@ impl<'a> Sampler<'a> for ColumnGen<'a> {
|
||||
+ (sim
|
||||
.gen_ctx
|
||||
.small_nz
|
||||
.get((wposf_turb.div(600.0)).into_array()) as f32)
|
||||
.get((wposf_turb.div(400.0)).into_array()) as f32)
|
||||
.abs()
|
||||
.mul((1.0 - chaos).max(0.3))
|
||||
.mul(1.0 - humidity)
|
||||
.mul(85.0);
|
||||
.mul(65.0);
|
||||
|
||||
let is_cliffs = sim_chunk.is_cliffs;
|
||||
let near_cliffs = sim_chunk.near_cliffs;
|
||||
|
@ -103,8 +103,10 @@ impl<'a> Generator<'a, TownState> for TownGen {
|
||||
(sample.alt - 32.0, sample.alt + 75.0)
|
||||
}
|
||||
|
||||
fn spawn_rules(&self, _town: &'a TownState, _wpos: Vec2<i32>) -> SpawnRules {
|
||||
SpawnRules { trees: false }
|
||||
fn spawn_rules(&self, town: &'a TownState, wpos: Vec2<i32>) -> SpawnRules {
|
||||
SpawnRules {
|
||||
trees: wpos.distance_squared(town.center.into()) > (town.radius + 32).pow(2),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,9 +150,9 @@ impl WorldSim {
|
||||
// but value here is from -0.275 to 0.225).
|
||||
let alt_base = uniform_noise(|_, wposf| {
|
||||
Some(
|
||||
(gen_ctx.alt_nz.get((wposf.div(12_000.0)).into_array()) as f32)
|
||||
.sub(0.1)
|
||||
.mul(0.25),
|
||||
(gen_ctx.alt_nz.get((wposf.div(10_000.0)).into_array()) as f32)
|
||||
.sub(0.05)
|
||||
.mul(0.35),
|
||||
)
|
||||
});
|
||||
|
||||
@ -174,14 +174,14 @@ impl WorldSim {
|
||||
.max(0.0);
|
||||
|
||||
Some(
|
||||
(gen_ctx.chaos_nz.get((wposf.div(3_000.0)).into_array()) as f32)
|
||||
(gen_ctx.chaos_nz.get((wposf.div(3_500.0)).into_array()) as f32)
|
||||
.add(1.0)
|
||||
.mul(0.5)
|
||||
// [0, 1] * [0.25, 1] = [0, 1] (but probably towards the lower end)
|
||||
.mul(
|
||||
(gen_ctx.chaos_nz.get((wposf.div(6_000.0)).into_array()) as f32)
|
||||
.abs()
|
||||
.max(0.25)
|
||||
.max(0.4)
|
||||
.min(1.0),
|
||||
)
|
||||
// Chaos is always increased by a little when we're on a hill (but remember that
|
||||
@ -189,7 +189,7 @@ impl WorldSim {
|
||||
// [0, 1] + 0.15 * [0, 1.6] = [0, 1.24]
|
||||
.add(0.2 * hill)
|
||||
// We can't have *no* chaos!
|
||||
.max(0.1),
|
||||
.max(0.12),
|
||||
)
|
||||
});
|
||||
|
||||
@ -214,13 +214,17 @@ impl WorldSim {
|
||||
.abs()
|
||||
.powf(1.35);
|
||||
|
||||
fn spring(x: f32, pow: f32) -> f32 {
|
||||
x.abs().powf(pow) * x.signum()
|
||||
}
|
||||
|
||||
(0.0 + alt_main
|
||||
+ (gen_ctx.small_nz.get((wposf.div(300.0)).into_array()) as f32)
|
||||
.mul(alt_main.max(0.25))
|
||||
.mul(alt_main.powf(0.8).max(0.15))
|
||||
.mul(0.3)
|
||||
.add(1.0)
|
||||
.mul(0.5)
|
||||
+ alt_main.mul(100.0).sin().mul(0.025))
|
||||
.mul(0.4)
|
||||
+ spring(alt_main.abs().powf(0.5).min(0.75).mul(60.0).sin(), 4.0).mul(0.045))
|
||||
};
|
||||
|
||||
// Now we can compute the final altitude using chaos.
|
||||
@ -228,7 +232,10 @@ impl WorldSim {
|
||||
// alt_pre, then multiply by CONFIG.mountain_scale and add to the base and sea level to
|
||||
// get an adjusted value, then multiply the whole thing by map_edge_factor
|
||||
// (TODO: compute final bounds).
|
||||
Some((alt_base[posi].1 + alt_main.mul(chaos[posi].1)).mul(map_edge_factor(posi)))
|
||||
Some(
|
||||
(alt_base[posi].1 + alt_main.mul(chaos[posi].1.powf(1.2)))
|
||||
.mul(map_edge_factor(posi)),
|
||||
)
|
||||
});
|
||||
|
||||
// Check whether any tiles around this tile are not water (since Lerp will ensure that they
|
||||
@ -705,7 +712,7 @@ impl SimChunk {
|
||||
} else {
|
||||
// For now we don't take humidity into account for cold climates (but we really
|
||||
// should!) except that we make sure we only have snow pines when there is snow.
|
||||
if temp <= CONFIG.snow_temp && humidity > CONFIG.forest_hum {
|
||||
if temp <= CONFIG.snow_temp {
|
||||
ForestKind::SnowPine
|
||||
} else if humidity > CONFIG.desert_hum {
|
||||
ForestKind::Pine
|
||||
|
Loading…
Reference in New Issue
Block a user