mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Stone layering
This commit is contained in:
parent
9b5c9d1246
commit
740dcbb440
@ -70,6 +70,7 @@ impl<'a> BlockGen<'a> {
|
||||
// humidity,
|
||||
stone_col,
|
||||
snow_cover,
|
||||
cliff_offset,
|
||||
..
|
||||
} = sample;
|
||||
|
||||
@ -118,7 +119,16 @@ impl<'a> BlockGen<'a> {
|
||||
.map(|e| (e * 255.0) as u8);
|
||||
|
||||
if stone_factor >= 0.5 {
|
||||
Some(Block::new(BlockKind::Rock, col))
|
||||
if wposf.z as f32 > height - cliff_offset.max(0.0) {
|
||||
let col = Lerp::lerp(
|
||||
col.map(|e| e as f32),
|
||||
col.map(|e| e as f32) * 0.7,
|
||||
(wposf.z as f32 - basement).div(2.0).sin() * 0.5 + 0.5,
|
||||
).map(|e| e as u8);
|
||||
Some(Block::new(BlockKind::Rock, col))
|
||||
} else {
|
||||
Some(Block::new(BlockKind::Rock, col))
|
||||
}
|
||||
} else {
|
||||
Some(Block::new(BlockKind::Earth, col))
|
||||
}
|
||||
@ -183,7 +193,7 @@ pub struct ZCache<'a> {
|
||||
|
||||
impl<'a> ZCache<'a> {
|
||||
pub fn get_z_limits(&self) -> (f32, f32) {
|
||||
let min = self.sample.alt - (self.sample.chaos.min(1.0) * 16.0);
|
||||
let min = self.sample.alt - (self.sample.chaos.min(1.0) * 16.0) - self.sample.cliff_offset.max(0.0);
|
||||
let min = min - 4.0;
|
||||
|
||||
let rocks = if self.sample.rock > 0.0 { 12.0 } else { 0.0 };
|
||||
|
@ -97,9 +97,9 @@ impl<'a> Sampler<'a> for ColumnGen<'a> {
|
||||
let cliff_factor = (alt
|
||||
+ self.sim.gen_ctx.hill_nz.get(wposf.div(32.0).into_array()) as f32 * 10.0
|
||||
+ self.sim.gen_ctx.hill_nz.get(wposf.div(256.0).into_array()) as f32 * 64.0).rem_euclid(128.0) / 64.0 - 1.0;
|
||||
let cliff_offset = cliff_factor.abs().powf(if cliff_factor < 0.0 { 1.0 } else { 64.0 }) * cliff_height;
|
||||
let cliff_scale = (self.sim.gen_ctx.hill_nz.get(wposf.div(128.0).into_array()) + self.sim.gen_ctx.hill_nz.get(wposf.div(48.0).into_array()) * 0.1 + 0.5).max(0.0) as f32;
|
||||
let alt = alt + cliff_offset * cliff_scale;
|
||||
let cliff_offset = cliff_factor.abs().powf(if cliff_factor < 0.0 { 1.0 } else { 64.0 }) * cliff_height * cliff_scale;
|
||||
let alt = alt + cliff_offset;
|
||||
|
||||
let lake_width = (TerrainChunkSize::RECT_SIZE.x as f64 * (2.0f64.sqrt())) + 12.0;
|
||||
let neighbor_river_data = neighbor_river_data.map(|(posj, chunkj, river)| {
|
||||
|
Loading…
Reference in New Issue
Block a user