mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Smoothed world borders
This commit is contained in:
parent
9bc50ae547
commit
92d4b4dfbe
@ -50,7 +50,7 @@ impl Vertex {
|
||||
pos_norm: 0
|
||||
| ((pos.x as u32) & 0x00FF) << 0
|
||||
| ((pos.y as u32) & 0x00FF) << 8
|
||||
| ((pos.z as u32) & 0x1FFF) << 16
|
||||
| ((pos.z.max(0.0).min((1 << 13) as f32) as u32) & 0x1FFF) << 16
|
||||
| ((norm_bits as u32) & 0x7) << 29,
|
||||
col_light: 0
|
||||
| ((col.r.mul(200.0) as u32) & 0xFF) << 8
|
||||
|
@ -71,7 +71,14 @@ impl World {
|
||||
.and_then(|base_z| self.sim.get(chunk_pos).map(|sim_chunk| (base_z, sim_chunk)))
|
||||
{
|
||||
Some((base_z, sim_chunk)) => (base_z as i32, sim_chunk),
|
||||
None => return TerrainChunk::new(0, water, air, TerrainChunkMeta::void()),
|
||||
None => {
|
||||
return TerrainChunk::new(
|
||||
CONFIG.sea_level as i32,
|
||||
water,
|
||||
air,
|
||||
TerrainChunkMeta::void(),
|
||||
)
|
||||
}
|
||||
};
|
||||
|
||||
let meta = TerrainChunkMeta::new(sim_chunk.get_name(&self.sim), sim_chunk.get_biome());
|
||||
|
@ -393,7 +393,15 @@ impl SimChunk {
|
||||
.abs()
|
||||
.powf(1.35);
|
||||
|
||||
let alt = CONFIG.sea_level
|
||||
let map_edge_factor = pos
|
||||
.map2(WORLD_SIZE.map(|e| e as i32), |e, sz| {
|
||||
(sz / 2 - (e - sz / 2).abs()) as f32 / 16.0
|
||||
})
|
||||
.reduce_partial_min()
|
||||
.max(0.0)
|
||||
.min(1.0);
|
||||
|
||||
let alt = (CONFIG.sea_level
|
||||
+ alt_base
|
||||
+ (0.0
|
||||
+ alt_main
|
||||
@ -403,7 +411,8 @@ impl SimChunk {
|
||||
.add(1.0)
|
||||
.mul(0.5)
|
||||
.mul(chaos)
|
||||
.mul(CONFIG.mountain_scale);
|
||||
.mul(CONFIG.mountain_scale))
|
||||
* map_edge_factor;
|
||||
|
||||
let cliff = gen_ctx.cliff_nz.get((wposf.div(2048.0)).into_array()) as f32 + chaos * 0.2;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user