mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Smartened up terrain generation
Former-commit-id: d85448e5171bd27b04530da8e1ca927554136ebf
This commit is contained in:
parent
94fd0b1a22
commit
cf4e02252a
@ -40,7 +40,7 @@ impl<'a> System<'a> for Sys {
|
||||
if on_ground {
|
||||
// TODO: Don't hard-code this
|
||||
// Apply physics to the player: acceleration and non-linear decceleration
|
||||
vel.0 += control.move_dir * 4.0 - vel.0.map(|e| e * e.abs() + e) * 0.05;
|
||||
vel.0 += control.move_dir * 4.0 - vel.0.map(|e| e * vel.0.magnitude() + e) * 0.05;
|
||||
|
||||
if control.jumping {
|
||||
vel.0.z += 16.0;
|
||||
|
@ -20,9 +20,15 @@ impl KeyState {
|
||||
}
|
||||
|
||||
pub fn dir_vec(&self) -> Vec2<f32> {
|
||||
Vec2::<f32>::new(
|
||||
let dir = Vec2::<f32>::new(
|
||||
if self.right { 1.0 } else { 0.0 } + if self.left { -1.0 } else { 0.0 },
|
||||
if self.up { 1.0 } else { 0.0 } + if self.down { -1.0 } else { 0.0 },
|
||||
)
|
||||
);
|
||||
|
||||
if dir.magnitude_squared() == 0.0 {
|
||||
dir
|
||||
} else {
|
||||
dir.normalized()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ impl World {
|
||||
let chaos = chaos_nz.get(Vec2::from(wposf * chaos_freq).into_array()).max(0.0) + 0.5;
|
||||
|
||||
let height = perlin_nz.get(Vec2::from(wposf * freq).into_array()) * ampl * chaos
|
||||
+ perlin_nz.get((wposf * small_freq).into_array()) * small_ampl * chaos
|
||||
+ perlin_nz.get((wposf * small_freq).into_array()) * small_ampl * 2.0 * chaos.powf(2.0)
|
||||
+ offs;
|
||||
let temp = (temp_nz.get(Vec2::from(wposf * (1.0 / 64.0)).into_array()) + 1.0) * 0.5;
|
||||
|
||||
@ -62,7 +62,7 @@ impl World {
|
||||
lpos,
|
||||
if wposf.z < height - 4.0 {
|
||||
stone
|
||||
} else if wposf.z < height - 1.0 {
|
||||
} else if wposf.z < height - 2.0 {
|
||||
dirt
|
||||
} else if wposf.z < height {
|
||||
Block::new(2, Rgb::new(10 + (150.0 * temp) as u8, 150, 0))
|
||||
|
Loading…
Reference in New Issue
Block a user