Reduce LoD zone size

This commit is contained in:
Joshua Barretto 2021-04-24 20:27:48 +01:00
parent d7f2e84e16
commit 3559a85922
5 changed files with 7 additions and 6 deletions

BIN
assets/voxygen/voxel/mini_tree.vox (Stored with Git LFS)

Binary file not shown.

View File

@ -1617,7 +1617,7 @@ impl Client {
}
pub fn nearby_zones(&self) -> Option<impl Iterator<Item = Vec2<i32>>> {
const ZONE_RADIUS: u32 = 1;
const ZONE_RADIUS: u32 = 2;
let player_zone = self.position()?.xy().map2(TerrainChunkSize::RECT_SIZE, |e, sz| e as i32 / (sz * LodZone::SIZE) as i32);
Some(Spiral2d::new()
.take((ZONE_RADIUS * 2 + 1).pow(2) as usize)

View File

@ -8,7 +8,7 @@ pub struct LodZone {
impl LodZone {
/// Size in chunks
pub const SIZE: u32 = 64;
pub const SIZE: u32 = 32;
}
#[derive(Clone, Debug, Serialize, Deserialize)]

View File

@ -49,6 +49,7 @@ impl Lod {
Segment::from(&DotVoxAsset::load_expect("voxygen.voxel.mini_tree").read().0),
(&mut greedy, &mut mesh, false),
);
println!("Tree mesh has {} vertices", mesh.vertices().len());
(
renderer.create_model(&mesh).expect("Failed to upload sprite model data to the GPU!"),
ShadowPipeline::create_col_lights(renderer, &greedy.finalize())

View File

@ -85,8 +85,8 @@ impl StructureGen2d {
let freq_offset = Self::freq_offset(freq);
assert!(freq_offset * 2 == freq);
let min_index = Self::sample_to_index_internal(freq, min) - 1;
let max_index = Self::sample_to_index_internal(freq, max) + 1;
let min_index = Self::sample_to_index_internal(freq, min - spread) - 1;
let max_index = Self::sample_to_index_internal(freq, max + spread) + 1;
assert!(min_index.x < max_index.x);
// NOTE: xlen > 0
let xlen = (max_index.x - min_index.x) as u32;