mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Better warping
This commit is contained in:
parent
b0293ecce4
commit
aaade23eef
@ -171,9 +171,9 @@ impl<'a> BlockGen<'a> {
|
||||
(true, alt, CONFIG.sea_level /*water_level*/)
|
||||
} else {
|
||||
// Apply warping
|
||||
let warp = (world.sim().gen_ctx.warp_nz.get(wposf.div(16.0)) as f32)
|
||||
let warp = (world.sim().gen_ctx.warp_nz.get(wposf.div(24.0)) as f32)
|
||||
.mul((chaos - 0.1).max(0.0))
|
||||
.mul(15.0);
|
||||
.mul(30.0);
|
||||
|
||||
let height = if (wposf.z as f32) < alt + warp - 10.0 {
|
||||
// Shortcut cliffs
|
||||
|
@ -23,14 +23,16 @@ impl Sampler<'static> for FastNoise {
|
||||
type Sample = f32;
|
||||
|
||||
fn get(&self, pos: Self::Index) -> Self::Sample {
|
||||
let v000 = self.noise_at(pos.map(|e| e.floor() as i32) + Vec3::new(0, 0, 0));
|
||||
let v100 = self.noise_at(pos.map(|e| e.floor() as i32) + Vec3::new(1, 0, 0));
|
||||
let v010 = self.noise_at(pos.map(|e| e.floor() as i32) + Vec3::new(0, 1, 0));
|
||||
let v110 = self.noise_at(pos.map(|e| e.floor() as i32) + Vec3::new(1, 1, 0));
|
||||
let v001 = self.noise_at(pos.map(|e| e.floor() as i32) + Vec3::new(0, 0, 1));
|
||||
let v101 = self.noise_at(pos.map(|e| e.floor() as i32) + Vec3::new(1, 0, 1));
|
||||
let v011 = self.noise_at(pos.map(|e| e.floor() as i32) + Vec3::new(0, 1, 1));
|
||||
let v111 = self.noise_at(pos.map(|e| e.floor() as i32) + Vec3::new(1, 1, 1));
|
||||
let near_pos = pos.map(|e| e.floor() as i32);
|
||||
|
||||
let v000 = self.noise_at(near_pos + Vec3::new(0, 0, 0));
|
||||
let v100 = self.noise_at(near_pos + Vec3::new(1, 0, 0));
|
||||
let v010 = self.noise_at(near_pos + Vec3::new(0, 1, 0));
|
||||
let v110 = self.noise_at(near_pos + Vec3::new(1, 1, 0));
|
||||
let v001 = self.noise_at(near_pos + Vec3::new(0, 0, 1));
|
||||
let v101 = self.noise_at(near_pos + Vec3::new(1, 0, 1));
|
||||
let v011 = self.noise_at(near_pos + Vec3::new(0, 1, 1));
|
||||
let v111 = self.noise_at(near_pos + Vec3::new(1, 1, 1));
|
||||
|
||||
let factor = pos.map(|e| 0.5 - (e.fract() as f32 * f32::consts::PI).cos() * 0.5);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user