mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fixed tree clipping and several other minor issues
This commit is contained in:
parent
c2a11ed6b2
commit
f823b0c992
@ -379,9 +379,15 @@ impl<'a> ZCache<'a> {
|
|||||||
0,
|
0,
|
||||||
|a, (st_info, st_sample)| {
|
|a, (st_info, st_sample)| {
|
||||||
let bounds = st_info.volume.get_bounds();
|
let bounds = st_info.volume.get_bounds();
|
||||||
let min = Vec2::from(bounds.min + st_info.pos);
|
let st_area = Aabr {
|
||||||
let max = Vec2::from(bounds.max + st_info.pos);
|
min: Vec2::from(bounds.min),
|
||||||
if (Aabr { min, max }).contains_point(self.wpos) {
|
max: Vec2::from(bounds.max),
|
||||||
|
};
|
||||||
|
|
||||||
|
let rpos = self.wpos - st_info.pos;
|
||||||
|
let unit_rpos = st_info.units.0 * rpos.x + st_info.units.1 * rpos.y;
|
||||||
|
|
||||||
|
if st_area.contains_point(unit_rpos) {
|
||||||
a.max(bounds.max.z)
|
a.max(bounds.max.z)
|
||||||
} else {
|
} else {
|
||||||
a
|
a
|
||||||
|
@ -78,7 +78,7 @@ impl<'a> Sampler for ColumnGen<'a> {
|
|||||||
let water_level = (riverless_alt - 4.0 - 5.0 * chaos).max(CONFIG.sea_level);
|
let water_level = (riverless_alt - 4.0 - 5.0 * chaos).max(CONFIG.sea_level);
|
||||||
|
|
||||||
let rock = (sim.gen_ctx.small_nz.get(
|
let rock = (sim.gen_ctx.small_nz.get(
|
||||||
Vec3::new(wposf.x, wposf.y, alt as f64 * 3.0)
|
Vec3::new(wposf.x, wposf.y, alt as f64)
|
||||||
.div(100.0)
|
.div(100.0)
|
||||||
.into_array(),
|
.into_array(),
|
||||||
) as f32)
|
) as f32)
|
||||||
|
@ -76,7 +76,7 @@ impl World {
|
|||||||
|
|
||||||
let meta = TerrainChunkMeta::new(sim_chunk.get_name(&self.sim), sim_chunk.get_biome());
|
let meta = TerrainChunkMeta::new(sim_chunk.get_name(&self.sim), sim_chunk.get_biome());
|
||||||
|
|
||||||
let mut chunk = TerrainChunk::new(base_z - 8, stone, air, meta);
|
let mut chunk = TerrainChunk::new(base_z, stone, air, meta);
|
||||||
|
|
||||||
let mut sampler = self.sample_blocks();
|
let mut sampler = self.sample_blocks();
|
||||||
|
|
||||||
@ -85,18 +85,6 @@ impl World {
|
|||||||
let wpos2d = Vec2::new(x, y)
|
let wpos2d = Vec2::new(x, y)
|
||||||
+ Vec3::from(chunk_pos) * TerrainChunkSize::SIZE.map(|e| e as i32);
|
+ Vec3::from(chunk_pos) * TerrainChunkSize::SIZE.map(|e| e as i32);
|
||||||
|
|
||||||
/*
|
|
||||||
let min_z = self
|
|
||||||
.sim
|
|
||||||
.get_interpolated(wpos2d, |chunk| chunk.get_min_z())
|
|
||||||
.unwrap_or(0.0) as i32;
|
|
||||||
|
|
||||||
let max_z = self
|
|
||||||
.sim
|
|
||||||
.get_interpolated(wpos2d, |chunk| chunk.get_max_z())
|
|
||||||
.unwrap_or(0.0) as i32;
|
|
||||||
*/
|
|
||||||
|
|
||||||
let z_cache = match sampler.get_z_cache(wpos2d) {
|
let z_cache = match sampler.get_z_cache(wpos2d) {
|
||||||
Some(z_cache) => z_cache,
|
Some(z_cache) => z_cache,
|
||||||
None => continue,
|
None => continue,
|
||||||
@ -104,7 +92,7 @@ impl World {
|
|||||||
|
|
||||||
let (min_z, max_z) = z_cache.get_z_limits();
|
let (min_z, max_z) = z_cache.get_z_limits();
|
||||||
|
|
||||||
for z in base_z - 16..min_z as i32 {
|
for z in base_z..(min_z as i32).max(base_z) {
|
||||||
let _ = chunk.set(Vec3::new(x, y, z), stone);
|
let _ = chunk.set(Vec3::new(x, y, z), stone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,7 +423,7 @@ impl SimChunk {
|
|||||||
&& dryness > 0.05
|
&& dryness > 0.05
|
||||||
&& alt > CONFIG.sea_level + 5.0
|
&& alt > CONFIG.sea_level + 5.0
|
||||||
&& dryness.abs() > 0.075,
|
&& dryness.abs() > 0.075,
|
||||||
near_cliffs: cliff > 0.325,
|
near_cliffs: cliff > 0.3,
|
||||||
tree_density: (gen_ctx.tree_nz.get((wposf.div(1024.0)).into_array()) as f32)
|
tree_density: (gen_ctx.tree_nz.get((wposf.div(1024.0)).into_array()) as f32)
|
||||||
.mul(1.5)
|
.mul(1.5)
|
||||||
.add(1.0)
|
.add(1.0)
|
||||||
@ -457,7 +457,7 @@ impl SimChunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_base_z(&self) -> f32 {
|
pub fn get_base_z(&self) -> f32 {
|
||||||
self.alt - self.chaos * 50.0
|
self.alt - self.chaos * 50.0 - 16.0
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_name(&self, world: &WorldSim) -> Option<String> {
|
pub fn get_name(&self, world: &WorldSim) -> Option<String> {
|
||||||
|
Loading…
Reference in New Issue
Block a user