mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
fmt
This commit is contained in:
parent
25a02ae6e0
commit
f02b571f7f
@ -136,9 +136,11 @@ impl WorldSim {
|
||||
// from -0.25 * (CONFIG.mountain_scale * 1.1) to 0.25 * (CONFIG.mountain_scale * 0.9),
|
||||
// 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)
|
||||
Some(
|
||||
(gen_ctx.alt_nz.get((wposf.div(12_000.0)).into_array()) as f32)
|
||||
.sub(0.1)
|
||||
.mul(0.25))
|
||||
.mul(0.25),
|
||||
)
|
||||
});
|
||||
|
||||
// -1 to 1.
|
||||
@ -151,7 +153,8 @@ impl WorldSim {
|
||||
let chaos = uniform_noise(|posi, wposf| {
|
||||
// From 0 to 1.6, but the distribution before the max is from -1 and 1, so there is a
|
||||
// 50% chance that hill will end up at 0.
|
||||
let hill = (0.0 + gen_ctx
|
||||
let hill = (0.0
|
||||
+ gen_ctx
|
||||
.hill_nz
|
||||
.get((wposf.div(1_500.0)).into_array())
|
||||
.mul(1.0) as f32
|
||||
@ -162,7 +165,8 @@ impl WorldSim {
|
||||
.add(0.3)
|
||||
.max(0.0);
|
||||
|
||||
Some((gen_ctx.chaos_nz.get((wposf.div(3_000.0)).into_array()) as f32)
|
||||
Some(
|
||||
(gen_ctx.chaos_nz.get((wposf.div(3_000.0)).into_array()) as f32)
|
||||
.add(1.0)
|
||||
.mul(0.5)
|
||||
// [0, 1] * [0.25, 1] = [0, 1] (but probably towards the lower end)
|
||||
@ -191,7 +195,8 @@ impl WorldSim {
|
||||
.min(1.0),
|
||||
)
|
||||
// We can't have *no* chaos!
|
||||
.max(0.1))
|
||||
.max(0.1),
|
||||
)
|
||||
});
|
||||
|
||||
// We ignore sea level because we actually want to be relative to sea level here and want
|
||||
@ -236,9 +241,11 @@ impl WorldSim {
|
||||
if alt[posi].1 <= 5.0.div(CONFIG.mountain_scale) {
|
||||
None
|
||||
} else {
|
||||
Some((gen_ctx.humid_nz.get(wposf.div(1024.0).into_array()) as f32)
|
||||
Some(
|
||||
(gen_ctx.humid_nz.get(wposf.div(1024.0).into_array()) as f32)
|
||||
.add(1.0)
|
||||
.mul(0.5))
|
||||
.mul(0.5),
|
||||
)
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -133,13 +133,12 @@ pub fn uniform_idx_as_vec2(idx: usize) -> Vec2<i32> {
|
||||
pub fn uniform_noise(f: impl Fn(usize, Vec2<f64>) -> Option<f32>) -> InverseCdf {
|
||||
let mut noise = (0..WORLD_SIZE.x * WORLD_SIZE.y)
|
||||
.filter_map(|i| {
|
||||
(
|
||||
f(
|
||||
(f(
|
||||
i,
|
||||
(uniform_idx_as_vec2(i) * TerrainChunkSize::SIZE.map(|e| e as i32))
|
||||
.map(|e| e as f64),
|
||||
).map(|res| (i, res))
|
||||
)
|
||||
.map(|res| (i, res)))
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user