Better LoD distance scaling

This commit is contained in:
Joshua Barretto 2020-04-24 16:17:50 +01:00
parent 1d75f4815b
commit 3e62f7edc3
3 changed files with 5 additions and 5 deletions

View File

@ -13,7 +13,7 @@ out vec4 tgt_color;
#include <sky.glsl>
#include <light.glsl>
const float RENDER_DIST = 112.0;
const float RENDER_DIST = 180.0;
const float FADE_DIST = 32.0;
void main() {

View File

@ -18,7 +18,7 @@ impl<'a, V: ReadVol> ReadVol for Scaled<'a, V> {
let search_size = (Vec3::one() / self.scale).map(|e: f32| e.ceil() as i32);
let range_iter = |x| {
std::iter::successors(Some(0), |x| Some(if *x < 0 { -*x } else { -(*x + 1) }))
.take((x as usize * 2).max(1) - 1)
.take(x as usize * 2)
};
range_iter(search_size.x / 2)
.map(|i| {

View File

@ -2010,9 +2010,9 @@ impl<V: RectRasterableVol> Terrain<V> {
for (pos, chunk) in chunk_iter.clone() {
if chunk.visible {
const SPRITE_RENDER_DISTANCE: f32 = 200.0;
const SPRITE_DETAIL_LOW_DISTANCE: f32 = 120.0;
const SPRITE_DETAIL_MID_DISTANCE: f32 = 64.0;
const SPRITE_DETAIL_HIGH_DISTANCE: f32 = 32.0;
const SPRITE_DETAIL_LOW_DISTANCE: f32 = SPRITE_RENDER_DISTANCE * 0.65;
const SPRITE_DETAIL_MID_DISTANCE: f32 = SPRITE_RENDER_DISTANCE * 0.4;
const SPRITE_DETAIL_HIGH_DISTANCE: f32 = SPRITE_RENDER_DISTANCE * 0.25;
let chunk_center =
pos.map2(V::RECT_SIZE, |e, sz: u32| (e as f32 + 0.5) * sz as f32);