Tweaked lighting and AO

This commit is contained in:
Joshua Barretto 2019-06-10 17:28:02 +01:00
parent e671d8473c
commit fa8f3a4b49
6 changed files with 25 additions and 8 deletions

View File

@ -28,9 +28,9 @@ void main() {
f_norm = vec3(0.0, 0.0, 1.0) * norm_dir;
}
float glob_ambience = 0.001;
float glob_ambience = 0.0005;
float sun_ambience = 0.9;
float sun_ambience = 0.8;
vec3 sun_dir = normalize(vec3(1.3, 1.7, 2.1));

View File

@ -53,7 +53,7 @@ fn create_quad<P: Pipeline, F: Fn(Vec3<f32>, Vec3<f32>, Rgb<f32>) -> P::Vertex>(
let ao_scale = 0.95;
let dark = col * (1.0 - ao_scale);
let ao_map = ao.map(|e| e.powf(1.5));
let ao_map = ao.map(|e| 0.15 + e.powf(2.0) * 0.85);
if ao[0].min(ao[2]) < ao[1].min(ao[3]) {
Quad::new(

View File

@ -107,7 +107,7 @@ impl<'a> Sampler for BlockGen<'a> {
let water = Block::new(1, Rgb::new(100, 150, 255));
let warm_stone = Block::new(1, Rgb::new(165, 165, 130));
let block = if (wposf.z as f32) < height - 2.0 {
let block = if (wposf.z as f32) < height - 3.0 {
// Underground
if (wposf.z as f32) > alt {
Some(surface_stone)

View File

@ -4,6 +4,6 @@ pub struct Config {
}
pub const CONFIG: Config = Config {
sea_level: 128.0,
sea_level: 140.0,
mountain_scale: 1200.0,
};

View File

@ -0,0 +1 @@
pub struct Location;

View File

@ -1,4 +1,9 @@
use std::ops::{Add, Div, Mul, Neg, Sub};
mod location;
use std::{
ops::{Add, Div, Mul, Neg, Sub},
sync::Arc,
};
use vek::*;
use noise::{
BasicMulti, RidgedMulti, SuperSimplex, HybridMulti,
@ -12,6 +17,7 @@ use crate::{
CONFIG,
util::StructureGen2d,
};
use self::location::Location;
pub const WORLD_SIZE: Vec2<usize> = Vec2 { x: 1024, y: 1024 };
@ -73,11 +79,19 @@ impl WorldSim {
}
}
Self {
let mut this = Self {
seed,
chunks,
gen_ctx,
}
};
this.simulate(100);
this
}
pub fn simulate(&mut self, cycles: usize) {
// TODO
}
pub fn get(&self, chunk_pos: Vec2<u32>) -> Option<&SimChunk> {
@ -152,6 +166,7 @@ pub struct SimChunk {
pub rockiness: f32,
pub cliffiness: f32,
pub tree_density: f32,
pub location: Option<Arc<Location>>,
}
impl SimChunk {
@ -222,6 +237,7 @@ impl SimChunk {
.mul(1.0 - chaos * 0.85)
.add(0.1)
.mul(if alt > CONFIG.sea_level + 2.0 { 1.0 } else { 0.0 }),
location: None,
}
}