Returned to normal world size

This commit is contained in:
Joshua Barretto 2020-04-21 21:05:01 +01:00
parent 7edd0e701c
commit a65dbc570a
8 changed files with 17 additions and 15 deletions

View File

@ -1,7 +1,7 @@
float hash(vec4 p) {
p = fract( p*0.3183099+.1);
p = fract(p * 0.3183099 + 0.1);
p *= 17.0;
return (fract(p.x*p.y*p.z*p.w*(p.x+p.y+p.z+p.w)) - 0.5) * 2.0;
return (fract(p.x * p.y * p.z * p.w * (p.x + p.y + p.z + p.w)) - 0.5) * 2.0;
}
float snoise(in vec4 x) {

View File

@ -49,7 +49,7 @@ void main() {
diffuse_light *= f_light * ao;
diffuse_light += point_light * ao;
vec3 col = f_col + hash(vec4(floor(mod(f_chunk_pos, 100.0) * 3.0) * 10.0, 0)) * 0.02; // Small-scale noise
vec3 col = f_col + hash(vec4(floor(f_chunk_pos * 3.0), 0)) * 0.02; // Small-scale noise
vec3 surf_color = illuminate(srgb_to_linear(col), light, diffuse_light, ambient_light);
float fog_level = fog(f_pos.xyz, focus_pos.xyz, medium.x);

BIN
assets/world/map/veloren_0_5_0_0.bin (Stored with Git LFS)

Binary file not shown.

View File

@ -24,8 +24,8 @@ fn main() {
let world = World::generate(5284, WorldOpts {
seed_elements: false,
world_file: sim::FileOpts::Load(map_path),
//world_file: sim::FileOpts::Save,
//world_file: sim::FileOpts::Load(map_path),
world_file: sim::FileOpts::Save,
..WorldOpts::default()
});

View File

@ -221,7 +221,7 @@ impl<'a> Sampler<'a> for ColumnGen<'a> {
sim.gen_ctx.turb_x_nz.get((wposf.div(48.0)).into_array()) as f32,
sim.gen_ctx.turb_y_nz.get((wposf.div(48.0)).into_array()) as f32,
) * 12.0;
let wposf_turb = wposf + turb.map(|e| e as f64);
let wposf_turb = wposf;// + turb.map(|e| e as f64);
let chaos = sim.get_interpolated(wpos, |chunk| chunk.chaos)?;
let temp = sim.get_interpolated(wpos, |chunk| chunk.temp)?;
@ -1197,7 +1197,7 @@ pub struct ColumnSample<'a> {
pub spawn_rate: f32,
pub stone_col: Rgb<u8>,
pub water_dist: Option<f32>,
pub path: Option<(f32, Vec2<i32>)>,
pub path: Option<(f32, Vec2<f32>)>,
pub chunk: &'a SimChunk,
}

View File

@ -3,6 +3,7 @@ use vek::*;
use common::{
terrain::{Block, BlockKind},
vol::{BaseVol, ReadVol, RectSizedVol, RectVolSize, Vox, WriteVol},
spiral::Spiral2d,
};
use crate::{
column::ColumnSample,
@ -42,7 +43,8 @@ pub fn apply_paths_to<'a>(
// Try to use the column at the centre of the path for sampling to make them
// flatter
let col = get_column(offs + path_nearest - wpos2d)
let col_pos = offs + path_nearest.map(|e| e.floor() as i32) - wpos2d;
let col = get_column(col_pos)
.unwrap_or(col_sample);
let (bridge_offset, depth) = if let Some(water_dist) = col.water_dist {
(

View File

@ -70,8 +70,8 @@ use vek::*;
// don't think we actually cast a chunk id to float, just coordinates... could
// be wrong though!
pub const WORLD_SIZE: Vec2<usize> = Vec2 {
x: 512 * 1,
y: 512 * 1,
x: 1024 * 1,
y: 1024 * 1,
};
/// A structure that holds cached noise values and cumulative distribution
@ -1776,7 +1776,7 @@ impl WorldSim {
Some(z0 + z1 + z2 + z3)
}
pub fn get_nearest_path(&self, wpos: Vec2<i32>) -> Option<(f32, Vec2<i32>)> {
pub fn get_nearest_path(&self, wpos: Vec2<i32>) -> Option<(f32, Vec2<f32>)> {
let chunk_pos = wpos.map2(Vec2::from(TerrainChunkSize::RECT_SIZE), |e, sz: u32| {
e.div_euclid(sz as i32)
});
@ -1836,7 +1836,7 @@ impl WorldSim {
.clamped(0.0, 1.0);
let pos = bez.evaluate(nearest_interval);
let dist_sqrd = pos.distance_squared(wpos.map(|e| e as f32));
Some((dist_sqrd, pos.map(|e| e.floor() as i32)))
Some((dist_sqrd, pos))
}),
)
})

View File

@ -566,7 +566,7 @@ impl Settlement {
Some(Plot::Water) => Some(Rgb::new(100, 150, 250)),
Some(Plot::Town) => {
if let Some((path_dist, path_nearest)) = col_sample.path {
let path_dir = (path_nearest - wpos2d).map(|e| e as f32).rotated_z(f32::consts::PI / 2.0).normalized();
let path_dir = (path_nearest - wpos2d.map(|e| e as f32)).rotated_z(f32::consts::PI / 2.0).normalized();
let is_lamp = if path_dir.x.abs() > path_dir.y.abs() {
wpos2d.x as f32 % 20.0 / path_dir.dot(Vec2::unit_y()).abs() <= 1.0
} else {