Better docs, faster terrain meshing

This commit is contained in:
Joshua Barretto 2021-03-07 12:17:40 +00:00
parent 9910398917
commit 36d20e6990
3 changed files with 9 additions and 8 deletions

View File

@ -44,9 +44,12 @@ const float UNDERWATER_MIST_DIST = 100.0;
const float PERSISTENT_AMBIANCE = 1.0 / 32.0;// 1.0 / 80; // 1.0 / 512; // 0.00125 // 0.1;// 0.025; // 0.1;
// Glow from static light sources
// Allowed to be > 1 due to HDR
const vec3 GLOW_COLOR = vec3(3.0, 0.9, 0.05);
// Calculate glow from static light sources, + some noise for flickering.
// TODO: Optionally disable the flickering for performance?
vec3 glow_light(vec3 pos) {
return GLOW_COLOR * (1.0 + (noise_3d(vec3(pos.xy * 0.005, tick.x * 0.5)) - 0.5) * 1.0);
}

View File

@ -381,13 +381,11 @@ impl<'a, V: RectRasterableVol<Vox = Block> + ReadVol + Debug + 'static>
let draw_delta = Vec3::new(1, 1, z_start);
let get_light = |_: &mut (), pos: Vec3<i32>| {
volume.get(range.min + pos).map_or(1.0, |b| {
if b.is_opaque() {
0.0
} else {
light(pos + range.min)
}
})
if flat_get(pos).is_opaque() {
0.0
} else {
light(pos + range.min)
}
};
let get_glow = |_: &mut (), pos: Vec3<i32>| glow(pos + range.min);
let get_color =

View File

@ -23,7 +23,7 @@ pub use self::{
};
use crate::{
all::*,
all::{Environment, ForestKind, TreeAttr},
block::BlockGen,
civ::Place,
column::ColumnGen,